-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (29 loc) · 713 Bytes
/
Makefile
File metadata and controls
38 lines (29 loc) · 713 Bytes
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
OUT ?= build
TARGETS := \
test/algorithm \
test/main \
test/vector_base \
test/vector \
#
CXX ?= g++
CXXFLAGS ?= -Iinclude -std=c++20 -Wall -Wextra -g
LDFLAGS ?=
LDLIBS ?=
ifeq ($(SANITIZE),1)
CXXFLAGS += -fsanitize=address,undefined
LDFLAGS += -fsanitize=address,undefined
endif
all: $(patsubst %,$(OUT)/%,$(TARGETS))
$(OUT)/%: $(patsubst %,$(OUT)/%.cc.o,%)
@mkdir -p $(@D)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
$(OUT)/%.cc.o: %.cc
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -o $@ -c $<
$(OUT)/%.cc.d: %.cc
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -MM -MT "$(patsubst %,$(OUT)/%.o,$<) $(patsubst %,$(OUT)/%.d,$<)" -o $@ $<
include $(patsubst %,$(OUT)/%.cc.d,$(TARGETS))
.PHONY: clean
clean:
rm -rf $(OUT)