Sunday, August 21, 2011

GNU (and others) make in web-development

make can be very useful both in combining static files together and squeezing them. I've found detailed and complete manual on this: Website builds using Make. While Makefile syntax may seems confusing and arcane at first glance, basically it is just shell script with some addition to manage dependencies.

Since Makefile basically is shell script, you can use watever commandline-fu you learned. There is one thing to consider though: for loops.
for i in $(my-src-files) do; echo $$i >> $(my-dest-file); done

It takes me couple of hours to realize that one must use $$i when referencing loop variable instead of just $i like in plain shell scripts.