Fix CPPFLAGS for each target (CLI and GTK)
authorHugo Villeneuve <hugo@hugovil.com>
Thu, 28 Nov 2013 04:02:18 +0000 (23:02 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Mon, 2 Dec 2013 02:00:08 +0000 (21:00 -0500)
configure.ac
src/Makefile.am
src/sfr.c

index da45798..3dff646 100644 (file)
@@ -33,11 +33,14 @@ AC_ARG_ENABLE(gui,
 AC_MSG_CHECKING([whether to build GUI])
 if test x$ac_cv_enable_gui = xyes; then
        AC_MSG_RESULT(yes)
 AC_MSG_CHECKING([whether to build GUI])
 if test x$ac_cv_enable_gui = xyes; then
        AC_MSG_RESULT(yes)
-        PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4.0, CFLAGS="${CFLAGS} -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED", dnl
+        PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4.0, [], dnl
         ac_cv_enable_gui=no)
 
        if test x$ac_cv_enable_gui = xyes; then
            AC_DEFINE([HAVE_GTK],1,[Set to 1 to enable GTK+ support for building GUI.])
         ac_cv_enable_gui=no)
 
        if test x$ac_cv_enable_gui = xyes; then
            AC_DEFINE([HAVE_GTK],1,[Set to 1 to enable GTK+ support for building GUI.])
+
+           GTK_CFLAGS="${GTK_CFLAGS} -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
+
             AC_SUBST(GTK_CFLAGS)
             AC_SUBST(GTK_LIBS)
        fi
             AC_SUBST(GTK_CFLAGS)
             AC_SUBST(GTK_LIBS)
        fi
index 52e4061..1bb89bb 100644 (file)
@@ -1,68 +1,59 @@
 # This file is processed by GNU automake to generate Makefile.in
 
 # This file is processed by GNU automake to generate Makefile.in
 
-INCLUDES = \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/pixmaps \
-       $(GLIB_CFLAGS) \
-       $(GTK_CFLAGS)
+AM_CPPFLAGS = \
+    -I$(top_srcdir) \
+    $(GLIB_CFLAGS)
 
 LDADD = $(GLIB_LIBS)
 
 bin_PROGRAMS = emu8051-cli
 
 LDADD = $(GLIB_LIBS)
 
 bin_PROGRAMS = emu8051-cli
+if USE_GTK
+  bin_PROGRAMS += emu8051-gtk
+endif
 
 # 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 \
 
 # 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 \
+       options.c options.h \
        log.c log.h \
        app-config.c app-config.h \
        log.c log.h \
        app-config.c app-config.h \
-       hexfile.c \
-       hexfile.h \
-       cpu8051.c \
-       cpu8051.h \
-       memory.c \
-       memory.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
 
        psw.c psw.h \
        sfr.c sfr.h \
        timers.c timers.h \
        common.h \
        reg8051.h
 
-if USE_GTK
-  bin_PROGRAMS += emu8051-gtk
+emu8051_cli_SOURCES = \
+       $(common_SOURCES) \
+       emuconsole.c \
+       keyboard.c keyboard.h
 
 
+if USE_GTK
   emu8051_gtk_SOURCES = \
        $(common_SOURCES) \
   emu8051_gtk_SOURCES = \
        $(common_SOURCES) \
-       emugtk.c \
-       emugtk.h \
-       memwin.c \
-       memwin.h \
-       pgmwin.c \
-       pgmwin.h \
-       regwin.c \
-       regwin.h \
+       emugtk.c emugtk.h \
+       memwin.c memwin.h \
+       pgmwin.c pgmwin.h \
+       regwin.c regwin.h \
        pswwin.c pswwin.h \
        pswwin.c pswwin.h \
-       filemenu.c \
-       filemenu.h \
-       viewmenu.c \
-       viewmenu.h \
-       helpmenu.c \
-       helpmenu.h \
-       messagebox.c \
-       messagebox.h
+       filemenu.c filemenu.h \
+       viewmenu.c viewmenu.h \
+       helpmenu.c helpmenu.h \
+       messagebox.c messagebox.h
+
+  emu8051_gtk_CPPFLAGS = \
+    -I$(top_srcdir)/pixmaps \
+    $(GTK_CFLAGS) \
+    $(AM_CPPFLAGS)
 
   emu8051_gtk_LDADD = $(GTK_LIBS)
 endif
 
 
   emu8051_gtk_LDADD = $(GTK_LIBS)
 endif
 
-emu8051_cli_SOURCES = \
-       $(common_SOURCES) \
-       emuconsole.c \
-       keyboard.c \
-       keyboard.h
-
 # These files are generated automatically by a perl script.
 instructions_8051.c instructions_8051.h disasm.h : opcode2c.pl opcodes.lst
        ./opcode2c.pl
 # These files are generated automatically by a perl script.
 instructions_8051.c instructions_8051.h disasm.h : opcode2c.pl opcodes.lst
        ./opcode2c.pl
index e2702ea..1bbeb8e 100644 (file)
--- a/src/sfr.c
+++ b/src/sfr.c
@@ -29,9 +29,6 @@
 #include "cpu8051.h"
 #include "sfr.h"
 #include "memory.h"
 #include "cpu8051.h"
 #include "sfr.h"
 #include "memory.h"
-#include "regwin.h"
-#include "memwin.h"
-#include "pgmwin.h"
 #include "instructions_8051.h"
 
 #define HEX_DIGITS_2 2
 #include "instructions_8051.h"
 
 #define HEX_DIGITS_2 2