Click to See Complete Forum and Search --> : make - skipping over targets that do not have to be redone
Hey,
I'm just learning to use make right now.
take the following Makefile
default: in
xxd in > out
clean:
rm out
If I run 'make' the file 'out' is create. Now if I run 'make' again, without modifying 'in' the command is re-executed. I want to tell make not to run the target if 'out' is newer than 'in'. Does anyone know how I can do this?
hotcold
05-16-2007, 12:30 PM
Hi.
As usual, many ways. This is adapted from your Makefile:
% cat Makefile
# Wed May 16 11:17:44 CDT 2007
default: out
out: in
cat in >out
clean:
rm -f out
The result of running a little script shows:
+ touch in
+ make
cat in >out
+ make
make: Nothing to be done for `default'.
+ sleep 1
+ touch in
+ make
cat in >out
Much more in the GNU manual, http://www.gnu.org/software/make/manual/make.html ... cheers, hotcold
Although I have everything working properly, I have one little bug.
One line in the file, "cp -R $(OUT)/* ~/public/", is being executed properly, but whenever it is executed it is throwing an error:
Usage: cp [-ip] f1 f2; or: cp [-irp] f1 ... fn d2
*** Error code 1
make: Fatal error: Command failed for target `promote'
I have checked to make sure that the 'cp' program that '/bin/sh' uses supports the -R flag.
Do you know what could be causing this problem?
Although I have everything working properly, I have one little bug.
One line in the file, "cp -R $(OUT)/* ~/public/", is being executed properly, but whenever it is executed it is throwing an error:
I have checked to make sure that the 'cp' program that '/bin/sh' uses supports the -R flag.
Do you know what could be causing this problem?
I spoke too quickly, sh doesn't like the "~" character, I can use 'cp -r a.out ${HOME}/public/'