-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
110 lines (93 loc) · 1.94 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# acsde Makefile.
EXE=acsde
BUILD_DIR=build
CC=gcc
INCLUDE=-Isrc
OPTIONS=-g -Wall -Werror -Wno-unused -std=c99 -pedantic -Wstrict-aliasing \
-Wstrict-aliasing=2 -Wmissing-field-initializers -Wconversion -Wextra \
-D_BSD_SOURCE -D_DEFAULT_SOURCE $(INCLUDE)
.PHONY: all pre-build dev dev-pre-build clean
all: pre-build $(EXE)
# strip $(EXE)
pre-build:
# Make build directory.
@if ! [ -d $(BUILD_DIR) ]; then \
mkdir $(BUILD_DIR); \
fi
dev: dev-pre-build $(EXE)
OBJECTS=\
$(BUILD_DIR)/main.o \
$(BUILD_DIR)/common.o \
$(BUILD_DIR)/pcode.o \
$(BUILD_DIR)/load.o \
$(BUILD_DIR)/discover.o \
$(BUILD_DIR)/recover.o \
$(BUILD_DIR)/codegen.o \
$(BUILD_DIR)/builtin.o \
$(BUILD_DIR)/analyze.o
# Compile executable.
$(EXE): $(OBJECTS)
$(CC) -o $@ $^
# Compile: src/
$(BUILD_DIR)/main.o: \
src/main.c \
src/task.h \
src/common.h
$(CC) -c $(OPTIONS) -o $@ $<
$(BUILD_DIR)/common.o: \
src/common.c \
src/common.h
$(CC) -c $(OPTIONS) -o $@ $<
$(BUILD_DIR)/pcode.o: \
src/pcode.c \
src/common.h \
src/pcode.h
$(CC) -c $(OPTIONS) -o $@ $<
$(BUILD_DIR)/load.o: \
src/load.c \
src/task.h \
src/common.h \
src/pcode.h
$(CC) -c $(OPTIONS) -o $@ $<
$(BUILD_DIR)/discover.o: \
src/discover.c \
src/task.h \
src/common.h \
src/pcode.h
$(CC) -c $(OPTIONS) -o $@ $<
$(BUILD_DIR)/recover.o: \
src/recover.c \
src/task.h \
src/common.h \
src/pcode.h
$(CC) -c $(OPTIONS) -o $@ $<
$(BUILD_DIR)/codegen.o: \
src/codegen.c \
src/task.h \
src/common.h
$(CC) -c $(OPTIONS) -o $@ $<
$(BUILD_DIR)/builtin.o: \
src/builtin.c \
src/task.h \
src/common.h \
src/pcode.h
$(CC) -c $(OPTIONS) -o $@ $<
$(BUILD_DIR)/analyze.o: \
src/analyze.c \
src/task.h \
src/common.h
$(CC) -c $(OPTIONS) -o $@ $<
# Removes executable and build directory.
clean:
@if [ -d $(BUILD_DIR) ]; then \
for object in $(OBJECTS); do \
if [ -f $$object ]; then \
rm $$object; \
fi; \
done; \
rmdir \
$(BUILD_DIR);
fi
@if [ -f $(EXE) ]; then \
rm $(EXE); \
fi