-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (48 loc) · 1.87 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
DEFAULTBUILDDIR := build
DEBUGBUILDDIR := debug
RELEASEBUILDDIR := release
CURRENTDIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
SOURCEDIR := $(CURRENTDIR)
export GCC_COLORS='error=01;31:warning=01;38;5;172:caret=01;38;5;172:locus=01:quote=:note=01;32:range1=:range2=:fixit-insert=:fixit-delete=:diff-filename=:diff-hunk=:diff-delete=:diff-insert=:type-diff='
export CMAKE_C_COMPILER = $(shell which gcc)
export CMAKE_CXX_COMPILER = $(shell which g++)
export CMAKE_CXX_FLAGS += -fdiagnostics-color=auto
export CMAKE_C_FLAGS += -fdiagnostics-color=auto
MAKEFLAGS += --no-print-directory
.PHONY: build debug release clean help paragnosis all
all: release
@$(MAKE) pg
pg:
@cd src/paragnosis && sudo pip3 install .
cp src/paragnosis/bin/pg bin
touch ~/.pgrc
@if ! grep -q 'location' ~/.pgrc; then echo location = $(CURRENTDIR) >> ~/.pgrc; fi
doc: readme.pdf
readme.pdf: README.md
pandoc -V geometry:margin=1in -o readme.pdf README.md
build: $(DEFAULTBUILDDIR)/CMakeCache.txt
@$(MAKE) -Wno-dev -C $(DEFAULTBUILDDIR) install
release: CMAKEFLAGS += -DCMAKE_BUILD_TYPE=Release
release: $(RELEASEBUILDDIR)/CMakeCache.txt
@$(MAKE) -Wno-dev -C $(RELEASEBUILDDIR) install
debug: CMAKEFLAGS += -DCMAKE_BUILD_TYPE=Debug
debug: $(DEBUGBUILDDIR)/CMakeCache.txt
@$(MAKE) -Wno-dev -C $(DEBUGBUILDDIR) install
%/CMakeCache.txt:
@mkdir -p $*
@cd $* && cmake -Wno-dev $(CMAKEFLAGS) $(SOURCEDIR)
clean:
@rm -rf $(DEBUGBUILDDIR) $(DEFAULTBUILDDIR) $(RELEASEBUILDDIR)
@cd src/paragnosis && rm -rf *.egg-info build dist
help:
@echo "Usage:"
@echo " make [option]"
@echo ""
@echo "Options:"
@echo " build* : create build directory (cmake) and compile"
@echo " release : same as 'build', but with NDEBUG"
@echo " debug : same as 'build', but with debug symbols"
@echo " clean : remove build directories"
@echo ""
@echo " * = default"
@echo ""