Darren
06-12-2009, 01:00 AM
I'm on a Sun box. I have a makefile that isn't doing what I want. I have the following targets and they should be pretty self-explanatory (I'll add some echo statement for use in a sample below):
build: all clean
@echo building
rebuild: wipe build
@echo rebuilding
all: prog1 prog2 prog3
@echo compiling prog1 prog2 prog3
clean:
@echo cleaning
rm *.o
wipe: clean
@echo wiping
rm prog1 prog2 prog3
All the targets work as expected except the rebuild target. My intent was that it would clean out all the prior executables and temporary files, recompile the executables, and then (again) remove the temporary files. The output from above ought to be:
make -f my.mk rebuild
cleaning
wiping
compiling prog1 prog2 prog3
cleaning
building
rebuilding
However, the clean target is only being evaluated once. It cleans at the beginning of the make, but then fails to clean at the end. Is there a way to force make to execute the commands in a target every time it is a dependent of another target rather than just once?
Thanks in advance,
Darren
build: all clean
@echo building
rebuild: wipe build
@echo rebuilding
all: prog1 prog2 prog3
@echo compiling prog1 prog2 prog3
clean:
@echo cleaning
rm *.o
wipe: clean
@echo wiping
rm prog1 prog2 prog3
All the targets work as expected except the rebuild target. My intent was that it would clean out all the prior executables and temporary files, recompile the executables, and then (again) remove the temporary files. The output from above ought to be:
make -f my.mk rebuild
cleaning
wiping
compiling prog1 prog2 prog3
cleaning
building
rebuilding
However, the clean target is only being evaluated once. It cleans at the beginning of the make, but then fails to clean at the end. Is there a way to force make to execute the commands in a target every time it is a dependent of another target rather than just once?
Thanks in advance,
Darren