Here is a reduced version of my Makefile:
.PHONY: all
all: src/server.coffee
mkdir -p bin
./node_modules/.bin/coffee -c -o bin src/server.coffee
I want to run make
and only have it recompile when src/server.coffee
has changed. However, it recompiles every time I run make
:
$ make
mkdir -p bin
./node_modules/.bin/coffee -c -o bin src/server.coffee
$ make
mkdir -p bin
./node_modules/.bin/coffee -c -o bin src/server.coffee
If I change my Makefile to not use a phony target, it works as expected. New Makefile:
bin/server.js: src/server.coffee
mkdir -p bin
./node_modules/.bin/coffee -c -o bin src/server.coffee
Result:
$ make
mkdir -p bin
./node_modules/.bin/coffee -c -o bin src/server.coffee
$ make
make: `bin/server.js' is up to date.
Why won't it respect my dependencies with a phony target? The reason I ask is because in reality, I won't just be compiling a single file into a single other file, so I don't want to have to keep track of the names of all the output files to use as targets.