forked from Thalhammer/jwt-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (54 loc) · 1.51 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
SRC = $(shell find . -name '*.cpp') $(shell find . -name '*.c')
HEADERS = $(shell find . -name '*.h')
EXCLUDE_SRC =
FSRC = $(filter-out $(EXCLUDE_SRC), $(SRC))
OBJ = $(FSRC:=.o)
DEP_DIR = .deps
FLAGS = -fPIC -Wall -Wno-unknown-pragmas -Werror -I include
CXXFLAGS = -std=c++11
CFLAGS =
LINKFLAGS = -lcrypto -lgtest -lpthread
ifeq ($(PREFIX),)
PREFIX := /usr
endif
OUTFILE = test
.PHONY: clean debug release check install
all: debug
debug: FLAGS += -g
debug: $(OUTFILE)
release: FLAGS += -O2 -march=native
release: $(OUTFILE)
$(OUTFILE): $(OBJ)
@echo Generating binary
@$(CXX) -o $@ $^ $(LINKFLAGS)
@echo Build done
%.cc.o: %.cc
@echo Building $<
@$(CXX) -c $(FLAGS) $(CXXFLAGS) $< -o $@
@mkdir -p `dirname $(DEP_DIR)/[email protected]`
@$(CXX) -c $(FLAGS) $(CXXFLAGS) -MT '$@' -MM $< > $(DEP_DIR)/[email protected]
%.cpp.o: %.cpp
@echo Building $<
@$(CXX) -c $(FLAGS) $(CXXFLAGS) $< -o $@
@mkdir -p `dirname $(DEP_DIR)/[email protected]`
@$(CXX) -c $(FLAGS) $(CXXFLAGS) -MT '$@' -MM $< > $(DEP_DIR)/[email protected]
%.c.o: %.c
@echo Building $<
@$(CC) -c $(FLAGS) $(CFLAGS) $< -o $@
@mkdir -p `dirname $(DEP_DIR)/[email protected]`
@$(CC) -c $(FLAGS) $(CFLAGS) -MT '$@' -MM $< > $(DEP_DIR)/[email protected]
clean:
@echo Removing binary
@rm -f $(OUTFILE)
@echo Removing objects
@rm -f $(OBJ)
@echo Removing dependency files
@rm -rf $(DEP_DIR)
check: $(OUTFILE)
./$(OUTFILE)
install:
@echo Installing headers
@install -d $(DESTDIR)$(PREFIX)/include/jwt-cpp/
@install -m 644 include/jwt-cpp/*.h $(DESTDIR)$(PREFIX)/include/jwt-cpp
@echo Install done
-include $(OBJ:%=$(DEP_DIR)/%.d)