Complete.Org: Mailing Lists: Archives: freeciv-dev: September 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: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8164) building out of a builddir: generate_packets.py
From: "Marko Lindqvist" <marko.lindqvist@xxxxxxxxxxx>
Date: Sat, 18 Sep 2004 14:24:21 -0700
Reply-to: rt@xxxxxxxxxxx

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

Marko Lindqvist wrote:
>>> You include packets.h from sourcedir -> "current directory" is 
>>>sourcedir when packets.h includes "packets_gen.h". Try using <> in this 
>>>include instead of ""
> 
>   Seems to work

  Attached patch uses this approach.

  Also moves generate_packets.py out from library sources.


  - Caz


diff -Nurd -X.diff_ignore freeciv/ai/Makefile.am freeciv/ai/Makefile.am
--- freeciv/ai/Makefile.am      2004-09-18 13:28:36.437500000 +0300
+++ freeciv/ai/Makefile.am      2004-09-19 00:11:50.750000000 +0300
@@ -2,7 +2,7 @@
 
 noinst_LIBRARIES = libcivai.a
 
-AM_CPPFLAGS = -I$(top_srcdir)/utility -I$(srcdir)/../common 
-I$(srcdir)/../server -I../intl -I$(top_srcdir)/common/aicore
+AM_CPPFLAGS = -I$(top_srcdir)/utility -I$(top_builddir)/common 
-I$(top_srcdir)/common -I$(srcdir)/../server -I../intl 
-I$(top_srcdir)/common/aicore
 
 ## Above, note -I../intl instead of -I$(top_srdir/intl) is deliberate.
 
diff -Nurd -X.diff_ignore freeciv/client/Makefile.am freeciv/client/Makefile.am
--- freeciv/client/Makefile.am  2004-09-18 13:28:51.578125000 +0300
+++ freeciv/client/Makefile.am  2004-09-19 00:18:08.156250000 +0300
@@ -138,7 +138,7 @@
 
 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@
+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 @SOUND_CFLAGS@
 
 ## Above, note -I../intl instead of -I$(top_srdir/intl) is deliberate.
 
diff -Nurd -X.diff_ignore freeciv/client/agents/Makefile.am 
freeciv/client/agents/Makefile.am
--- freeciv/client/agents/Makefile.am   2004-09-18 13:28:37.062500000 +0300
+++ freeciv/client/agents/Makefile.am   2004-09-19 00:17:24.281250000 +0300
@@ -2,7 +2,7 @@
 
 noinst_LIBRARIES = libagents.a
 
-AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(top_srcdir)/common/aicore 
-I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common 
-I../../intl -I$(srcdir)/../gui-gtk @CLIENT_CFLAGS@
+AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(top_srcdir)/common/aicore 
-I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_builddir)/common 
-I$(top_srcdir)/common -I../../intl -I$(srcdir)/../gui-gtk @CLIENT_CFLAGS@
 
 libagents_a_SOURCES =          \
        agents.c                \
diff -Nurd -X.diff_ignore freeciv/client/gui-ftwl/Makefile.am 
freeciv/client/gui-ftwl/Makefile.am
--- freeciv/client/gui-ftwl/Makefile.am 2004-09-18 13:28:38.281250000 +0300
+++ freeciv/client/gui-ftwl/Makefile.am 2004-09-19 00:21:48.265625000 +0300
@@ -3,7 +3,7 @@
 SUBDIRS = 
 
 noinst_LIBRARIES = libguiclient.a
-AM_CPPFLAGS = -I. -I$(top_srcdir)/utility -I$(top_srcdir)/utility/ftwl 
-I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/.. 
-I$(srcdir)/../include -I../../intl @CLIENT_CFLAGS@
+AM_CPPFLAGS = -I. -I$(top_srcdir)/utility -I$(top_srcdir)/utility/ftwl 
-I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore 
-I$(srcdir)/.. -I$(srcdir)/../include -I../../intl @CLIENT_CFLAGS@
 
 ## Above, note -I../../intl instead of -I$(top_srdir)/intl is deliberate.
 
diff -Nurd -X.diff_ignore freeciv/client/gui-gtk/Makefile.am 
freeciv/client/gui-gtk/Makefile.am
--- freeciv/client/gui-gtk/Makefile.am  2004-09-18 13:28:39.359375000 +0300
+++ freeciv/client/gui-gtk/Makefile.am  2004-09-19 00:21:27.734375000 +0300
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
 noinst_LIBRARIES = libguiclient.a
-AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(top_srcdir)/utility 
-I$(srcdir)/../include -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore 
-I../../intl -I$(srcdir)/../agents @CLIENT_CFLAGS@
+AM_CPPFLAGS = -I. -I$(srcdir)/.. -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 @CLIENT_CFLAGS@
 
 ## Above, note -I../../intl instead of -I$(top_srdir/intl) is deliberate.
 # The AM_CPPFLAGS "-I." is so resources.c includes the locally generated 
diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/Makefile.am 
freeciv/client/gui-gtk-2.0/Makefile.am
--- freeciv/client/gui-gtk-2.0/Makefile.am      2004-09-18 13:28:40.609375000 
+0300
+++ freeciv/client/gui-gtk-2.0/Makefile.am      2004-09-19 00:15:08.828125000 
+0300
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
 noinst_LIBRARIES = libguiclient.a
-AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include 
-I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore 
-I../../intl -I$(srcdir)/../agents @CLIENT_CFLAGS@
+AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include 
-I$(top_srcdir)/utility -I$(top_builddir)/common -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 AM_CPPFLAGS "-I." is so resources.c includes the locally generated 
diff -Nurd -X.diff_ignore freeciv/client/gui-sdl/Makefile.am 
freeciv/client/gui-sdl/Makefile.am
--- freeciv/client/gui-sdl/Makefile.am  2004-09-18 13:28:44.109375000 +0300
+++ freeciv/client/gui-sdl/Makefile.am  2004-09-19 00:21:08.265625000 +0300
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
 noinst_LIBRARIES = libguiclient.a
-AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include 
-I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore 
-I../../intl -I$(srcdir)/../agents @CLIENT_CFLAGS@
+AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include 
-I$(top_srcdir)/utility -I$(top_builddir)/common -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 AM_CPPFLAGS "-I." is so resources.c includes the locally generated 
diff -Nurd -X.diff_ignore freeciv/client/gui-win32/Makefile.am 
freeciv/client/gui-win32/Makefile.am
--- freeciv/client/gui-win32/Makefile.am        2004-09-18 13:28:47.828125000 
+0300
+++ freeciv/client/gui-win32/Makefile.am        2004-09-19 00:20:53.937500000 
+0300
@@ -2,7 +2,7 @@
 
 noinst_LIBRARIES = libguiclient.a
 
-AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../agents -I$(top_srcdir)/utility 
-I$(srcdir)/../include -I$(top_srcdir)/common/aicore -I$(top_srcdir)/common 
-I../../intl @CLIENT_CFLAGS@
+AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../agents -I$(top_srcdir)/utility 
-I$(srcdir)/../include -I$(top_srcdir)/common/aicore -I$(top_builddir)/common 
-I$(top_srcdir)/common -I../../intl @CLIENT_CFLAGS@
 
 ## Above, note -I../../intl instead of -I$(top_srdir)/intl is deliberate.
 
diff -Nurd -X.diff_ignore freeciv/client/gui-xaw/Makefile.am 
freeciv/client/gui-xaw/Makefile.am
--- freeciv/client/gui-xaw/Makefile.am  2004-09-18 13:28:49.875000000 +0300
+++ freeciv/client/gui-xaw/Makefile.am  2004-09-19 00:20:38.687500000 +0300
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
 noinst_LIBRARIES = libguiclient.a
-AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include 
-I$(top_srcdir)/utility -I$(top_srcdir)/common -I../../intl 
-I$(top_srcdir)/common/aicore -I../../intl -I$(srcdir)/../agents @CLIENT_CFLAGS@
+AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include 
-I$(top_srcdir)/utility -I$(top_builddir)/common -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 AM_CPPFLAGS "-I." is so resources.c includes the locally generated 
diff -Nurd -X.diff_ignore freeciv/common/Makefile.am freeciv/common/Makefile.am
--- freeciv/common/Makefile.am  2004-09-18 13:28:53.765625000 +0300
+++ freeciv/common/Makefile.am  2004-09-18 23:52:17.125000000 +0300
@@ -27,7 +27,6 @@
                fc_types.h      \
                game.c          \
                game.h          \
-               generate_packets.py \
                government.c    \
                government.h    \
                idex.c          \
@@ -62,15 +61,16 @@
 
 BUILT_SOURCES = packets_gen.c packets_gen.h
 
+EXTRA_DIST =   generate_packets.py
+
 # ./generate_packets makes both packets_gen.[ch]
 # Feed the dependence through a fake intermediate file to avoid
 # a race condition in a parallel build (like make -j2).
 packets_gen.h packets_gen.c: packets_generate
 .INTERMEDIATE: packets_generate
 packets_generate: packets.def generate_packets.py
-       ./generate_packets.py
+       $(srcdir)/generate_packets.py $(srcdir)/packets.def
        touch packets_generate
 
 #libcivcommon_a_DEPENDENCIES = ../utility/libcivutility.a
 #libcivcommon_a_LIBADD       = ../utility/libcivutility.a
-
diff -Nurd -X.diff_ignore freeciv/common/aicore/Makefile.am 
freeciv/common/aicore/Makefile.am
--- freeciv/common/aicore/Makefile.am   2004-09-18 13:28:53.140625000 +0300
+++ freeciv/common/aicore/Makefile.am   2004-09-19 00:26:03.312500000 +0300
@@ -2,7 +2,7 @@
 
 noinst_LIBRARIES = libaicore.a
 
-AM_CPPFLAGS = -I$(top_srcdir)/utility -I.. -I$(top_srcdir)/common -I../../intl
+AM_CPPFLAGS = -I$(top_srcdir)/utility -I.. -I$(top_builddir)/common 
-I$(top_srcdir)/common -I../../intl
 
 libaicore_a_SOURCES =          \
        aisupport.c             \
diff -Nurd -X.diff_ignore freeciv/common/generate_packets.py 
freeciv/common/generate_packets.py
--- freeciv/common/generate_packets.py  2004-09-18 13:28:53.546875000 +0300
+++ freeciv/common/generate_packets.py  2004-09-19 00:22:43.125000000 +0300
@@ -1355,7 +1355,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/common/packets.h freeciv/common/packets.h
--- freeciv/common/packets.h    2004-09-18 13:28:53.843750000 +0300
+++ freeciv/common/packets.h    2004-09-19 00:01:31.578125000 +0300
@@ -65,7 +65,10 @@
   AUTH_NEWUSER_RETRY  /* inform the client to try a different [new] password */
 };
 
-#include "packets_gen.h"
+/* Deliberate use of angle-brackets instead of double quotes.
+   When header exist in both builddir and srcdir, we want to use
+   generated one in builddir. */
+#include <packets_gen.h>
 
 void *get_packet_from_connection(struct connection *pc, enum packet_type 
*ptype, bool *presult);
 void remove_packet_from_buffer(struct socket_packet_buffer *buffer);
diff -Nurd -X.diff_ignore freeciv/manual/Makefile.am freeciv/manual/Makefile.am
--- freeciv/manual/Makefile.am  2004-09-18 13:29:23.046875000 +0300
+++ freeciv/manual/Makefile.am  2004-09-19 00:19:15.437500000 +0300
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
 bin_PROGRAMS = civmanual
-AM_CPPFLAGS = -I$(top_srcdir)/server -I$(top_srcdir)/utility 
-I$(top_srcdir)/common -I$(top_srcdir)/ai -I../intl 
-I$(top_srcdir)/common/aicore -I$(top_srcdir)/server/userdb 
-I$(top_srcdir)/server/generator -I$(top_srcdir)/client 
-I$(top_srcdir)/client/include
+AM_CPPFLAGS = -I$(top_srcdir)/server -I$(top_srcdir)/utility 
-I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/ai -I../intl 
-I$(top_srcdir)/common/aicore -I$(top_srcdir)/server/userdb 
-I$(top_srcdir)/server/generator -I$(top_srcdir)/client 
-I$(top_srcdir)/client/include
 
 ## Above, note -I../intl instead of -I$(top_srcdir/intl) is deliberate.
 
diff -Nurd -X.diff_ignore freeciv/server/Makefile.am freeciv/server/Makefile.am
--- freeciv/server/Makefile.am  2004-09-18 13:29:27.140625000 +0300
+++ freeciv/server/Makefile.am  2004-09-19 00:13:44.875000000 +0300
@@ -4,7 +4,7 @@
 
 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 -I$(srcdir)/generator
+AM_CPPFLAGS = -I$(top_srcdir)/utility -I$(top_builddir)/common 
-I$(top_srcdir)/common -I$(srcdir)/../ai -I../intl 
-I$(top_srcdir)/common/aicore -I$(srcdir)/userdb -I$(srcdir)/generator
 
 
 ## Above, note -I../intl instead of -I$(top_srdir/intl) is deliberate.
diff -Nurd -X.diff_ignore freeciv/server/generator/Makefile.am 
freeciv/server/generator/Makefile.am
--- freeciv/server/generator/Makefile.am        2004-09-18 13:29:26.953125000 
+0300
+++ freeciv/server/generator/Makefile.am        2004-09-19 00:12:54.562500000 
+0300
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 noinst_LIBRARIES = libgenerator.a
 
-AM_CPPFLAGS = -I$(top_srcdir)/utility -I$(top_srcdir)/common 
-I$(top_srcdir)/server -I$(top_builddir)/intl -I$(top_srcdir)/server/generator
+AM_CPPFLAGS = -I$(top_srcdir)/utility -I$(top_builddir)/common 
-I$(top_srcdir)/common -I$(top_srcdir)/server -I$(top_builddir)/intl 
-I$(top_srcdir)/server/generator
 
 libgenerator_a_SOURCES = \
        mapgen.c \

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