make
-n 打印要执行的命令, 但不执行
-C dir 执行 dir 目录中的 Makefile
#---- makefile template --------
all: main
main: main.o stack.o maze.o
gcc
main.o: main.h stack.h maze.h stack.o: stack.h main.h maze.o: maze.h main.h
.PHONY: clean
clean: -rm main *.o @echo done
libsome.a: foo.o bar.o lose.o win.o ar rs libsome.a $?
CC = gcc IDIR = . CFLAGS = -I$(IDIR) DEPS = test.h OBJ = main.o test.o
test:
%.o: %.c
CC = gcc IDIR = include ODIR = obj LDIR = lib
CFLAGS = -I$(IDIR) LIBS =
_DEPS = test.h
DEPS =
test:
.PHONY: clean
clean: rm $(ODIR)/*.o test