Fix CPPFLAGS for each target (CLI and GTK)
[emu8051.git] / src / Makefile.am
index ede6e24..1bb89bb 100644 (file)
@@ -1,38 +1,75 @@
 # This file is processed by GNU automake to generate Makefile.in
 
-INCLUDES = -I$(top_srcdir)/pixmaps
+AM_CPPFLAGS = \
+    -I$(top_srcdir) \
+    $(GLIB_CFLAGS)
 
-bin_PROGRAMS = emu8051 emu8051_console
+LDADD = $(GLIB_LIBS)
 
-emu8051_SOURCES = EmuGtk.hpp EmuGtk.cpp CPU8051.hpp CPU8051.cpp Memory.hpp Memory.cpp \
-                  MemWin.hpp MemWin.cpp PgmWin.hpp PgmWin.cpp RegWin.hpp RegWin.cpp options.c \
-                  common.h file.c
+bin_PROGRAMS = emu8051-cli
+if USE_GTK
+  bin_PROGRAMS += emu8051-gtk
+endif
 
-emu8051_console_SOURCES = EmuConsole.hpp EmuConsole.cpp CPU8051.hpp CPU8051.cpp Memory.hpp \
-                          Memory.cpp Keyboard.hpp options.c common.h file.c
+# instructions_8051.c must be first, because it and other files
+# (instructions_8051.h and disasm.h) are automatically generated by a perl
+# script, and other source files include them (the .h).
+common_SOURCES = \
+       instructions_8051.c \
+       options.c options.h \
+       log.c log.h \
+       app-config.c app-config.h \
+       hexfile.c hexfile.h \
+       cpu8051.c cpu8051.h \
+       memory.c memory.h \
+       psw.c psw.h \
+       sfr.c sfr.h \
+       timers.c timers.h \
+       common.h \
+       reg8051.h
 
-# These headers will be included in the distribution tarball, but will not be
-# installed by 'make install'
-noinst_HEADERS = Inst_Def.hpp EmuConsole.hpp Keyboard.hpp Reg8051.hpp GtkSizes.hpp disasm.hpp \
-                 exceptions.hpp
+emu8051_cli_SOURCES = \
+       $(common_SOURCES) \
+       emuconsole.c \
+       keyboard.c keyboard.h
 
-CLEANFILES     = *~
+if USE_GTK
+  emu8051_gtk_SOURCES = \
+       $(common_SOURCES) \
+       emugtk.c emugtk.h \
+       memwin.c memwin.h \
+       pgmwin.c pgmwin.h \
+       regwin.c regwin.h \
+       pswwin.c pswwin.h \
+       filemenu.c filemenu.h \
+       viewmenu.c viewmenu.h \
+       helpmenu.c helpmenu.h \
+       messagebox.c messagebox.h
 
-DISTCLEANFILES = .deps/*.P
+  emu8051_gtk_CPPFLAGS = \
+    -I$(top_srcdir)/pixmaps \
+    $(GTK_CFLAGS) \
+    $(AM_CPPFLAGS)
+
+  emu8051_gtk_LDADD = $(GTK_LIBS)
+endif
 
-MAINTAINERCLEANFILES = Makefile.in
+# These files are generated automatically by a perl script.
+instructions_8051.c instructions_8051.h disasm.h : opcode2c.pl opcodes.lst
+       ./opcode2c.pl
 
-EXTRA_DIST = Opcode2cpp.pl opcodes.lst Inst_Imp.cpp
+CLEANFILES     = *~
+
+DISTCLEANFILES = .deps/*.P
 
-# This rule is used to bypass the default rule which is generated by Automake, in order
-# to get rid of all the cluttered informations that are displayed by Make before
-# calling the compiler like in the following example:
-#    source='programming.c' object='programming.o' libtool=no \
-#    depfile='.deps/programming.Po' tmpdepfile='.deps/programming.TPo' \
-#    depmode=gcc3 /bin/sh ../config/depcomp \
-#    gcc -DHAVE_CONFIG_H -I. -I. -I.. -c `test -f 'main.c' || echo './'`main.c
-.c.o:
-       $(COMPILE) -c $<
+MAINTAINERCLEANFILES = \
+       Makefile.in \
+       instructions_8051.c \
+       instructions_8051.h \
+       disasm.h
 
-.cpp.o:
-       $(CXXCOMPILE) -c $<
+EXTRA_DIST = \
+       opcode2c.pl \
+       opcodes.lst \
+       instructions_8051.h \
+       disasm.h