Neat little trick to have a file that is both a valid Makefile and valid C source, and compiles and runs itself.
make| #if 0 | |
| .PHONY: run | |
| run: a.out | |
| @./a.out | |
| a.out: $(MAKEFILE_LIST) | |
| @gcc -xc $(MAKEFILE_LIST) | |
| ifeq (0, 1) | |
| #endif | |
| #include <stdio.h> | |
| int main() | |
| { | |
| puts("Hello, world"); | |
| return 0; | |
| } | |
| #define endif | |
| endif |