-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
85 lines (65 loc) · 1.87 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
MODULES = \
Main \
Base \
Pathname \
Github \
Http \
Setting \
Detector \
Message \
Json
C_MODULES = \
libjansson/janssonext \
liburiparser/uriparserext
TARGET = space_tab_bot
TEST_MODULES = \
Main \
BaseTest \
UriTest \
PathnameTest \
SettingTest \
DetectorTest \
JanssonTest \
JsonTest
TEST_TARGET = testRunner
LIB_MODULES = \
smlsharp-lib/GetOpt \
libcurl/Curl \
liburiparser/Uri \
libjansson/Jansson
SMLSHARP = smlsharp
SMLSHARP_CFLAGS = -O2
SMLSHARP_LDFLAGS = -lcurl -ljansson -luriparser
CFLAGS += -m32
# ------------------------------------------------------------
sources := $(addprefix src/,$(MODULES:=.sml))
objects := $(sources:.sml=.o)
c_sources = $(addprefix lib/,$(C_MODULES:=.c))
c_objects := $(c_sources:.c=.o)
test_sources := $(addprefix test/, $(TEST_MODULES:=.sml))
test_objects := $(test_sources:.sml=.o)
lib_sources := $(addprefix lib/,$(LIB_MODULES:=.sml))
lib_objects := $(lib_sources:.sml=.o)
# ------------------------------------------------------------
$(TARGET): $(objects) $(c_objects) $(lib_objects)
$(SMLSHARP) $(SMLSHARP_LDFLAGS) -o $@ src/Main.smi $(c_objects)
$(TEST_TARGET): $(objects) $(c_objects) $(lib_objects) $(test_objects)
$(SMLSHARP) $(SMLSHARP_LDFLAGS) -o $@ test/Main.smi $(c_objects)
# ------------------------------------------------------------
# Build rules
# ------------------------------------------------------------
%.o: %.sml
$(SMLSHARP) $(SMLSHARP_CFLAGS) -c -o $@ $<
.c.o:
$(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) -c -o $@ $<
# ------------------------------------------------------------
# Phony target
# ------------------------------------------------------------
.PHONY: clean depend check
check: $(TEST_TARGET)
./$(TEST_TARGET)
clean:
rm -rf $(TARGET) $(TEST_TARGET) src/*.o test/*.o lib/*/*.o test_file.tmp
depend:
$(SMLSHARP) -MM $(sources) $(test_sources) $(lib_sources) > .depend
-include .depend