File: Makefile

package info (click to toggle)
awesome 4.3-8.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,468 kB
  • sloc: ansic: 14,508; sh: 526; makefile: 46
file content (47 lines) | stat: -rw-r--r-- 1,154 bytes parent folder | download | duplicates (4)
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) -n "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