-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
56 lines (33 loc) · 1.01 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
CC = gcc
C_FLAGS = -std=c99 -pedantic -Wall -Wextra -fstrict-aliasing -Wshadow \
-Wwrite-strings -Wpointer-arith -Wcast-align -Wnested-externs \
-Wmissing-prototypes -Wstrict-prototypes -Winline -Wcast-qual \
-Wmissing-declarations -Wredundant-decls
DEBUG_FLAGS = -O0 -g
RELEASE_FLAGS = -O3
PREPROCESSOR =
SOURCES = xml.c test/test.c
TARGET = run
INCLUDE_DIRS = .
###################
###################
OBJS = $(SOURCES:.c=.o)
INCLUDE = $(addprefix -I ,$(INCLUDE_DIRS))#
PREP = $(addprefix -D ,$(PREPROCESSOR))#
##################
##################
debug: override C_FLAGS += $(DEBUG_FLAGS)
debug: compile
release: override C_FLAGS += $(RELEASE_FLAGS)
release: compile
compile: preclean $(OBJS) target postclean
$(OBJS):
$(CC) $(C_FLAGS) $(PREP) $(INCLUDE) -c $(@:.o=.c)
target:
$(CC) $(C_FLAGS) $(PREP) $(INCLUDE) *.o -o $(TARGET)
preclean:
$(shell rm -f *.o)
postclean:
$(shell rm -f *.o)
clean:
rm -f *.o $(TARGET)