Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] Re: [Fwd: Re: Re: (PR#8164) building out of a builddir: ge
Home

[Freeciv-Dev] Re: [Fwd: Re: Re: (PR#8164) building out of a builddir: ge

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [Fwd: Re: Re: (PR#8164) building out of a builddir: generate_packets.py]
From: "Marko Lindqvist" <marko.lindqvist@xxxxxxxxxxx>
Date: Sat, 28 Aug 2004 07:36:58 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8164 >

Marko Lindqvist wrote:
> Then
> everything works for gcc, but other compilers cannot be used to compile
> from separate builddir. Is this acceptable limitation?

  Since there has been no proposal for more generic solution, this patch 
version fixes this for us who use '-I-' accepting preprocessors. There 
is new file m4/cpp.m4.

  - Configure time check if preprocessor accepts '-I-'
  - Added comments to Makefile.ams. I still modified only those 
Makefiles that absolutelely had to be modified to make this work. I'll 
unify rest of the Makefiles once wording of comment is agreed about (I 
want to copypaste it to all Makefiles only once).

  - Name of variable SOUND_CFLAGS suggest that there might be some 
CFLAGS in it (in addition to CPPFLAGS) so I added it to AM_CFLAGS too in 
client/Makefile.am. I changed this only because I were modifying those 
lines anyway. More thorough cleanup for SOUND_CFLAGS is not concern of 
this ticket.


  - Caz


diff -Nurd -X.diff_ignore freeciv/Makefile.am freeciv/Makefile.am
--- freeciv/Makefile.am 2004-08-27 15:50:06.234375000 +0300
+++ freeciv/Makefile.am 2004-08-28 17:37:00.359375000 +0300
@@ -45,6 +45,7 @@
                m4/ac_path_lib.m4               \
                m4/auth.m4                      \
                m4/c99.m4                       \
+               m4/cpp.m4                       \
                m4/debug.m4                     \
                m4/esd.m4                       \
                m4/alsa.m4                      \
diff -Nurd -X.diff_ignore freeciv/client/Makefile.am freeciv/client/Makefile.am
--- freeciv/client/Makefile.am  2004-08-27 15:49:31.921875000 +0300
+++ freeciv/client/Makefile.am  2004-08-28 17:34:41.328125000 +0300
@@ -138,9 +138,18 @@
 
 bin_PROGRAMS = civclient
 
-AM_CPPFLAGS = -I$(top_srcdir)/utility -I$(srcdir)/include 
-I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I../intl 
-I$(srcdir)/agents @SOUND_CFLAGS@
+## Headers from directories listed before INCLUDE_TYPE_SEPARATOR
+## have to be included using quotation marks: #include "header.h"
+## top_builddir is after INCLUDE_TYPE_SEPARATOR so config.h can
+## be included like this: #include <config.h>
+## Note -I../intl instead of -I$(top_srcdir/intl) is deliberate.
+## SOUND_CFLAGS contains preprocessor flags, so we include it to
+## AM_CPPFLAGS also.
 
-## Above, note -I../intl instead of -I$(top_srdir/intl) is deliberate.
+AM_CPPFLAGS = -I$(top_srcdir)/utility -I$(srcdir)/include 
-I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore 
-I../intl -I$(srcdir)/agents \
+@INCLUDE_TYPE_SEPARATOR@ -I$(top_builddir) @SOUND_CFLAGS@
+
+AM_CFLAGS = @SOUND_CFLAGS@
 
 civclient_SOURCES = $(ESD_FILES) $(SDL_FILES) $(ALSA_FILES) $(WINMM_FILES) \
        attribute.h     \
diff -Nurd -X.diff_ignore freeciv/common/Makefile.am freeciv/common/Makefile.am
--- freeciv/common/Makefile.am  2004-08-27 15:49:34.375000000 +0300
+++ freeciv/common/Makefile.am  2004-08-28 17:12:52.296875000 +0300
@@ -4,9 +4,15 @@
 
 noinst_LIBRARIES = libcivcommon.a
 
-AM_CPPFLAGS = -I../intl -I$(top_srcdir)/utility -I$(srcdir)/aicore
+## Headers from directories listed before INCLUDE_TYPE_SEPARATOR
+## have to be included using quotation marks: #include "header.h"
+## top_builddir is after INCLUDE_TYPE_SEPARATOR so config.h can
+## be included like this: #include <config.h>
+## Note -I../intl instead of -I$(top_srcdir/intl) is deliberate.
+
+AM_CPPFLAGS = -I../intl -I$(top_srcdir)/utility -I$(srcdir)/aicore \
+@INCLUDE_TYPE_SEPARATOR@ -I$(top_builddir)
 
-## Above, note -I../intl instead of -I$(top_srcdir/intl) is deliberate.
 
 libcivcommon_a_SOURCES = \
                capstr.c        \
@@ -62,7 +68,7 @@
 
 BUILT_SOURCES = packets_gen.c packets_gen.h
 packets_gen.h packets_gen.c: packets.def generate_packets.py
-       ./generate_packets.py
+       $(srcdir)/generate_packets.py $(srcdir)/packets.def
 
 #libcivcommon_a_DEPENDENCIES = ../utility/libcivutility.a
 #libcivcommon_a_LIBADD       = ../utility/libcivutility.a
diff -Nurd -X.diff_ignore freeciv/common/generate_packets.py 
freeciv/common/generate_packets.py
--- freeciv/common/generate_packets.py  2004-08-27 15:49:33.750000000 +0300
+++ freeciv/common/generate_packets.py  2004-08-28 15:57:14.656250000 +0300
@@ -1345,7 +1345,10 @@
 # various files.
 def main():
     ### parsing input
-    input_name="packets.def"
+    if len(sys.argv) < 2:
+        input_name="packets.def"
+    else:
+        input_name=sys.argv[1]
     content=open(input_name).read()
     content=strip_c_comment(content)
     lines=string.split(content,"\n")
diff -Nurd -X.diff_ignore freeciv/configure.ac freeciv/configure.ac
--- freeciv/configure.ac        2004-08-27 15:49:35.562500000 +0300
+++ freeciv/configure.ac        2004-08-28 16:37:20.437500000 +0300
@@ -611,6 +611,10 @@
 dnl Rebuild 'configure' whenever version.in changes, if maintainer mode 
enabled.
 AC_SUBST([CONFIGURE_DEPENDENCIES], ["$CONFIGURE_DEPENDENCIES 
\$(top_srcdir)/version.in"])
 
+dnl Determine how to separate "include" and <include> paths in AM_CPPFLAGS
+CPP_INCLUDE_TYPE_SEPARATOR
+AC_SUBST([INCLUDE_TYPE_SEPARATOR])
+
 AC_CONFIG_FILES([Makefile
           data/Makefile 
          data/flags/Makefile
diff -Nurd -X.diff_ignore freeciv/configure.in freeciv/configure.in
--- freeciv/configure.in        2004-08-27 15:49:35.578125000 +0300
+++ freeciv/configure.in        2004-08-28 16:38:28.718750000 +0300
@@ -608,6 +608,10 @@
 CONFIGURE_DEPENDENCIES="$CONFIGURE_DEPENDENCIES \$(top_srcdir)/version.in"
 AC_SUBST([CONFIGURE_DEPENDENCIES])
 
+dnl Determine how to separate "include" and <include> paths in AM_CPPFLAGS
+CPP_INCLUDE_PATH_SEPARATOR
+AC_SUBST([INCLUDE_PATH_SEPARATOR])
+
 AC_OUTPUT(Makefile
           data/Makefile 
          data/flags/Makefile
diff -Nurd -X.diff_ignore freeciv/m4/cpp.m4 freeciv/m4/cpp.m4
--- freeciv/m4/cpp.m4   1970-01-01 02:00:00.000000000 +0200
+++ freeciv/m4/cpp.m4   2004-08-28 17:00:33.875000000 +0300
@@ -0,0 +1,13 @@
+#
+# Copyright (C) 2004 Freeciv team
+#
+# Check for certain preprocessor qualities
+#
+
+AC_DEFUN([CPP_INCLUDE_TYPE_SEPARATOR],
+[
+  REAL_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="$CPPGLAGS -I-"
+  AC_TRY_CPP(,[INCLUDE_TYPE_SEPARATOR="-I-"], [INCLUDE_TYPE_SEPARATOR= ])
+  CPPFLAGS="$REAL_CPPFLAGS"
+])
diff -Nurd -X.diff_ignore freeciv/server/Makefile.am freeciv/server/Makefile.am
--- freeciv/server/Makefile.am  2004-08-27 15:50:10.765625000 +0300
+++ freeciv/server/Makefile.am  2004-08-28 16:10:07.687500000 +0300
@@ -4,9 +4,16 @@
 
 bin_PROGRAMS = civserver
 noinst_LIBRARIES = libcivserver.a
-AM_CPPFLAGS = -I$(top_srcdir)/utility -I$(srcdir)/../common -I$(srcdir)/../ai 
-I../intl -I$(top_srcdir)/common/aicore -I$(srcdir)/userdb
 
-## Above, note -I../intl instead of -I$(top_srdir/intl) is deliberate.
+## Headers from directories listed before INCLUDE_TYPE_SEPARATOR
+## have to be included using quotation marks: #include "header.h"
+## top_builddir is after INCLUDE_TYPE_SEPARATOR so config.h can
+## be included like this: #include <config.h>
+## Note -I../intl instead of -I$(top_srcdir/intl) is deliberate.
+
+AM_CPPFLAGS = -I$(top_srcdir)/utility -I$(top_builddir)/common 
-I$(top_srcdir)/common -I$(top_srcdir)/ai -I../intl 
-I$(top_srcdir)/common/aicore -I$(srcdir)/userdb \
+@INCLUDE_TYPE_SEPARATOR@ -I$(top_builddir)
+
 
 civserver_SOURCES = \
                civserver.c     \

[Prev in Thread] Current Thread [Next in Thread]