forked from HEP-FCC/FCCSW
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
112 lines (98 loc) · 2.86 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
101
102
103
104
105
106
107
108
109
110
111
112
################################################################################
#
# Generic Makefile to simplify the use of CMake projects
# ------------------------------------------------------
#
# This simple Makefile is meant to provide a simplified entry point for the
# configuration and build of CMake-based projects that use a default toolchain
# (as it is the case for Gaudi-based projects).
#
# Only a few targets are actually provided: all the main targets are directly
# delegated to the CMake Makefile.
#
# Main targets:
#
# all
# (default) build everything
#
# test [*]_
# run the declared tests
#
# install
# populate the InstallArea with the products of the build
#
# clean
# remove build products from the build directory
#
# purge [*]_
# deep clean of the build, including InstallArea
# (requires re-configuration)
#
# help
# print the list of available targets
#
# configure [*]_
# alias to CMake 'rebuild_cache' target
#
# tests [*]_
# backward-compatibility target for the CMT generic Makefile
#
# :Author: Marco Clemencic
#
# .. [*] Targets defined by this Makefile.
#
################################################################################
# settings
CMAKE = cmake
ifneq ($(wildcard $(CURDIR)/toolchain.cmake),)
override CMAKEFLAGS += -DCMAKE_TOOLCHAIN_FILE=$(CURDIR)/toolchain.cmake
endif
ifndef BINARY_TAG
ifdef CMAKECONFIG
BINARY_TAG=${CMAKECONFIG}
else
ifdef CMTCONFIG
BINARY_TAG=${CMTCONFIG}
endif
endif
endif
override CMAKEFLAGS += -DCMAKE_BUILD_TYPE=$(BUILDTYPE)
BUILDDIR := $(CURDIR)/build.$(BINARY_TAG)
# default target
all:
# deep clean
purge:
$(RM) -r $(BUILDDIR) $(CURDIR)/InstallArea/$(BINARY_TAG)
find $(CURDIR) -name "*.pyc" -exec $(RM) -v \{} \;
# delegate any target to the build directory (except 'purge')
ifneq ($(MAKECMDGOALS),purge)
%: $(BUILDDIR)/Makefile FORCE
$(MAKE) -C build.$(BINARY_TAG) $*
endif
# aliases
.PHONY: configure tests FORCE
ifneq ($(wildcard $(BUILDDIR)/Makefile),)
configure: rebuild_cache
else
configure: $(BUILDDIR)/Makefile
endif
@ # do not delegate further
# This wrapping around the test target is used to ensure the generation of
# the XML output from ctest.
test: $(BUILDDIR)/Makefile
$(MAKE) -C build.$(BINARY_TAG) ARGS="-T test $(ARGS)" $@
tests: all
-$(MAKE) -C build.$(BINARY_TAG) ARGS="-T test" test
$(MAKE) -C build.$(BINARY_TAG) QMTestSummary
# ensure that the target are always passed to the CMake Makefile
FORCE:
@ # dummy target
# Special trick to allow a non-standard makefile name
# If the makefile is not called 'Makefile', we get its update delegated to
# cmake, unless we block the delegation.
$(lastword $(MAKEFILE_LIST)):
@ # do not delegate further
# trigger CMake configuration
$(BUILDDIR)/Makefile:
mkdir -p $(BUILDDIR)
cd $(BUILDDIR) && $(CMAKE) $(CMAKEFLAGS) $(CURDIR)