-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile.linux
89 lines (62 loc) · 1.61 KB
/
Makefile.linux
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
# Compilers and linkers
OBJCC = gcc
CC = gcc
CXX = g++
LD = $(CXX)
AR = ar
# Options for compilation
GNUSTEP_OPTS = -DGNUSTEP \
-DGNU_RUNTIME=1 \
-D_NATIVE_OBJC_EXCEPTIONS \
-fgnu-runtime \
-fexceptions \
-fobjc-exceptions \
-fconstant-string-class=NSConstantString
GCC_OPTS = -O2 \
-Wno-import \
-Wno-multichar \
-g \
-D_FILE_OFFSET_BITS=64 \
-isystem /usr/include/GNUstep
OBJC_OPTS = -std=gnu99
C_OPTS = -std=gnu99
CXX_OPTS =
AUTODEPENDENCY_CFLAGS=-MMD -MF$(@:.o=.d) -MT$@
ALL_OBJCFLAGS = $(OBJC_OPTS) $(GCC_OPTS) $(GNUSTEP_OPTS) $(OBJCFLAGS)
ALL_CFLAGS = $(C_OPTS) $(GCC_OPTS) $(CFLAGS)
ALL_CXXFLAGS = $(CXX_OPTS) $(GCC_OPTS) $(CXXFLAGS)
# Options for linking
LIBS = -Wl,--no-whole-archive \
-lgnustep-base \
-lobjc \
-lm
ALL_LDFLAGS = -Wl,--whole-archive \
-fexceptions \
-fgnu-runtime \
$(LDFLAGS)
# Paths
SOURCE_DIR = .
BUILD_DIR = Build
# Files
include Makefile.common
# Compilation rules
all: $(EXECUTABLE_FILES) $(LIBRARY_FILES)
DetectorTest: $(DETECTORTEST_OBJS) libUniversalDetector.a
$(LD) $(ALL_LDFLAGS) -o $@ $^ $(LIBS)
libUniversalDetector.a: $(LIBRARY_OBJS)
rm -f $@
$(AR) rcs $@ $^
clean:
rm -rf $(BUILD_DIR) $(EXECUTABLE_FILES) $(LIBRARY_FILES)
# Suffix rules
.SUFFIXES: .o .c .m .cpp
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.c
@mkdir -p $(dir $@)
$(CC) $(ALL_CFLAGS) $(AUTODEPENDENCY_CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.m
@mkdir -p $(dir $@)
$(OBJCC) $(ALL_OBJCFLAGS) $(AUTODEPENDENCY_CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.cpp
@mkdir -p $(dir $@)
$(CXX) $(ALL_CXXFLAGS) $(AUTODEPENDENCY_CFLAGS) -c $< -o $@
-include $(OBJS:.o=.d)