1prefix = @prefix@
2exec_prefix = @exec_prefix@
3datarootdir = @datarootdir@
4bindir = @bindir@
5datadir = @datadir@
6pkgdatadir = @datadir@/tilem2
7mandir = @mandir@
8
9top_builddir = @top_builddir@
10top_srcdir = @top_srcdir@
11srcdir = @srcdir@
12VPATH = @srcdir@
13@SET_MAKE@
14
15CC = @CC@
16CFLAGS = @CFLAGS@
17CPPFLAGS = @CPPFLAGS@
18DEFS = @DEFS@
19GUI_LDFLAGS = @GUI_LDFLAGS@
20INSTALL = @INSTALL@
21INSTALL_PROGRAM = @INSTALL_PROGRAM@
22LDFLAGS = @LDFLAGS@
23LIBS = @LIBS@
24SHELL = @SHELL@
25WINDRES = @WINDRES@
26
27GTK_CFLAGS = @GTK_CFLAGS@
28GTK_LIBS = @GTK_LIBS@
29
30TICALCS_CFLAGS = @TICALCS_CFLAGS@
31TICALCS_LIBS = @TICALCS_LIBS@
32
33TILEMCORE_CFLAGS = -I$(top_srcdir)/emu
34TILEMCORE_LIBS = -L$(top_builddir)/emu -ltilemcore
35
36TILEMDB_CFLAGS = -I$(top_srcdir)/db
37TILEMDB_LIBS = -L$(top_builddir)/db -ltilemdb
38
39DEF_SHARE_DIR = -DSHARE_DIR=\"$(pkgdatadir)\" \
40	-DUNINSTALLED_SHARE_DIR=\"$(top_srcdir)/data\"
41
42gui_extra_objects = @gui_extra_objects@
43
44objects = tilem2.o \
45	address.o \
46	animatedgif.o \
47	animation.o \
48	breakpoints.o \
49	config.o \
50	charmap.o \
51	debugger.o \
52	disasmview.o \
53	emulator.o \
54	emucore.o \
55	emuwin.o \
56	event.o \
57	filedlg.o \
58	files.o \
59	fixedtreeview.o \
60	gifencod.o \
61	icons.o \
62	keybindings.o \
63	keypaddlg.o \
64	link.o \
65	macro.o \
66	memmodel.o \
67	memview.o \
68	memory.o \
69	pbar.o \
70	preferences.o \
71	sendfile.o \
72	screenshot.o \
73	skinops.o \
74	ti81prg.o \
75	menu.o \
76	rcvmenu.o \
77	tool.o \
78	$(gui_extra_objects)
79
80libs = $(TILEMDB_LIBS) $(TILEMCORE_LIBS) $(GTK_LIBS) $(TICALCS_LIBS) $(LIBS)
81
82compile = $(CC) -I$(top_builddir) -I$(srcdir) $(CFLAGS) $(CPPFLAGS) $(DEFS) \
83	$(TILEMCORE_CFLAGS) $(TILEMDB_CFLAGS) \
84	$(GTK_CFLAGS) $(TICALCS_CFLAGS)
85
86link = $(CC) $(CFLAGS) $(LDFLAGS) $(GUI_LDFLAGS)
87
88common_headers = ../config.h ../emu/tilem.h ../db/tilemdb.h \
89	gui.h emulator.h debugger.h emuwin.h skinops.h animation.h \
90	gtk-compat.h msgbox.h fixedtreeview.h
91
92all: tilem2@EXEEXT@
93
94#Main emulator GUI
95tilem2@EXEEXT@: $(objects) ../emu/libtilemcore.a
96	$(link) -o tilem2@EXEEXT@ $(objects) $(libs)
97
98tilem2.o: tilem2.c icons.h files.h $(common_headers)
99	$(compile) -c $(srcdir)/tilem2.c
100
101# Debugger
102debugger.o: debugger.c disasmview.h $(common_headers)
103	$(compile) -c $(srcdir)/debugger.c
104
105# Disassembly view
106disasmview.o: disasmview.c disasmview.h $(common_headers)
107	$(compile) -c $(srcdir)/disasmview.c
108
109# Memory view
110memview.o: memview.c memmodel.h $(common_headers)
111	$(compile) -c $(srcdir)/memview.c
112
113# Tree model interface for calc memory
114memmodel.o: memmodel.c memmodel.h $(common_headers)
115	$(compile) -c $(srcdir)/memmodel.c
116
117# Breakpoint dialog
118breakpoints.o: breakpoints.c $(common_headers)
119	$(compile) -c $(srcdir)/breakpoints.c
120
121# Utility functions for debugging
122address.o: address.c $(common_headers)
123	$(compile) -c $(srcdir)/address.c
124
125# Keypad dialog
126keypaddlg.o: keypaddlg.c $(common_headers)
127	$(compile) -c $(srcdir)/keypaddlg.c
128
129# Memory management and messages
130memory.o: memory.c ../emu/tilem.h
131	$(compile) -c $(srcdir)/memory.c
132
133# Emulator management
134emulator.o: emulator.c emucore.h $(common_headers)
135	$(compile) -c $(srcdir)/emulator.c
136
137# Emulator main loop
138emucore.o: emucore.c emucore.h $(common_headers)
139	$(compile) -c $(srcdir)/emucore.c
140
141# Emulator GUI (main window)
142emuwin.o: emuwin.c $(common_headers)
143	$(compile) -c $(srcdir)/emuwin.c
144
145# Handle events
146event.o: event.c $(common_headers)
147	$(compile) -c $(srcdir)/event.c
148
149# Preferences dialog
150preferences.o: preferences.c $(common_headers)
151	$(compile) -c $(srcdir)/preferences.c
152
153# Open skin (skn format file) originally created by Julien Blache and Romain Lievins
154skinops.o: skinops.c skinops.h
155	$(compile) -c $(srcdir)/skinops.c
156
157# Popups and other stuff
158tool.o: tool.c $(common_headers)
159	$(compile) -c $(srcdir)/tool.c
160
161# Manage config.ini
162config.o: config.c files.h $(common_headers)
163	$(compile) -c $(srcdir)/config.c
164
165# Handle internal link
166link.o: link.c emucore.h ti81prg.h $(common_headers)
167	$(compile) -c $(srcdir)/link.c
168
169# Handle macro
170macro.o: macro.c $(common_headers)
171	$(compile) -c $(srcdir)/macro.c
172
173# Create and modify animated gif
174gifencod.o: gifencod.c gifencod.h
175	$(compile) -c $(srcdir)/gifencod.c
176
177# Handle screenshot anim (animated gif)
178animatedgif.o: animatedgif.c $(common_headers)
179	$(compile) -c $(srcdir)/animatedgif.c
180
181# Screenshot widget
182screenshot.o: screenshot.c $(common_headers)
183	$(compile) -c $(srcdir)/screenshot.c
184
185# Progress bar widget
186pbar.o: pbar.c $(common_headers)
187	$(compile) -c $(srcdir)/pbar.c
188
189# Screenshot/animation recording
190animation.o: animation.c $(common_headers)
191	$(compile) -c $(srcdir)/animation.c
192
193
194# Shared/configuration files
195files.o: files.c files.h
196	$(compile) $(DEF_SHARE_DIR) -c $(srcdir)/files.c
197
198# Custom icons
199icons.o: icons.c icons.h
200	$(compile) $(DEF_SHARE_DIR) -c $(srcdir)/icons.c
201
202# Keybindings
203keybindings.o: keybindings.c files.h $(common_headers)
204	$(compile) -c $(srcdir)/keybindings.c
205
206# Menu
207menu.o: menu.c $(common_headers)
208	$(compile) -c $(srcdir)/menu.c
209
210# Link receive dialog
211rcvmenu.o: rcvmenu.c $(common_headers)
212	$(compile) -c $(srcdir)/rcvmenu.c
213
214# Link send dialog
215sendfile.o: sendfile.c emucore.h $(common_headers)
216	$(compile) -c $(srcdir)/sendfile.c
217
218# File open/save dialogs
219filedlg.o: filedlg.c filedlg.h
220	$(compile) -c $(srcdir)/filedlg.c
221
222# Fixed-width tree view
223fixedtreeview.o: fixedtreeview.c fixedtreeview.h
224	$(compile) -c $(srcdir)/fixedtreeview.c
225
226# TI-81 program file functions
227ti81prg.o: ti81prg.c ti81prg.h ../emu/tilem.h
228	$(compile) -c $(srcdir)/ti81prg.c
229
230# Character conversion
231charmap.o: charmap.c charmap.h ../emu/tilem.h
232	$(compile) -c $(srcdir)/charmap.c
233
234# Windows resource file
235tilem2rc.o: tilem2.rc
236	major=`echo "@PACKAGE_VERSION@" | sed 's/\..*//'` ; \
237	minor=`echo "@PACKAGE_VERSION@" | sed 's/.*\.//;s/[^0-9].*//'` ; \
238	svnver=`svnversion "$(top_srcdir)" 2>/dev/null | sed 's/[^0-9].*//'` ; \
239	[ -n "$$svnver" ] || svnver=0 ; \
240	$(WINDRES) -DBUILD_VERSION=$$major,$$minor,0,$$svnver tilem2.rc tilem2rc.o
241
242tilem2.rc: tilem2.rc.in $(top_builddir)/config.status
243	cd $(top_builddir) && $(SHELL) ./config.status gui/tilem2.rc
244
245install: tilem2@EXEEXT@
246	$(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
247	$(INSTALL_PROGRAM) -m 755 tilem2@EXEEXT@ $(DESTDIR)$(bindir)
248
249uninstall:
250	rm -f $(DESTDIR)$(bindir)/tilem2@EXEEXT@
251
252clean:
253	rm -f *.o
254	rm -f tilem2@EXEEXT@
255
256Makefile: Makefile.in $(top_builddir)/config.status
257	cd $(top_builddir) && $(SHELL) ./config.status
258
259$(top_builddir)/config.status: $(top_srcdir)/configure
260	cd $(top_builddir) && $(SHELL) ./config.status --recheck
261
262.PRECIOUS: Makefile $(top_builddir)/config.status
263.PHONY: all clean install uninstall
264