Makefile文件的实例应用 test.c #include "stdio.h" #include "test.h" int main() { printf("this is a test. /n"); PAUSE(1000); printf("this is second test. /n"); KASSERT(1==1); printf("this is 3 test. /n"); } test.h #define PAUSE(count) / do { / unsigned long i; / for (i = 0; i < (count); ++i) / ; / } while (0) #define KASSERT(cond) / do { / if (!(cond)) { / printf("test /n"); / while (1) / ; / } / } while (0) Makefile #targets : prerequisites # command # ... # object : test.c test.h gcc -o object test.c clean : rm -f object