Hi, I never expected to find a bug in gmake, but I think this is one. It appears that static assignments from global variables into target- specific ones result in corruption if the content of the variable is large enough. Please see the attached Makefile for the explanation of the problem, version info, and the results I get. You will also need a couple of dummy .c files to test it. I just used content like: int foo(void) { return 0; } Please let me know if you need any more information, or if you already have a fix for this problem. I really appreciate your product, and look forward to helping in any way I can. thanks, -Brian
# GNU Makefile illustrating target-specific variable corruption # Brian Poynor ([EMAIL PROTECTED]) define problem: This problem seems to be corruption when copying global variables into target-specific ones. In the example here, target libfoobar.a's target variable Objs is statically assigned to OBJS, the list of files which should be installed into it in by ar when the file is built. The assignment is incorrect, resulting in extra characters being stored into Objs. Note that this problem only seems to occur with variable contents over a certain length. The largest OBJS that could be copied correctly in my tests was 29 characters long. endef OBJS := thisisafilenamedfoo.o thisisafilenamedbar.o libfoobar.a : Objs := $(OBJS) libfoobar.a : $(OBJS) all: $(LIB) .DELETE_ON_ERROR: libfoobar.a : @echo "Objs = <$(Objs)>" # Target-specific variable @echo "OBJS = <$(OBJS)>" # Original variable $(AR) cqvs $@ $(Objs) clean : $(RM) $(LIB) $(OBJS) define sample-run: This is the make output for this Makefile: Note how the value of (libfoobar.a : Objs) is corrupted with 14 extra characters. brianp@brianp-pc1 (~/maketest) > gmake gcc -g -W -Wall -O -c thisisafilenamedfoo.c -o thisisafilenamedfoo.o gcc -g -W -Wall -O -c thisisafilenamedbar.c -o thisisafilenamedbar.o Objs = < thisisafilenamedfoo.o thisisafilenamedbar.ofilenamedbar.o> OBJS = <thisisafilenamedfoo.o thisisafilenamedbar.o> rm -f libfoobar.a ar cqvs libfoobar.a thisisafilenamedfoo.o thisisafilenamedbar.ofilenamedbar.o a - thisisafilenamedfoo.o /usr/libexec/elf/ar: thisisafilenamedbar.ofilenamedbar.o: No such file or directory gmake: *** [libfoobar.a] Error 1 gmake: *** Deleting file `libfoobar.a' brianp@brianp-pc1 (~/maketest) > gmake -v GNU Make version 3.77, by Richard Stallman and Roland McGrath. Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Report bugs to <[EMAIL PROTECTED]>. brianp@brianp-pc1 (~/maketest) > uname -a FreeBSD brianp-pc1.mtv.siara.com 3.2-RELEASE FreeBSD 3.2-RELEASE #0: Sun Oct 17 19:25:39 GMT 1999 [EMAIL PROTECTED]:/usr/src/sys/compile/PAO_LIMING i386 Sorry, but I don't currently have the source installed on my system to give you the config.h file. This is straight from the FreeBSD 3.2 distribution, however. Please let me know if I can provide additional information or be of help in any way. Thanks, -Brian [EMAIL PROTECTED] endef