-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
166 lines (132 loc) · 4.02 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
ifdef PREFIX
install all: | .git
install all: real-all
REALPREFIX := $(abspath $(PREFIX))
else
install all: | .git
install all: error
endif
# Enable verbose compilation with "make V=1"
ifdef V
Q :=
E := @:
else
Q := @
E := @echo
endif
# default target
real-all: install-timer install-instrumented install-tracer
@echo "=== all done! ==="
#
# traceR
#
.PHONY : install-tracer
install-tracer: $(REALPREFIX)/tracer.pl
$(REALPREFIX)/tracer.pl: traceR/tracer.pl | $(REALPREFIX)
$(E) ===== installing traceR =====
$(Q)cd traceR ; $(MAKE) install PREFIX=$(REALPREFIX)
#
# timeR
#
.PHONY : build-timer install-timer
build-timer: timeR/bin/R
install-timer: $(REALPREFIX)/timed/bin/R
$(REALPREFIX)/timed/bin/R: timeR/bin/R | $(REALPREFIX)
$(E) ===== installing timeR =====
$(Q)cd timeR ; $(MAKE) install
timeR/bin/R: .last-modupdate .old_installprefix | $(REALPREFIX)
$(E) ===== building timeR =====
$(Q)cd timeR ; ./configure --prefix=$(REALPREFIX)/timed --enable-timeR $(COMMON_CONFIGOPTS) $(TIMER_CONFIGOPTS)
$(Q)cd timeR ; $(MAKE) $(MAKEOPTS)
#
# r-instrumented
#
.PHONY : build-instrumented install-instrumented
build-instrumented: r-instrumented/bin/R | $(REALPREFIX)
install-instrumented: $(REALPREFIX)/instrumented/bin/R
$(REALPREFIX)/instrumented/bin/R: r-instrumented/bin/R | $(REALPREFIX)
$(E) ===== installing r-instrumented =====
$(Q)cd r-instrumented ; $(MAKE) install
r-instrumented/bin/R: .last-modupdate .old_installprefix | $(REALPREFIX)
$(E) ===== building r-instrumented =====
$(Q)cd r-instrumented ; ./configure --prefix=$(REALPREFIX)/instrumented --disable-debugscopes $(COMMON_CONFIGOPTS) $(INSTRUMENTED_CONFIGOPTS)
$(Q)cd r-instrumented ; $(MAKE) $(MAKEOPTS)
$(Q)touch $@
#
# other rules
#
# error message if no REFIX is specified
error:
@echo ERROR: No target directory has been specified!
@echo ""
@echo Please use \"$(MAKE) PREFIX=/where/you/want/it/installed\"
@echo to specify a target directory.
@echo ""
@echo You can also use \"make help\" to see a list of
@echo variables available.
# help message
help:
@echo "Available variables:"
@echo " REALPREFIX"
@echo " sets the directory where the traceR framework will be installed"
@echo ""
@echo " COMMON_CONFIGOPTS"
@echo " sets the options passed to configure for both timeR and r-instrumented"
@echo ""
@echo " TIMER_CONFIGOPTS"
@echo " sets the options passed to configure for just timeR"
@echo ""
@echo " INSTRUMENTED_CONFIGOPTS"
@echo " sets the options passed to configure for just r-instrumented"
# sanity check
.git:
@echo "ERROR: No .git directory found"
@echo ""
@echo "This Makefile only works if you use a clone of the traceR-install"
@echo "repository and not if you just have an archive of its contents."
@echo ""
@echo "Please clone the traceR-install repository and try again."
@false
# run "make clean" in the subrepositories
clean:
$(E) ===== cleaning timeR =====
$(Q)cd timeR ; $(MAKE) clean
$(E) ===== cleaning r-instrumented =====
$(Q)cd r-instrumented ; $(MAKE) clean
$(E) ===== cleaning traceR =====
$(Q)cd traceR ; $(MAKE) clean
$(Q)rm -f .old_installprefix .last-modupdate
# create target directory
$(REALPREFIX):
$(Q)mkdir -p $(REALPREFIX)
.last-modupdate: .git/HEAD .git/FETCH_HEAD .git/refs/heads/master
$(Q)git submodule update --init
$(Q)touch $@
# Workaround for freshly-cloned repos that don't have this file yet
.git/FETCH_HEAD:
# @git fetch would work too, but fails if there are no remotes
$(Q)touch $@
# helper target for the maintainer
updateall:
git submodule foreach git pull origin master
# check for change of target prefix
-include .old_installprefix
ifdef PREFIX
.old_installprefix:
$(Q)echo OLD_PREFIX=$(REALPREFIX) > .old_installprefix
else
.old_installprefix:
endif
# conditionally add a force-rebuild dependency if OLD_PREFIX does not exist or differs
ifndef OLD_PREFIX
.old_installprefix: FORCE
else
ifeq ($(OLD_PREFIX), $(REALPREFIX))
.old_installprefix:
else
.old_installprefix: FORCE
endif
endif
# empty no-rule target for forcing other targets to always rebuild
.PHONE : FORCE
FORCE: