help-make
[Top][All Lists]
Advanced

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

intermediate files rebuilt unexpectedly


From: NvB
Subject: intermediate files rebuilt unexpectedly
Date: Wed, 16 Apr 2003 22:39:04 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830


This is my makefile:

address@hidden prob1]# cat makefile
CC = gcc

HDR_DIRS = incl
SRC_DIRS = src

vpath %.h $(HDR_DIRS)
vpath %.c $(SRC_DIRS)

override CFLAGS += $(patsubst %,-I%,$(subst :, ,$(HDR_DIRS)))

all: libmysf.a

libmysf.a: sf1.o sf2.o sf3.o
       ar rf libmysf.a sf1.o sf2.o sf3.o

.INTERMEDIATE: sf1.o sf2.o sf3.o

sf1.o: sf1.c

sf2.o: sf2.c

sf3.o: sf3.c

It seems to work OK.

address@hidden prob1]# make
gcc -Iincl   -c -o sf1.o src/sf1.c
gcc -Iincl   -c -o sf2.o src/sf2.c
gcc -Iincl   -c -o sf3.o src/sf3.c
ar rf libmysf.a sf1.o sf2.o sf3.o
rm sf1.o sf3.o sf2.o
address@hidden prob1]#
address@hidden prob1]# make
make: Nothing to be done for `all'.
address@hidden prob1]#

But when I touch sf3.c everything gets rebuilt.

address@hidden prob1]# touch src/sf3.c
address@hidden prob1]# make
gcc -Iincl   -c -o sf1.o src/sf1.c
gcc -Iincl   -c -o sf2.o src/sf2.c
gcc -Iincl   -c -o sf3.o src/sf3.c
ar rf libmysf.a sf1.o sf2.o sf3.o
address@hidden prob1]# make -v
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for i386-redhat-linux-gnu
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
       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 <address@hidden>.


as you can see I'm using GNU make v3.79.1.

I would expect only the (intermediate) sf3.o to be rebuilt.
Why do all the (intermediate) object files get rebuilt ?

Thanks,
NvB.






reply via email to

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