[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problem with updating a static library using make/makefiles
From: |
Noel Yap |
Subject: |
Re: problem with updating a static library using make/makefiles |
Date: |
Fri, 05 Dec 2003 10:03:02 -0500 |
I only browsed through your email so please excuse me if I'm way off. I think
the problem and solution you're encountering is described in
http://aegis.sourceforge.net/auug97.pdf.
HTH,
Noel
Thomas Lavergne wrote:
>
> Hi all;
> I am not an expert with GNU make and makefiles. However, after oneday of
> documenting and testing, I still cannot see what is wrong with my case.
> I want to build a static library libfray.a (using GNU ar 2.13.90) which
> is just an archive of .o files. These 80 .o files are located in
> various subdirectories. So, at libfray.a_level I have a Makefile which
> basically list my subdirectories, cd to each of them and execute MAKE:
>
> Makefile at libfray.a level :
> --------------------------
> MAKE = make -$(MAKEFLAGS)
> STUFF = libsource libintera libfilter libcommon libmeasure libobj libdistr
> SHELL = /bin/sh
>
> default:
> for i in $(STUFF); do \
> (cd $$i && $(MAKE)); \
> (/usr/bin/ranlib libfray.a);\
> done
> ------------------------------------
>
> Then, on each subdirectory (stuff) I have a similar make file:
> --------------------------------
> LIB = ../libfray.a
> INCLUDE = -I.. -I../..
> CFLAGS = $(CCFLAGS) $(INCLUDE) $(OPTIMIZE)
> ARFLAGS=qv
>
> SHELL = /bin/sh
>
> CFILES = filter.c hit.c howend.c interange.c range.c
> OFILES = $(CFILES:.c=.o)
>
> $(LIB): $(OFILES)
> ar $(ARFLAGS) $(LIB) $(OFILES)
> --------------------------------------------
>
> The rule $(LIB) seems to be the default rule for make (there is a make
> depend annd make clean but they are at the bottom of the Makefile)
>
> NOW, when I execute the make command (GNU make 3.79.1 built for Linux
> Red Hat 9) from libfray.a level, all my subdirectories are effectively
> browsed and I can see all the 80 .o files created. BUT for a reason I
> ignore, the ar command is not always called to update the ../libfray
> target. The situation is not at all stable : if I 'make clean' to erase
> all .o and the libfray.a (i checked it is done) and I rebuild my library
> ('make' at libfray.a level), it will be another subdirectory which will
> not be included.. If I modify the order of STUFF to browse my
> subdirectories, another subdirectory will not be included.
>
> I tried a 'make -d' from the libfray.a level. The implicit rules for
> compiling .c into .o are working fine but I will list what happens for
> the not-included-in-the-static-library directory:
>
> Finished prerequisites of target file `../libfray.a'.
> Prerequisite `filter.o' is newer than target `../libfray.a'.
> Prerequisite `hit.o' is newer than target `../libfray.a'.
> Prerequisite `howend.o' is newer than target `../libfray.a'.
> Prerequisite `interange.o' is newer than target `../libfray.a'.
> Prerequisite `range.o' is newer than target `../libfray.a'.
> No need to remake target `../libfray.a'.
>
> How is it possible that prerequisites newer than target do not imply the
> remake of the target??
> If it is possible, then please indicate me what are the possible
> situations so that I can check everything.
>
> Thanks for any help,
> thomas
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-make
--
NOTICE: If received in error, please destroy and notify sender. Sender does
not waive confidentiality or privilege, and use is prohibited.
Re: problem with updating a static library using make/makefiles, Kate Ebneter, 2003/12/08