bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Make 3.81: erratic behavior with archive members


From: Stephen Macmanus
Subject: Make 3.81: erratic behavior with archive members
Date: Wed, 21 Nov 2007 17:48:25 -0800
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

Hello,


I am using make 3.81 and encountering some unexplained behavior
when adding object files to an archive using pattern rules.


The Makefile includes the following:


---------------------


LIBEXT = lib
LIBDIR = $(BUILD)/libs
LIB = $(LIBDIR)/$(LIBRARY).$(LIBEXT)
OBJDIR = $(BUILD)/$(LIBRARY)


# Redefine the implicit rule for archive members to save
# the intermediate file elsewhere.


(%): %
        $(AR) $(ARFLAGS) $@ $<
        $(MV) $< $(subst /,$(SLASH),$(OBJDIR))


$(LIB): $(LIB)($(OBJS)) ;
OUT = $(OUTDIR)/$(LIBRARY).out
default :: $(OUT)
$(OUT) : $(LIB) $(OUTDIR)
        $(LD) -o $@ -r -whole-archive $(LIB)


-------------------------------


The build process successfully uses the implicit rules
to compile the "(member.o)" file from the "member.c"
file in the same directory and add it to the "$(LIB)"
library file with the modified pattern rule. However,
it does not consistently detect that the $(LIB) target
must also be remade. As a result, the $(OUT) target is
not always updated as required and the build fails at a
later stage.

I saw three separate types of debug output at different points
during a build. Pathnames replaced with original variables to
protect the guilty.


    1) The update proceeds as expected after adding new
       object files.


---------------------------
     Finished prerequisites of target file `ahttpd.lib'.
     Prerequisite `$(LIBDIR)/ahttpd.lib(i_ftp.o)' is newer than target
`$(LIBDIR)/ahttpd.lib'.
     Prerequisite `$(LIBDIR)/ahttpd.lib(i_smm.o)' is newer than target
`$(LIBDIR)/ahttpd.lib'.


             <and so on....>


    Must remake target `$(LIBDIR)/ahttpd.lib'.
    Successfully remade target file `$(LIBDIR)/ahttpd.lib'.
    Considering target file `$(OUTDIR)'.
     Finished prerequisites of target file `$(OUTDIR)'.
    No need to remake target `$(OUTDIR)'.
   Finished prerequisites of target file `$(OUTDIR)/ahttpd.out'.
   Prerequisite `$(LIBDIR)/ahttpd.lib' is newer than target
`$(OUTDIR)/ahttpd.out'.
   Prerequisite `$(OUTDIR)' is older than target `$(OUTDIR)/ahttpd.out'.
  Must remake target `$(OUTDIR)/ahttpd.out'.
i686-linux-ld -o $(OUTDIR)/ahttpd.out -r -whole-archive $(LIBDIR)/ahttpd.lib
Putting child 0x080a5920 ($(OUTDIR)/ahttpd.out) PID 1967 on the chain.
Live child 0x080a5920 ($(OUTDIR)/ahttpd.out) PID 1967
Reaping winning child 0x080a5920 PID 1967
Removing child 0x080a5920 PID 1967 from chain.
  Successfully remade target file `$(OUTDIR)/ahttpd.out'.
-----------------------


    2) The update proceeds as expected even though make
       (apparently) does not detect the newer prerequisites.


--------------------------
      Successfully remade target file `$LIBDIR/amfpif.lib(member.o)'.
     Finished prerequisites of target file `$(LIBDIR)/amfpif.lib'.
    Must remake target `$(LIBDIR)/amfpif.lib'.
    Successfully remade target file `$(LIBDIR)/amfpif.lib'.
    Considering target file `$(OUTDIR)'.
     Finished prerequisites of target file `$(OUTDIR)'.
    No need to remake target `$(OUTDIR)'.
   Finished prerequisites of target file `$(OUTDIR)/amfpif.out'.
  Must remake target `$(OUTDIR)/amfpif.out'.
i686-linux-ld -o $(OUTDIR)/amfpif.out -r -whole-archive $(LIBDIR)/amfpif.lib
Putting child 0x080855b8 ($(OUTDIR)/amfpif.out) PID 1981 on the chain.
Live child 0x080855b8 ($(OUTDIR)/amfpif.out) PID 1981
Reaping winning child 0x080855b8 PID 1981
Removing child 0x080855b8 PID 1981 from chain.
  Successfully remade target file `$(OUTDIR)/amfpif.out'.
-------------------------


    3) And finally, the build process does not update the library file
       as expected, even though it added an object file to the library
       and reported a newer prerequisites, so it also fails to update
       the %.out file.


--------------------------
      Successfully remade target file `$(LIBDIR)/crypto.a(shs.o)'.
     Finished prerequisites of target file `$(LIBDIR)/crypto.a'.
     Prerequisite `$(LIBDIR)/crypto.a(shs.o)' is newer than target
`$(LIBDIR)/crypto.a'.
    No need to remake target `$(LIBDIR)/crypto.a'.
    Considering target file `$(OUTDIR)'.
     Finished prerequisites of target file `$(OUTDIR)'.
    No need to remake target `$(OUTDIR)'.
   Finished prerequisites of target file `$(OUTDIR)/crypto.out'.
   Prerequisite `$(LIBDIR)/crypto.a' is older than target
`$(OUTDIR)/crypto.out'.
   Prerequisite `$(OUTDIR)' is older than target `$(OUTDIR)/crypto.out'.
  No need to remake target `$(OUTDIR)/crypto.out'.
-----------------------------

Is this a known issue? Any suggestions for a workaround?
I am somewhat limited in the changes I can make to the build
process, but I might be able to use different rules.


Thanks,


Stephen Macmanus
address@hidden




reply via email to

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