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

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

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#8164) building out of a builddir: generate_packets.py
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 27 Mar 2004 09:40:11 -0800
Reply-to: rt@xxxxxxxxxxx

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

Raimar Falke wrote:

> So you are right that the <>-places are searched after the ""-places
> for ""-includes. But the terms "forward" and "backwards" are wrong or
> at least very misleading.

Misleading because it's apparently implementation-defined.  This is 
unfortunate.  But back-to-front is true for gcc.  For other compilers we 
have to take our chances.  But in this case the builddir/srcdir 
distinction probably isn't as important.

> I think it is as easy as including both BUILDDIR and SRCDIR in the
> ""-places and make sure that BUILDDIR occurs before SRCDIR.

Yes, except again it must be after.  It's *already* included before the 
srcdir.

Here's a patch that makes the change.  But it doesn't work, and I don't 
know why.

if gcc -DHAVE_CONFIG_H -I. -I../../freeciv/common -I.. -I../intl 
-I../../freeciv/common/aicore -I.    -g -O -Wall -Werror -Wcast-align 
-Wmissing-prototypes -Wmissing-declarations -MT city.o -MD -MP -MF 
".deps/city.Tpo" -c -o city.o ../../freeciv/common/city.c;

-I. is listed both first and last, yet packets_gen.h is being taken from 
../../freeciv/common instead.  (To test it I made the packets_gen.h in 
the srcdir empty.  So it won't compile unless the builddir copy is used.)

jason

? Womoks
Index: ai/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/Makefile.am,v
retrieving revision 1.15
diff -u -r1.15 Makefile.am
--- ai/Makefile.am      21 Sep 2003 14:02:14 -0000      1.15
+++ ai/Makefile.am      27 Mar 2004 16:37:46 -0000
@@ -2,7 +2,7 @@
 
 noinst_LIBRARIES = libcivai.a
 
-INCLUDES = -I$(srcdir)/../common -I$(srcdir)/../server -I../intl 
-I$(top_srcdir)/common/aicore
+INCLUDES = -I../common -I../server -I$(srcdir)/../common -I$(srcdir)/../server 
-I../intl -I$(top_srcdir)/common/aicore
 
 ## Above, note -I../intl instead of -I$(top_srdir/intl) is deliberate.
 
Index: client/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/Makefile.am,v
retrieving revision 1.53
diff -u -r1.53 Makefile.am
--- client/Makefile.am  6 Dec 2003 19:23:50 -0000       1.53
+++ client/Makefile.am  27 Mar 2004 16:37:46 -0000
@@ -129,7 +129,8 @@
 
 bin_PROGRAMS = civclient
 
-INCLUDES = -I$(srcdir)/include -I$(top_srcdir)/common 
-I$(top_srcdir)/common/aicore -I../intl -I$(srcdir)/agents @SOUND_CFLAGS@
+# Note the inclusion of some directories from the builddir.
+INCLUDES = -I$(srcdir)/include -I$(top_srcdir)/common 
-I$(top_srcdir)/common/aicore -I$(top_builddir)/intl -I$(srcdir)/agents 
@SOUND_CFLAGS@ -I$(top_builddir)/common -I$(builddir)
 
 ## Above, note -I../intl instead of -I$(top_srdir/intl) is deliberate.
 
Index: client/agents/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/agents/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- client/agents/Makefile.am   21 Dec 2002 14:19:05 -0000      1.2
+++ client/agents/Makefile.am   27 Mar 2004 16:37:46 -0000
@@ -2,7 +2,8 @@
 
 noinst_LIBRARIES = libagents.a
 
-INCLUDES = -I. -I$(srcdir)/.. -I$(top_srcdir)/common/aicore 
-I$(srcdir)/../include -I$(top_srcdir)/common -I../../intl 
-I$(srcdir)/../gui-gtk @CLIENT_CFLAGS@
+# Note the inclusion of some directories from the builddir.
+INCLUDES = -I$(top_srcdir)/common -I$(srcdir)/.. -I$(top_srcdir)/common/aicore 
-I$(srcdir)/../include -I$(top_srcdir)/common -I$(top_builddir)/intl 
-I$(srcdir)/../gui-gtk @CLIENT_CFLAGS@ -I($top_builddir)/common 
-I$(top_builddir)/client
 
 libagents_a_SOURCES =          \
        agents.c                \
Index: client/gui-gtk/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/Makefile.am,v
retrieving revision 1.17
diff -u -r1.17 Makefile.am
--- client/gui-gtk/Makefile.am  23 Feb 2003 14:11:14 -0000      1.17
+++ client/gui-gtk/Makefile.am  27 Mar 2004 16:37:46 -0000
@@ -1,12 +1,9 @@
 ## Process this file with automake to produce Makefile.in
 
 noinst_LIBRARIES = libguiclient.a
-INCLUDES = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/common 
-I$(top_srcdir)/common/aicore -I../../intl -I$(srcdir)/../agents @CLIENT_CFLAGS@
 
-## Above, note -I../../intl instead of -I$(top_srdir/intl) is deliberate.
-# The INCLUDES "-I." is so resources.c includes the locally generated 
-# Freeciv.h in the compilation dir, in preference to the one 
-# in the source dir (when compiling from another dir). --dwp
+# Note the inclusion of some directories from the builddir.
+INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/common 
-I$(top_srcdir)/common/aicore -I$(top_builddir)/intl -I$(srcdir)/../agents 
@CLIENT_CFLAGS@ -I$(top_builddir)/client -I$(top_builddir)/common
 
 BUILT_SOURCES = Freeciv.h
 CLEANFILES = Freeciv.h
Index: client/gui-gtk-2.0/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/Makefile.am,v
retrieving revision 1.4
diff -u -r1.4 Makefile.am
--- client/gui-gtk-2.0/Makefile.am      23 Feb 2003 14:11:14 -0000      1.4
+++ client/gui-gtk-2.0/Makefile.am      27 Mar 2004 16:37:46 -0000
@@ -1,12 +1,9 @@
 ## Process this file with automake to produce Makefile.in
 
 noinst_LIBRARIES = libguiclient.a
-INCLUDES = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/common 
-I$(top_srcdir)/common/aicore -I../../intl -I$(srcdir)/../agents @CLIENT_CFLAGS@
 
-## Above, note -I../../intl instead of -I$(top_srdir/intl) is deliberate.
-# The INCLUDES "-I." is so resources.c includes the locally generated 
-# Freeciv.h in the compilation dir, in preference to the one 
-# in the source dir (when compiling from another dir). --dwp
+# Note the inclusion of some directories from the builddir.
+INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/common 
-I$(top_srcdir)/common/aicore -I$(top_builddir)/intl -I$(srcdir)/../agents 
@CLIENT_CFLAGS@ -I$(top_builddir)/client -I$(top_builddir)/common
 
 BUILT_SOURCES = Freeciv.h
 CLEANFILES = Freeciv.h
Index: client/gui-sdl/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/Makefile.am,v
retrieving revision 1.6
diff -u -r1.6 Makefile.am
--- client/gui-sdl/Makefile.am  8 May 2003 03:24:44 -0000       1.6
+++ client/gui-sdl/Makefile.am  27 Mar 2004 16:37:46 -0000
@@ -1,12 +1,9 @@
 ## Process this file with automake to produce Makefile.in
 
 noinst_LIBRARIES = libguiclient.a
-INCLUDES = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/common 
-I$(top_srcdir)/common/aicore -I../../intl -I$(srcdir)/../agents @CLIENT_CFLAGS@
 
-## Above, note -I../../intl instead of -I$(top_srdir/intl) is deliberate.
-# The INCLUDES "-I." is so resources.c includes the locally generated 
-# Freeciv.h in the compilation dir, in preference to the one 
-# in the source dir (when compiling from another dir). --dwp
+# Note the inclusion of some directories from the builddir.
+INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/common 
-I$(top_srcdir)/common/aicore -I$(top_builddir)/intl -I$(srcdir)/../agents 
@CLIENT_CFLAGS@ -I$(top_builddir)/client -I$(top_builddir)/common
 
 BUILT_SOURCES = Freeciv.h
 CLEANFILES = Freeciv.h
Index: client/gui-stub/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-stub/Makefile.am,v
retrieving revision 1.3
diff -u -r1.3 Makefile.am
--- client/gui-stub/Makefile.am 23 Feb 2003 14:11:14 -0000      1.3
+++ client/gui-stub/Makefile.am 27 Mar 2004 16:37:46 -0000
@@ -1,9 +1,9 @@
 ## Process this file with automake to produce Makefile.in
 
 noinst_LIBRARIES = libguiclient.a
-INCLUDES = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/common 
-I../../intl @CLIENT_CFLAGS@
 
-## Above, note -I../../intl instead of -I$(top_srdir)/intl is deliberate.
+# Note the inclusion of some directories from the builddir.
+INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/common 
-I$(top_srcdir)/common/aicore -I$(top_builddir)/intl -I$(srcdir)/../agents 
@CLIENT_CFLAGS@ -I$(top_builddir)/client -I$(top_builddir)/common
 
 libguiclient_a_SOURCES = \
        chatline.c      \
Index: client/gui-win32/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/Makefile.am,v
retrieving revision 1.8
diff -u -r1.8 Makefile.am
--- client/gui-win32/Makefile.am        9 Nov 2003 16:45:01 -0000       1.8
+++ client/gui-win32/Makefile.am        27 Mar 2004 16:37:46 -0000
@@ -2,9 +2,8 @@
 
 noinst_LIBRARIES = libguiclient.a
 
-INCLUDES = -I. -I$(srcdir)/.. -I$(srcdir)/../include 
-I$(top_srcdir)/common/aicore -I$(top_srcdir)/common -I../../intl 
@CLIENT_CFLAGS@
-
-## Above, note -I../../intl instead of -I$(top_srdir)/intl is deliberate.
+# Note the inclusion of some directories from the builddir.
+INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/common/aicore 
-I$(top_srcdir)/common -I$(top_builddir)/intl @CLIENT_CFLAGS@ 
-I$(top_builddir)/client -I$(top_builddir)/common
 
 libguiclient_a_SOURCES = \
        chatline.c      \
Index: client/gui-xaw/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/Makefile.am,v
retrieving revision 1.14
diff -u -r1.14 Makefile.am
--- client/gui-xaw/Makefile.am  28 Jul 2003 01:11:48 -0000      1.14
+++ client/gui-xaw/Makefile.am  27 Mar 2004 16:37:46 -0000
@@ -1,12 +1,9 @@
 ## Process this file with automake to produce Makefile.in
 
 noinst_LIBRARIES = libguiclient.a
-INCLUDES = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/common 
-I../../intl -I$(top_srcdir)/common/aicore -I../../intl -I$(srcdir)/../agents 
@CLIENT_CFLAGS@
 
-## Above, note -I../../intl instead of -I$(top_srdir/intl) is deliberate.
-# The INCLUDES "-I." is so resources.c includes the locally generated 
-# Freeciv.h in the compliation dir, in preference to the one 
-# in the source dir (when compiling from another dir). --dwp
+# Note the inclusion of some directories from the builddir.
+INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/common 
-I../../intl -I$(top_srcdir)/common/aicore -I$(top_builddir)/intl 
-I$(srcdir)/../agents @CLIENT_CFLAGS@ -I$(top_builddir)/client 
-I$(top_builddir)/common
 
 BUILT_SOURCES = Freeciv.h
 CLEANFILES = Freeciv.h
Index: common/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/Makefile.am,v
retrieving revision 1.49
diff -u -r1.49 Makefile.am
--- common/Makefile.am  13 Feb 2004 07:57:58 -0000      1.49
+++ common/Makefile.am  27 Mar 2004 16:37:46 -0000
@@ -4,9 +4,10 @@
 
 noinst_LIBRARIES = libcivcommon.a
 
-INCLUDES = -I../intl -I$(srcdir)/aicore
-
-## Above, note -I../intl instead of -I$(top_srdir/intl) is deliberate.
+# $srcdir/common and $builddir/common are both included.  The builddirs are
+# included last since this should get priority for generated source file
+# includes.  Note that /intl is also included from the builddir.
+INCLUDES = -I$(top_builddir)/intl -I$(srcdir)/aicore -I$(builddir)
 
 libcivcommon_a_SOURCES = \
                astring.c       \
@@ -99,4 +100,4 @@
 
 BUILT_SOURCES = packets_gen.c packets_gen.h
 packets_gen.h packets_gen.c: packets.def generate_packets.py
-       ./generate_packets.py
+       $(top_srcdir)/common/generate_packets.py 
$(top_srcdir)/common/packets.def
Index: common/generate_packets.py
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/generate_packets.py,v
retrieving revision 1.8
diff -u -r1.8 generate_packets.py
--- common/generate_packets.py  19 Mar 2004 18:47:22 -0000      1.8
+++ common/generate_packets.py  27 Mar 2004 16:37:47 -0000
@@ -1315,7 +1315,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")
Index: server/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/Makefile.am,v
retrieving revision 1.32
diff -u -r1.32 Makefile.am
--- server/Makefile.am  6 Dec 2003 19:23:51 -0000       1.32
+++ server/Makefile.am  27 Mar 2004 16:37:48 -0000
@@ -4,9 +4,9 @@
 
 bin_PROGRAMS = civserver
 noinst_LIBRARIES = libcivserver.a
-INCLUDES = -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.
+# Note the inclusion of some directories from the builddir.
+INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/ai -I$(top_builddir)/intl 
-I$(top_srcdir)/common/aicore -I$(srcdir)/userdb -I$(top_builddir)/common 
-I$(builddir)
 
 civserver_SOURCES = \
                civserver.c     \

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