-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.default
More file actions
63 lines (46 loc) · 1.32 KB
/
Makefile.default
File metadata and controls
63 lines (46 loc) · 1.32 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
BUILD_TYPE ?= release
PROJECT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
ifneq ($(BUILD_TYPE),release)
OPTFLAG ?= -O0
DBGFLAG ?= -ggdb
endif
HEADERS := \
include/jsonlogic/logic.hpp \
include/jsonlogic/details/ast-core.hpp \
include/jsonlogic/details/ast-full.hpp \
include/jsonlogic/details/cxx-compat.hpp
SOURCES := \
src/logic.cc
OBJECTS := $(SOURCES:.cc=.o)
DYNAMIC_LIB := libjsonlogiccpp.so
LIBDIR := $(PROJECT_DIR)/lib
EXAMPLES := \
examples/testeval.cc
EXAMPLES_BIN := $(EXAMPLES:.cc=.bin)
INCLUDES ?= -I$(BOOST_HOME)/include -I./include
CXXVERSION ?= -std=c++17
WARNFLAG ?= -Wall -Wextra -pedantic
DLLFLAG ?= -fpic
OPTFLAG ?= -O3
CPUARCH ?= -march=native
DBGFLAG ?= -DNDEBUG=1
CXXFLAGS := $(CXXVERSION) $(WARNFLAG) $(OPTFLAG) $(CPUARCH) $(DBGFLAG)
$(info $(OBJECTS))
.phony:default
default: lib/$(DYNAMIC_LIB)
.phony:examples
examples: $(EXAMPLES_BIN)
src/%.o: src/%.cc $(HEADERS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DLLFLAG) -o $@ -c $<
lib/$(DYNAMIC_LIB): $(OBJECTS) $(HEADERS)
mkdir -p lib
$(CXX) -shared -o $@ $(OBJECTS)
examples/%.bin: examples/%.cc $(HEADERS) lib/$(DYNAMIC_LIB)
$(CXX) $(CXXFLAGS) $(INCLUDES) -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -ljsonlogiccpp -o $@ $<
.phony: tests
tests:
cd tests
./run_tests.sh
.phony: clean
clean:
rm -f examples/*bin lib/*so src/*.o