-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
72 lines (46 loc) · 1.41 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
CFLAGS = -Wall -std=c++17 -Wno-sign-compare -Wno-unused-variable -Wno-shift-count-overflow -Wno-tautological-constant-out-of-range-compare -Wno-mismatched-tags -ftemplate-depth=512 -Wmissing-field-initializers -g -I/home/michal/json/include
CC = clang++
LD = clang++
CFLAGS += -Werror -g
OBJDIR = obj
ifdef OPT
CFLAGS += -O3
OBJDIR = obj-opt
endif
NAME = zenon
ROOT = ./
TOROOT = ./../
IPATH = -I.
CFLAGS += $(IPATH)
LDFLAGS += -L/usr/local/lib
SRCS = $(shell ls -t src/*.cpp)
INSTALL_DIR = $(shell pwd)
CFLAGS += "-DINSTALL_DIR=\"$(INSTALL_DIR)\""
LIBS = -L/usr/lib/x86_64-linux-gnu -lstdc++fs -lboost_regex ${LDFLAGS}
OBJS = $(addprefix $(OBJDIR)/,$(SRCS:.cpp=.o))
DEPS = $(addprefix $(OBJDIR)/,$(SRCS:.cpp=.d))
DEPS += $(OBJDIR)/stdafx.h.d
##############################################################################
all:
@$(MAKE) --no-print-directory info
@$(MAKE) --no-print-directory compile
compile: $(NAME)
$(OBJDIR)/stdafx.h.gch: src/stdafx.h
$(CC) -x c++-header $< -MMD $(CFLAGS) -o $@
PCH = $(OBJDIR)/stdafx.h.gch
PCHINC = -include-pch $(OBJDIR)/stdafx.h.gch
$(OBJDIR)/%.o: %.cpp ${PCH}
$(CC) -MMD $(CFLAGS) $(PCHINC) -c $< -o $@
$(NAME): $(OBJS)
$(LD) $(CFLAGS) -o $@ $^ $(LIBS)
info:
@$(CC) -v 2>&1 | head -n 2
clean:
$(RM) $(OBJDIR)/src/*.o
$(RM) $(OBJDIR)/src/*.d
$(RM) $(OBJDIR)/test
$(RM) $(OBJDIR)-opt/*.o
$(RM) $(OBJDIR)-opt/*.d
$(RM) $(NAME)
$(RM) $(OBJDIR)/stdafx.h.*
-include $(DEPS)