Complete.Org: Mailing Lists: Archives: freeciv-dev: August 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, 21 Aug 2004 13:32:35 -0700
Reply-to: rt@xxxxxxxxxxx

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

  I had almost forgotten this ticket, but then I touched packets.def...


Marko Lindqvist wrote:
> 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, but...

>   Or if we want to keep it as ""-include, provide '-I-' in compiler 
> command line. It does disable including from "current directory".

  ...so does this, and I personally prefer latter.

> Problem is that this is not only effect it has, it also prevents '-I' 
> -options earlier in command line from affecting <>-includes. So it might 
> take some thinking to decide where in the command line it should be, do 
> we want to provide any includes only through ""-includes? That could be 
> used to dictate that project specific files must be included using ""-style.

  Indeed this is not a problem but a possibility. For attached patch I 
took some snippets from Jason's patch, modified and added some quirks of 
my own. I touched only those Makefile.am's that I had to in order to 
make freeciv compile after packets.def changes (no, breaking my srcdir 
by building something there is not an option). For consistencuy at 
least, similar include policy should be adopted for rest of the 
Makefile.am's.
  All include paths pointing to freeciv directories can only be used 
with "" -includes except top_builddir, where config.h lives (as a side 
effect, this allows <> -includes from top_srcdir when top_srcdir == 
top_builddir)


  - Caz



diff -Nurd freeciv/client/Makefile.am freeciv/client/Makefile.am
--- freeciv/client/Makefile.am  2004-08-18 17:11:29.781250000 +0300
+++ freeciv/client/Makefile.am  2004-08-21 23:11:37.093750000 +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 -I- -I$(top_builddir) @SOUND_CFLAGS@
 
 ## Above, note -I../intl instead of -I$(top_srdir/intl) is deliberate.
 
diff -Nurd freeciv/common/Makefile.am freeciv/common/Makefile.am
--- freeciv/common/Makefile.am  2004-08-18 17:11:32.234375000 +0300
+++ freeciv/common/Makefile.am  2004-08-21 23:07:41.140625000 +0300
@@ -4,7 +4,7 @@
 
 noinst_LIBRARIES = libcivcommon.a
 
-AM_CPPFLAGS = -I../intl -I$(top_srcdir)/utility -I$(srcdir)/aicore
+AM_CPPFLAGS = -I../intl -I$(top_srcdir)/utility -I$(srcdir)/aicore -I- 
-I$(top_builddir)
 
 ## Above, note -I../intl instead of -I$(top_srcdir/intl) is deliberate.
 
@@ -62,7 +62,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 freeciv/common/generate_packets.py freeciv/common/generate_packets.py
--- freeciv/common/generate_packets.py  2004-08-18 17:11:32.062500000 +0300
+++ freeciv/common/generate_packets.py  2004-08-21 23:07:41.171875000 +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 freeciv/server/Makefile.am freeciv/server/Makefile.am
--- freeciv/server/Makefile.am  2004-08-18 17:12:06.484375000 +0300
+++ freeciv/server/Makefile.am  2004-08-21 23:11:48.937500000 +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
+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 -I- -I$(top_builddir)
 
 ## Above, note -I../intl instead of -I$(top_srdir/intl) is deliberate.
 

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