-
Notifications
You must be signed in to change notification settings - Fork 598
/
Makefile
47 lines (37 loc) · 1.12 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
ifeq (,$(VERBOSE))
MAKEFLAGS:=$(MAKEFLAGS)s
ECHO=echo
else
ECHO=@:
endif
BUILDDIR=build
# Run "make" in $(BUILDDIR) by default.
# This is required to generate all files already, which should not be generated
# with "(sudo) make install" only later.
cmake-build: $(BUILDDIR)/Makefile
$(ECHO) "Building…"
$(MAKE) -C $(BUILDDIR)
# Run CMake with CMAKE_ARGS defined on command line ("make CMAKE_ARGS=…").
ifeq ($(origin CMAKE_ARGS),command line)
.PHONY: $(BUILDDIR)/Makefile
endif
$(BUILDDIR)/Makefile:
$(ECHO) "Creating build directory and running cmake in it. You can also run CMake directly, if you want."
$(ECHO)
mkdir -p $(BUILDDIR)
$(ECHO) "Running cmake…"
cd $(BUILDDIR) && cmake $(CMAKE_ARGS) "$(CURDIR)"
tags:
git ls-files | xargs ctags
install:
$(ECHO) "Installing…"
$(MAKE) -C $(BUILDDIR) install
distclean:
$(ECHO) "Cleaning up build directory…"
$(RM) -r $(BUILDDIR)
# Use an explicit rule to not "update" the Makefile via the implicit rule below.
Makefile: ;
%: $(BUILDDIR)/Makefile
$(ECHO) "Running make $@ in $(BUILDDIR)…"
$(MAKE) -C $(BUILDDIR) $@
.PHONY: cmake-build install distclean tags