-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
46 lines (34 loc) · 960 Bytes
/
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
builddir=.build-$(shell gcc -dumpmachine)-$(shell gcc -dumpversion)
CMAKE_ARGS=
ifeq (,$(VERBOSE))
MAKEFLAGS:=$(MAKEFLAGS)s
ECHO=echo
else
ECHO=@:
endif
TARGETS=Patagui
BUILDLN=build
all: $(TARGETS) $(BUILDLN) ;
$(TARGETS): cmake-build
ln -s -f ${builddir}/$@ $@
$(BUILDLN):
test -e $(BUILDLN) || ln -s -f ${builddir} $(BUILDLN)
cmake ${builddir}/CMakeCache.txt:
mkdir -p ${builddir}
$(ECHO) "Running cmake "
cd ${builddir} && cmake $(CMAKE_ARGS) "$(@D)" ..
cmake-build: ${builddir}/CMakeCache.txt
$(ECHO) "Building "
$(MAKE) -C ${builddir}
install:
$(ECHO) "Installing "
$(MAKE) -C ${builddir} install
distclean:
$(ECHO) -n "Cleaning up build directory "
$(RM) -r ${builddir} $(BUILDLN) $(TARGETS)
$(ECHO) " done"
%: cmake
$(ECHO) "Running make $@ "
$(MAKE) -C ${builddir} $@
$(and $(filter clean,$@),$(RM) $(BUILDLN) $(TARGETS))
.PHONY: cmake-build cmake install $(BUILDLN)