Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: #include problem for generated files included in system.h



On Mon, 9 May 2011 07:25:16 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> Rather than generate <some-relative-path-added-to-zsh.mdd>/system.h
> why not add -Isome-relative-path-added-to-zsh.mdd to CLFAGS?  Is the
> path being generated at a poor place relative to building Makefiles?

The problem is that if you don't tell it explicitly where each file is,
then you need to give it a whole load of possibilities of where a header
might be relative to the current directory.
- It might be in the current directory.
- It might be generated in the build version of the Src directory.
- It might be in the original Src directory.
- It might be in the original Src/Zle directory (needed to get comp.h
  in zutil).
- It might be in the source directory corresponding to the current build
  directory.

The following seemed to do the trick.  The ordering of the -I arguments
may not be entirely logical but was the first thing that worked
everywhere I tried it.

> While we're at it the name "system.h" has always seemed a bit generic
> to me, and therefore likely to clash with something.

I'll see if I can do that separately.

Index: Src/Makemod.in.in
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Makemod.in.in,v
retrieving revision 1.8
diff -p -u -r1.8 Makemod.in.in
--- Src/Makemod.in.in	9 Jan 2011 16:57:02 -0000	1.8
+++ Src/Makemod.in.in	10 May 2011 16:28:21 -0000
@@ -47,8 +47,8 @@ dir_src       = $(dir_top)/Src
 
 DNCFLAGS =
 
-COMPILE     = $(CC) -c -I. $(CPPFLAGS) $(DEFS) $(CFLAGS) $(D@L@CFLAGS)
-DLCOMPILE   = $(CC) -c -I. $(CPPFLAGS) $(DEFS) -DMODULE $(CFLAGS) $(DLCFLAGS)
+COMPILE     = $(CC) -c -I. -I$(dir_top)/Src -I$(sdir_top)/Src -I$(sdir_top)/Src/Zle -I$(sdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(D@L@CFLAGS)
+DLCOMPILE   = $(CC) -c -I. -I$(dir_top)/Src -I$(sdir_top)/Src -I$(sdir_top)/Src/Zle -I$(sdir) $(CPPFLAGS) $(DEFS) -DMODULE $(CFLAGS) $(DLCFLAGS)
 LINK        = $(CC) $(LDFLAGS) $(EXELDFLAGS) $(EXTRA_LDFLAGS) -o $@
 DLLINK      = $(DLLD) $(LDFLAGS) $(LIBLDFLAGS) $(DLLDFLAGS) -o $@
 
Index: Src/mkmakemod.sh
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/mkmakemod.sh,v
retrieving revision 1.17
diff -p -u -r1.17 mkmakemod.sh
--- Src/mkmakemod.sh	30 Jan 2008 10:03:49 -0000	1.17
+++ Src/mkmakemod.sh	10 May 2011 16:28:22 -0000
@@ -383,11 +383,7 @@ if $first_stage; then
 	if test -n "$headers"; then
 	    echo "	    echo '/* Extra headers for this module */'; \\"
 	    echo "	    for hdr in $headers; do \\"
-	    echo "		if test -f \$\$hdr; then \\"
-	    echo "		    echo '# include \"'\$\$hdr'\"'; \\"
-	    echo "		else \\"
-	    echo "		    echo '# include \"\$(sdir)/'\$\$hdr'\"'; \\"
-	    echo "		fi; \\"
+	    echo "		echo '# include \"'\$\$hdr'\"'; \\"
 	    echo "	    done; \\"
 	    echo "	    echo; \\"
 	fi
Index: Src/zsh.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/zsh.mdd,v
retrieving revision 1.24
diff -p -u -r1.24 zsh.mdd
--- Src/zsh.mdd	9 May 2011 10:38:02 -0000	1.24
+++ Src/zsh.mdd	10 May 2011 16:28:22 -0000
@@ -127,7 +127,7 @@ clean.zsh:
 
 # This is not properly part of this module, but it is built as if it were.
 main.o: main.c zsh.mdh main.epro
-	$(CC) -c -I. $(CPPFLAGS) $(DEFS) $(CFLAGS) -o $@ $(sdir)/main.c
+	$(CC) -c -I. -I$(sdir_top)/Src $(CPPFLAGS) $(DEFS) $(CFLAGS) -o $@ $(sdir)/main.c
 
 main.syms: $(PROTODEPS)
 proto.zsh: main.epro


-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK




Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



Messages sorted by: Reverse Date, Date, Thread, Author