I have my .coffee files separate and I already use a Makefile to compile them into multiple corresponding .js files. My rule:
tmp/coffee/%.js: src/js/%.coffee
coffee --compile --output $(@D) $?
It looks like this:
$ make static
coffee --compile --output tmp/coffee/global src/js/global/admin.coffee
coffee --compile --output tmp/coffee/global src/js/global/ads.coffee
I would like to optimize my build process so that the coffee compiler is called once to compile all updated files in one go. This is particularly important for a clean build.
So it would look like this instead:
$ make static
coffee --compile --output tmp/coffee/global src/js/global/ads.coffee src/js/global/admin.coffee
You are already using
$?, all you really need is to make the target depend on all the files. Maybe you want to keep a separate flag file, say.built:You will probably want to refactor your existing Makefile so you don’t have any code duplication.
I’m assuming all your files are in
globallike your examples say, but not your existing code. If there are multiple subdirectories, you can’t compile them all in one go (the--outputparameter should presumably be different for each).