$ CFLAGS="-g -O0" make simple
cc -g -O0 simple.c -o simple
$
This is so handy. I never knew that you could call make without writing a default Makefile. Thanks! $ CFLAGS="-g -O0" make simple
cc -g -O0 simple.c -o simple
$
This is so handy. I never knew that you could call make without writing a default Makefile. Thanks! make CFLAGS="-g -O0" simple
(This also works with many other build tools like CMake or configure scripts generated by autoconf.)If you're curious which rules exist by default, try running:
make -p
(This produces a lot of output; a bit much to study in detail, but still useful to scan just to get an idea of what default rules exist.)Of course this only applies to GNU make.
echo 'void main() { printf("omg\n"); }' > simple.c
echo 'CFLAGS=-g' > Makefile
make simple
./simple
(yes I know that is not valid C but it serves this example and compiles fine :-)redo makes everything much simpler, more consistent, more dependable, and more robust. e.g all files are atomically replaced; dependencies are checked by a crypto hash of the content; dependency setup is sane; and it's all faster than make.
Thanks for the info, I'll look into redo. I just watched a recent talk about Shake (make-like in Haskell) interesting results like 10x smaller ~makefiles and 2x speed improvement.
A redo specification is generally much shorter[1] than the equivalent Makefile, yet simpler to write, can be guaranteed (unlike make / make depend) to rebuild whenever necessary and only when necessary. And while a supersmart dependency tracking incremental build version is not trivial, it's probably an order of magnitude or two shorter than make; And a 150 line bash script is enough to interpret the same specification without regard to dependencies or prior builds (that is: rebuild everything on every attempt).