forked from etmc/tmLQCD
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.global
71 lines (54 loc) · 3.15 KB
/
Makefile.global
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
# This Makefile is included from the other Makefiles
# It contains some overall targets...
# refresh Makefile and other stuff
PROGRAMS_WITH_GIT_HASH := hmc_tm invert
.SUFFIXES:
Makefile: ${top_srcdir}/Makefile.global $(srcdir)/Makefile.in $(abs_top_builddir)/config.status
cd $(abs_top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(abs_top_builddir)/config.status: $(top_srcdir)/configure
( cd ${abs_top_builddir} && $(SHELL) ./config.status --recheck )
$(abs_top_builddir)/config.h: $(top_srcdir)/config.h.in $(abs_top_builddir)/config.status $(top_srcdir)/configure
( cd ${abs_top_builddir} && $(SHELL) ./config.status --header=config.h )
# rebuild configure if configure.in changes but ignore errors
# on many machines some of the macros fail to be recognized
# but the resulting configure still works
$(top_srcdir)/configure: $(top_srcdir)/configure.in
-( cd $(top_srcdir) && $(AUTOCONF) )
#extern modules
$(addsuffix .o,$(EXTERNMODULES)): %.o:
( cd $(dir $@) && ${MAKE} $(notdir $@) )
#extern libs
$(LINKLIBS): %.a: Makefile $(abs_top_builddir)/config.status $(top_srcdir)/configure
@( cd $(dir $@) && ${MAKE} $(notdir $@) )
#dep rules
# PROGRAMS_WITH_GIT_HASH require git_hash.h which is dynamically built by a phony make target
# to prevent too frequent building of git_hash (slowing down the build)
# we filter the list of all objects and treat these separately
$(addsuffix .d, $(filter-out ${PROGRAMS_WITH_GIT_HASH},${ALLOBJ})): %.d: ${srcdir}/%.c Makefile
@ $(CCDEP) ${DEPFLAGS} ${CPPFLAGS} ${INCLUDES} ${DEFS} $< > $@
# dirty hack to prevent make from entering an infinite loop because a phony target is given as a real
# dependency (make will build invert.d and hmc_tm.d indefinitely)
# when git_hash.h does not exist (as checked using wildcard) it is given as a dependency of invert.d and hmc_tm.d
# once it exists, this is no longer the case
# while this does break updating of git_hash.h while the dependencies are built, this is quite
# irrelevant because it will be rebuilt during the compilation of either invert or hmc_tm
ifneq (git_hash.h, $(findstring git_hash.h,$(wildcard $(top_srcdir)/git_has*.h)))
$(addsuffix .d, $(filter ${PROGRAMS_WITH_GIT_HASH},${ALLOBJ})): %.d: ${srcdir}/%.c ${top_srcdir}/git_hash.h Makefile
@ $(CCDEP) ${DEPFLAGS} ${CPPFLAGS} ${INCLUDES} ${DEFS} $< > $@
else
$(addsuffix .d, $(filter ${PROGRAMS_WITH_GIT_HASH},${ALLOBJ})): %.d: ${srcdir}/%.c Makefile
@ $(CCDEP) ${DEPFLAGS} ${CPPFLAGS} ${INCLUDES} ${DEFS} $< > $@
endif
${top_builddir}/fixed_volume.h: ${top_srcdir}/fixed_volume.h.in ${top_builddir}/config.status
cd ${abs_top_builddir} && CONFIG_FILES=fixed_volume.h CONFIG_HEADERS= $(SHELL) ${top_builddir}/config.status
all-recursive all-debug-recursive all-profile-recursive clean-recursive distclean-recursive compile-clean-recursive: Makefile
@set fnord ${MAKEFLAGS}; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
local_target="$$target"; \
( cd $$subdir && $(MAKE) $$local_target ) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; test -z "$$fail";