記錄在這,不要以後需要的時候在網路上到處找... :)
1 # Copyright (C) 2009 Lung.S.Wu
2
3 #ARCH=
4 #TARGET=$(ARCH)-elf-
5
6 HEADER=head.h
7 SRC=file1.c file2.c
8 OBJ=$(SRC:%.c=%.o)
9 EXE=demo
10
11 CC=$(TARGET)gcc
12 LD=$(TARGET)ld
13
14 CFLAGS=-O3 -g -Wall
15
16 #.SILENT:
17
18 all:$(EXE)
19
20 $(EXE): $(OBJ)
21 $(CC) $(CFLAGS) $^ -o $@
22
23 %.o: %.c $(HEADER)
24 $(CC) -c $(CFLAGS) $< -o $@
25
26 clean:
27 rm -rf $(OBJ) $(EXE)
No comments:
Post a Comment