forked from taocpp/config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (29 loc) · 1 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
# The Art of C++
# Copyright (c) 2018-2020 Dr. Colin Hirsch and Daniel Frey
# Please see LICENSE for license or visit https://github.com/taocpp/config
CXXSTD = -std=c++17
CPPFLAGS = -pedantic -I../json/include -Iinclude
CXXFLAGS = -Wall -Wextra -Werror -O3 -ftemplate-backtrace-limit=0
SOURCES := $(shell find src -name '*.cpp')
DEPENDS := $(SOURCES:%.cpp=build/%.d)
BINARIES := $(SOURCES:%.cpp=build/%)
TESTFILES := $(shell find tests -name '*.config')
TESTCASES := $(TESTFILES:%.config=%)
export VARIABLE := variable
export TEXTFILE := tests/showcase.t
export JSONFILE := tests/showcase.j
export CONFIGFILE := tests/showcase.c
.PHONY: all check clean
all: check $(BINARIES)
check: build/src/test/config/tests
build/src/test/config/tests $(TESTCASES)
clean:
rm -rf build/src
build/%.d: %.cpp Makefile
@mkdir -p $(@D)
$(CXX) $(CXXSTD) $(CPPFLAGS) -MM -MQ $@ $< -o $@
build/%: %.cpp build/%.d
$(CXX) $(CXXSTD) $(CPPFLAGS) $(CXXFLAGS) $< -o $@
ifeq ($(findstring $(MAKECMDGOALS),clean),)
-include $(DEPENDS)
endif