-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (46 loc) · 1.24 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
CXX = clang++ #-\#\#\#
CXXFLAG = -std=c++20
PCHFLAG = -x c++-header
RM = rm
CompileFlags = compile_flags.txt
LIBEXT = .dll
EXEEXT = .exe
INCLUDEDIR = include
SRCDIR = src
HEADERPPS = $(wildcard $(INCLUDEDIR)/*.hpp)
HEADERS = $(wildcard $(INCLUDEDIR)/*.h)
PCHS = $(patsubst $(INCLUDEDIR)/%.hpp,$(INCLUDEDIR)/%.pch,$(HEADERPPS)) \
$(patsubst $(INCLUDEDIR)/%.h,$(INCLUDEDIR)/%.pch,$(HEADERS))
SRCPPS = $(wildcard $(SRCDIR)/*.cpp)
SRCS = $(wildcard $(SRCDIR)/*.c)
OBJS = $(patsubst $(SRCDIR)/%.cpp,$(SRCDIR)/%.o,$(SRCPPS)) \
$(patsubst $(SRCDIR)/%.c,$(SRCDIR)/%.o,$(SRCS))
FLAG = $(CXXFLAG) -I$(INCLUDEDIR)
LINK =
LIB = libDendroGC.dll
EXELINK = -L . -lDendroGC
EXE = main.exe
%.pch: %.h
$(CXX) $(PCHFLAG) $(FLAG) $< -o $@ -Winvalid-pch
%.pch: %.hpp
$(CXX) $(PCHFLAG) $(FLAG) $< -o $@ -Winvalid-pch
%.o: %.c
$(CXX) $(FLAG) -c $< -o $@
%.o: %.cpp
$(CXX) $(FLAG) -c $< -o $@
libDendroGC: $(PCHS) $(OBJS)
$(CXX) $(FLAG) -shared $(OBJS) -o $(LIB) $(LINK)
main: main.cpp
$(MAKE) libDendroGC
$(CXX) $(FLAG) main.cpp $(OBJS) -o $(EXE) $(EXELINK)
clangd:
echo $(CXXFLAG) > $(CompileFlags)
echo -I$(INCLUDEDIR) >> $(CompileFlags)
clean:
- $(RM) $(OBJS)
- $(RM) $(PCHS)
- $(RM) main.o
clear:
- $(MAKE) clean
- $(RM) $(LIB)
- $(RM) $(EXE)