-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmakefile
70 lines (49 loc) · 1.46 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
#~/user/bin/make -f
EXECUTABLE = bin/linux/fid
EXECUTABLE_UNIT = bin/linux/unit_tests
CC = gcc
CXX = g++
CFLAGS = -fPIC -Wno-enum-conversion -O3
CXXFLAGS_1 = -fPIC -std=c++14 -O3 -Wfatal-errors -Werror
CXXFLAGS_2 = -fPIC -std=c++17 -O3 -Wfatal-errors -Werror
LDFLAGS = -pthread
SRC_ZLIB = $(wildcard ziplib/Source/ZipLib/extlibs/zlib/*.c)
SRC_LZMA = $(wildcard ziplib/Source/ZipLib/extlibs/lzma/unix/*.c)
SRC_BZIP2 = $(wildcard ziplib/Source/ZipLib/extlibs/bzip2/*.c)
SRC_ZIPLIB = \
$(wildcard ziplib/Source/ZipLib/*.cpp) \
$(wildcard ziplib/Source/ZipLib/detail/*.cpp)
SRC_FILEID = \
fileid/fileid.cpp
SRC_UNIT = \
test/main.cpp
# Object files
OBJS_1 = \
$(SRC_ZIPLIB:.cpp=.o) \
$(SRC_ZLIB:.c=.o) \
$(SRC_LZMA:.c=.o) \
$(SRC_BZIP2:.c=.o)
OBJS_2 = \
$(SRC_FILEID:.cpp=.o) \
OBJS_UNIT = \
$(SRC_UNIT:.cpp=.o) \
# Rules
all: $(EXECUTABLE) $(EXECUTABLE_UNIT)
$(EXECUTABLE): $(OBJS_1)
$(CXX) $(CXXFLAGS_1) $(LDFLAGS) $(CPP_FILES) -o $@ $^
$(EXECUTABLE): $(OBJS_2)
$(CXX) $(CXXFLAGS_2) $(LDFLAGS) $(CPP_FILES) $^ -lstdc++fs -o $@
$(EXECUTABLE_UNIT): $(OBJS_UNIT)
$(CXX) $(CXXFLAGS_2) $(LDFLAGS) $(CPP_FILES) $^ -lstdc++fs -o $@
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
test/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
.PHONY: clean
clean:
rm -rf $(EXECUTABLE) $(EXECUTABLE_UNIT) $(SO_LIBRARY) $(OBJS_1) $(OBJS_2) $(OBJS_UNIT)
BINDIR ?= ${PREFIX}/bin
install:
@cp -p bin/fid ${PREFIX}/bin/fileid