-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (35 loc) · 1.15 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
BUILD_TYPE:=debug
CLINGO_DIR:=${HOME}/.local/opt/potassco/$(BUILD_TYPE)/lib/cmake/Clingo
CXX=clang++
CXXFLAGS=-Wall -Wextra -Wpedantic -Werror -stdlib=libc++
define cmake_options
-G Ninja \
-S . \
-B "build/$(BUILD_TYPE)" \
-DCMAKE_INSTALL_PREFIX=${HOME}/.local/opt/potassco/$(BUILD_TYPE) \
-DCMAKE_CXX_FLAGS="$(CXXFLAGS)" \
-DCMAKE_CXX_COMPILER="$(CXX)" \
-DClingo_DIR="$(CLINGO_DIR)" \
-DCLINGOLPX_BUILD_TESTS=On \
-DCMAKE_EXPORT_COMPILE_COMMANDS=On
endef
ifeq ($(BUILD_TYPE),profile)
cmake_options += -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCLINGOLPX_PROFILE=On
else
cmake_options += -DCMAKE_BUILD_TYPE="$(BUILD_TYPE)"
endif
.PHONY: all configure compdb
all: configure
@TERM=dumb MAKEFLAGS= MFLAGS= cmake --build "build/$(BUILD_TYPE)" --target all
test: all
@TERM=dumb MAKEFLAGS= MFLAGS= cmake --build "build/$(BUILD_TYPE)" --target "test"
%: configure
@TERM=dumb MAKEFLAGS= MFLAGS= cmake --build "build/$(BUILD_TYPE)" --target "$@"
# compdb can be installed with pip
compdb: configure
compdb -p "build/$(BUILD_TYPE)" list -1 > compile_commands.json
configure: build/$(BUILD_TYPE)/build.ninja
build/$(BUILD_TYPE)/build.ninja:
cmake $(cmake_options)
Makefile:
: