-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (39 loc) · 1.02 KB
/
Copy pathMakefile
File metadata and controls
64 lines (39 loc) · 1.02 KB
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
# This Makefile is written for MSYS2/MINGW64 or Linux.
# If you are using other OS, you may need to modify the Makefile.
CXX = g++
CXXFLAGS = -std=c++17
CXXFLAGS += -g
CXXFLAGS += -Wall
CXXFLAGS += -fopenmp
CXXFLAGS += -Isrc
CXXFLAGS += -I$(CURDIR)/external/zlib-1.3.1
CXXFLAGS += -I$(CURDIR)/external/zlib-1.3.1/build
LDFLAGS = -L$(CURDIR)/external/zlib-1.3.1/build
LDLIBS = -lzlibstatic
SOURCES = $(wildcard src/*.cpp)
SOURCES += main.cpp
OBJECTS = $(SOURCES:.cpp=.o)
EXECUTABLE = main.exe
SOURCES_TESTS = test.cpp
OBJECTS_TESTS = $(SOURCES_TESTS:.cpp=.o)
EXECUTABLE_TESTS = test.exe
all: $(OBJECTS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) -o $(EXECUTABLE) $(LDLIBS)
test: $(OBJECTS_TESTS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS_TESTS) -o $(EXECUTABLE_TESTS) $(LDLIBS)
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
clean:
rm -f src/*.o
rm -f *.o
rm -f main.exe
cleantest:
rm -f src/*.o
rm -f *.o
rm -f test.exe
run: clean all
./$(EXECUTABLE)
runtest: clean test
./$(EXECUTABLE_TESTS)
runonly:
./$(EXECUTABLE)