forked from sergei-dyshel/glogg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
100 lines (77 loc) · 2.23 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
CMAKE_ARGS ?=
ifdef PREFIX
CMAKE_ARGS += -DCMAKE_INSTALL_PREFIX=$(shell readlink -f $(PREFIX))
endif
ROOT := $(shell pwd)
DEBUG := build/debug
RELEASE := build/release
DEBUG_TESTS ?= 1
build_all:
ifneq (,$(wildcard $(DEBUG)))
$(MAKE) build_debug
endif
ifneq (,$(wildcard $(RELEASE)))
$(MAKE) build_release
endif
ifdef g
GDB_PREFIX := gdb -ex run --args
endif
MAKE := $(MAKE) --no-print-directory -j$(shell nproc)
submodule_update:
git submodule update --init --recursive
configure_debug:
mkdir -p $(DEBUG)
cd $(DEBUG) && cmake $(ROOT) -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=YES \
-DBUILD_TESTS=$(DEBUG_TESTS) -DMAC_BUNDLE=NO $(CMAKE_ARGS)
ln -f $(DEBUG)/compile_commands.json
configure_release:
mkdir -p $(RELEASE)
cd $(RELEASE) && cmake $(ROOT) -DCMAKE_BUILD_TYPE=RelWithDebInfo $(CMAKE_ARGS)
configure: configure_debug configure_release
reconfigure:
ifneq (,$(wildcard $(DEBUG)))
$(MAKE) configure_debug
endif
ifneq (,$(wildcard $(RELEASE)))
$(MAKE) configure_release
endif
clean_reconfigure:
ifneq (,$(wildcard $(DEBUG)))
rm -rf $(DEBUG) && $(MAKE) configure_debug
endif
ifneq (,$(wildcard $(RELEASE)))
rm -rf $(RELEASE) && $(MAKE) configure_release
endif
build_debug:
$(MAKE) -C $(DEBUG)
[ -f $(DEBUG)/tests/glogg_syntax_tests ] && $(DEBUG)/tests/glogg_syntax_tests --quiet || true
./validate-yaml.py colors.schema.json config/*.glogg-colors.yaml
./validate-yaml.py syntax.schema.json config/*.glogg-syntax.yaml
$(DEBUG)/glogg --check-config ./config
run_debug: build_debug
-pkill -f $(DEBUG)/glogg
$(GDB_PREFIX) $(DEBUG)/glogg --server=debug -t -ddd sample/* -l log
syntax_tests:
$(MAKE) -C $(DEBUG)/tests glogg_syntax_tests
$(DEBUG)/tests/glogg_syntax_tests --gtest_filter="*$(f)*" -ddd
build_release:
$(MAKE) -C $(RELEASE)
distclean_debug:
rm -rf $(DEBUG)
distclean_release:
rm -rf $(RELEASE)
install:
$(MAKE) -C $(RELEASE) install
[[ "$$OSTYPE" == "darwin"* ]] && rm -rf /Applications/glogg.app && cp -r build/release/output/glogg.app /Applications
cpack: install
cd $(RELEASE) && cpack $(if $(VERBOSE),--verbose)
clean_debug:
ifneq (,$(wildcard $(DEBUG)))
$(MAKE) -C $(DEBUG) clean
endif
clean_release:
ifneq (,$(wildcard $(RELEASE)))
$(MAKE) -C $(RELEASE) clean
endif
clean: clean_debug clean_release