-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathMakefile
43 lines (34 loc) · 1.39 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
# Allow to override settings
CONFIG ?= Makefile.local
-include $(CONFIG)
Q ?= @
UPDATEDIR := /tmp
BUILDTYPE ?= Debug
BUILDDIR ?= ./build/$(BUILDTYPE)
INSTALL_DIR ?= $(BUILDDIR)
GENERATOR := Ninja
CMAKE ?= cmake
CMAKE_OPTIONS ?= -DFORCE_USE_SYSTEM_LIBS=1 -DCMAKE_BUILD_TYPE=$(BUILDTYPE) -G$(GENERATOR) --graphviz=$(BUILDDIR)/deps.dot
all:
$(Q)if [ ! -f $(BUILDDIR)/CMakeCache.txt ]; then $(CMAKE) -H$(CURDIR) -B$(BUILDDIR) $(CMAKE_OPTIONS); fi
$(Q)$(CMAKE) --build $(BUILDDIR) --target $@
$(Q)$(CMAKE) -E create_symlink build/Debug/compile_commands.json compile_commands.json
release:
$(Q)$(MAKE) BUILDTYPE=Release
clean:
$(Q)rm -rf $(BUILDDIR)
distclean:
$(Q)git clean -fdx
ccmake:
$(Q)ccmake -B$(BUILDDIR) -S.
release-%:
$(Q)$(MAKE) BUILDTYPE=Release $(subst release-,,$@)
%:
$(Q)if [ ! -f $(BUILDDIR)/CMakeCache.txt ]; then $(CMAKE) -H$(CURDIR) -B$(BUILDDIR) $(CMAKE_OPTIONS); fi
$(Q)$(CMAKE) --build $(BUILDDIR) --target $@
$(Q)$(CMAKE) --install $(BUILDDIR) --component $@ --prefix $(INSTALL_DIR)/install-$@
$(Q)$(CMAKE) -E create_symlink build/Debug/compile_commands.json compile_commands.json
dependency-%:
$(Q)$(CMAKE) -H$(CURDIR) -B$(BUILDDIR) $(CMAKE_OPTIONS)
$(Q)dot -Tsvg $(BUILDDIR)/deps.dot.$(subst dependency-,,$@) -o $(BUILDDIR)/deps.dot.$(subst dependency-,,$@).svg;
$(Q)xdg-open $(BUILDDIR)/deps.dot.$(subst dependency-,,$@).svg;