-
Notifications
You must be signed in to change notification settings - Fork 406
/
Makefile.in
383 lines (294 loc) · 12 KB
/
Makefile.in
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
#### CONFIGURE VARIABLE
# export ERLC_EMULATOR to fix a bug in R9B with native compilation
ERLC_EMULATOR=@ERL@
export ERLC_EMULATOR
ERL=@ERL@
ERLC=@ERLC@
SED=@SED@
ERL_OPTS=@ERL_OPTS@
# FIXME
DIALYZER=@DIALYZER@
ERLDIR=@ERLANG_ROOT_DIR@
export ERLDIR
USENEWTIMEAPI=@erlang_cv_new_time_api@
ERLANG_XMERL_DIR=@ERLANG_LIB_DIR_xmerl@/include
raw_erlang_prefix=@libdir@/erlang/
PACKAGE_TARNAME=@PACKAGE_TARNAME@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
datadir=@datadir@
datarootdir=@datarootdir@
docdir=@docdir@
TEMPLATES_SUBDIR=@TEMPLATES_SUBDIR@
CONFIGURE_DEPENDENCIES=@CONFIGURE_DEPENDENCIES@
CONFIG_STATUS_DEPENDENCIES=@CONFIG_STATUS_DEPENDENCIES@
VERSION=@PACKAGE_VERSION@
PACKAGE=@PACKAGE_NAME@
DTD=@DTD@
#### END OF SUBSTITUTION
SVN_REVISION=$Revision$
ERL_COMPILER_OPTIONS="[warn_unused_vars]"
export ERL_COMPILER_OPTIONS
ifeq ($(TYPE),debug)
OPT =+debug_info -DDEBUG
else
ifeq ($(TYPE),native)
OPT:=+native
else
OPT = +strict_record_tests
endif
endif
EBIN = ./ebin
EBIN_TEST = ./ebin-test
ifeq ($(TYPE),test)
OPT =+export_all +debug_info
EBIN = $(EBIN_TEST)
endif
ifeq ($(USENEWTIMEAPI),yes)
OPT += -Dnew_time_api
endif
INC = ./include
CC = $(ERLC)
ESRC = ./src
ifeq ($(TYPE),snapshot)
DAY=$(shell date +"%Y%m%d")
distdir = $(PACKAGE)-$(VERSION)-$(DAY)
else
distdir = $(PACKAGE)-$(VERSION)
endif
# installation path
BINDIR = $(bindir)
LIBDIR = $(libdir)/tsung/
TOOLS_BINDIR = $(LIBDIR)/bin
CONFDIR = $(docdir)/examples
SHARE_DIR = $(datadir)/tsung/
TEMPLATES_DIR = $(datadir)/$(TEMPLATES_SUBDIR)
MAN_DIR = $(datadir)/man/man1/
DOC_DIR = $(docdir)
# custom behaviours
BEHAVIORS = $(EBIN)/ts_plugin.beam $(EBIN)/gen_ts_transport.beam
ERLANG_LIB_DIR = $(libdir)/erlang/lib
APPLICATION = tsung
CONTROLLER_APPLICATION = tsung_controller
RECORDER_APPLICATION = tsung_recorder
RECORDER_TARGETDIR = $(LIBDIR)/$(RECORDER_APPLICATION)-$(VERSION)
CONTROLLER_TARGETDIR = $(LIBDIR)/$(CONTROLLER_APPLICATION)-$(VERSION)
TARGETDIR = $(LIBDIR)/$(APPLICATION)-$(VERSION)
TEMPLATES = $(wildcard $(ESRC)/templates/*.thtml)
TEMPLATES_STYLE = $(wildcard $(ESRC)/templates/style/*.js)
TEMPLATES_STYLE += $(wildcard $(ESRC)/templates/style/*.css)
TMP = $(wildcard *~) $(wildcard src/*~) $(wildcard inc/*~)
INC_FILES = $(wildcard $(INC)/*.hrl)
LIBSRC = $(wildcard $(ESRC)/lib/*.erl)
TESTSRC = $(wildcard $(ESRC)/test/*.erl)
SRC = $(wildcard $(ESRC)/$(APPLICATION)/*.erl)
CONTROLLER_SRC = $(wildcard $(ESRC)/$(CONTROLLER_APPLICATION)/*.erl)
RECORDER_SRC = $(wildcard $(ESRC)/$(RECORDER_APPLICATION)/*.erl)
CONFFILE_SRC = $(wildcard examples/*.xml.in)
CONFFILE = $(basename $(CONFFILE_SRC))
TEST_CONFFILE_SRC = $(wildcard src/test/*.xml.in)
TEST_CONFFILE = $(basename $(TEST_CONFFILE_SRC))
USERMANUAL = docs/_build/latex/Tsung.pdf
USERMANUAL_IMG = $(wildcard docs/images/*.png)
USERMANUAL_SRC = $(wildcard docs/*.rst docs/*.txt)
MANPAGES = $(wildcard man/*.1)
PERL_SCRIPTS_SRC = $(wildcard $(ESRC)/*.pl.in)
PERL_SCRIPTS = $(basename $(PERL_SCRIPTS_SRC))
TSPLOT_SRC = $(wildcard $(ESRC)/tsung-plotter/*.py.in)
TSPLOT = $(basename $(TSPLOT_SRC))
TSUNG_PLOTTER_LIB= $(wildcard $(ESRC)/tsung-plotter/tsung/*.py)
TSUNG_PLOTTER_CONF= $(wildcard $(ESRC)/tsung-plotter/tsung/*.conf) $(wildcard $(ESRC)/tsung-plotter/*.conf)
TARGET = $(addsuffix .beam, $(basename \
$(addprefix $(EBIN)/, $(notdir $(SRC)))))
LIB_TARGET = $(addsuffix .beam, $(basename \
$(addprefix $(EBIN)/, $(notdir $(LIBSRC)))))
CONTROLLER_TARGET = $(addsuffix .beam, $(basename \
$(addprefix $(EBIN)/, $(notdir $(CONTROLLER_SRC)))))
RECORDER_TARGET = $(addsuffix .beam, $(basename \
$(addprefix $(EBIN)/, $(notdir $(RECORDER_SRC)))))
TEST_TARGET = $(addsuffix .beam, $(basename \
$(addprefix $(EBIN)/, $(notdir $(TESTSRC)))))
DEBIAN = debian/changelog debian/control debian/compat debian/copyright debian/docs debian/tsung.dirs debian/rules
APPFILES = $(EBIN)/$(APPLICATION).app
APPFILES_IN = $(ESRC)/$(APPLICATION)/$(APPLICATION).app.in
CONTROLLER_APPFILES = $(EBIN)/$(CONTROLLER_APPLICATION).app
CONTROLLER_APPFILES_IN = $(ESRC)/$(CONTROLLER_APPLICATION)/$(CONTROLLER_APPLICATION).app.in
RECORDER_APPFILES = $(EBIN)/$(RECORDER_APPLICATION).app
RECORDER_APPFILES_IN = $(ESRC)/$(RECORDER_APPLICATION)/$(RECORDER_APPLICATION).app.in
SCRIPT = $(BINDIR)/tsung
REC_SCRIPT = $(BINDIR)/tsung-recorder
PWD = $(shell pwd)
DIST_COMMON=Makefile.in $(CONFFILE_SRC) $(PERL_SCRIPTS_SRC) $(TSPLOT_SRC) tsung.sh.in tsung-recorder.sh.in tsung.spec.in $(CONTROLLER_APPFILES_IN)
DOC_OPTS={def,{version,\"$(VERSION)\"}}
.PHONY: doc
tsung: Makefile config.status $(PERL_SCRIPTS) $(TSPLOT) tsung.sh tsung-recorder.sh tsung.spec $(TARGET) $(RECORDER_TARGET) $(CONTROLLER_TARGET) $(LIB_TARGET) $(CONTROLLER_APPFILES) $(APPFILES) $(RECORDER_APPFILES)
buildtest: $(TEST_TARGET)
fulltest: clean test
test:
@mkdir -p $(EBIN_TEST)
$(MAKE) TYPE=test dotest
dotest: tsung buildtest $(CONFFILE) $(TEST_CONFFILE)
$(ERL) -noshell -pa $(EBIN_TEST) -s ts_test_all run -s init stop
edoc:
$(ERL) -noshell -eval "edoc:application($(APPLICATION), \"./$(ESRC)/$(APPLICATION)\", [$(DOC_OPTS)])" -s init stop
$(ERL) -noshell -eval "edoc:application($(CONTROLLER_APPLICATION), \
\"./$(ESRC)/$(CONTROLLER_APPLICATION)\", [$(DOC_OPTS)])" -s init stop
$(ERL) -noshell -eval "edoc:application($(RECORDER_APPLICATION), \
\"./$(ESRC)/$(RECORDER_APPLICATION)\", [$(DOC_OPTS)])" -s init stop
# TODO: remove -Wno_behaviours, but only if R15B became a requirement.
# see http://erlang.org/pipermail/erlang-questions/2012-January/063608.html
dialyzer:
$(DIALYZER) -r ebin -I ./include/ -Wno_undefined_callbacks
all: clean tsung
debug:
$(MAKE) TYPE=debug
native:
$(MAKE) TYPE=native
rpm: release tsung.spec
rpmbuild -ta $(distdir).tar.gz
validate: $(CONFFILE)
@for i in $(CONFFILE); do xmlproc_val $$i; done
deb:
fakeroot debian/rules clean
debian/rules build
fakeroot debian/rules binary
show:
@echo $(LIBSRC)
clean:
-rm -fr $(EBIN_TEST)
-rm -f $(TARGET) $(TMP)
-rm -f $(RECORDER_APPFILES) $(CONTROLLER_APPFILES) $(APPFILES)
-rm -f $(EBIN)/*.app $(PERL_SCRIPTS) $(TSPLOT) $(CONFFILE)
-rm -f $(EBIN)/*.beam tsung.sh tsung.spec tsung.xml tsung.sh tsung-recorder.sh
-rm -f *.xml config.log src/test/*.xml src/test/usersdb.csv
install: tsung doc install_recorder install_controller $(CONFFILE)
-rm -f $(TMP)
install -d $(DESTDIR)$(TARGETDIR)/priv
install -d $(DESTDIR)$(TARGETDIR)/ebin
install -d $(DESTDIR)$(TARGETDIR)/src
install -d $(DESTDIR)$(TARGETDIR)/include
install -d $(DESTDIR)$(TOOLS_BINDIR)/
install -d $(DESTDIR)$(BINDIR)/
install -pm 0644 $(INC_FILES) $(DESTDIR)$(TARGETDIR)/include/
install -pm 0644 $(TARGET) $(DESTDIR)$(TARGETDIR)/ebin/
install -pm 0644 $(LIB_TARGET) $(DESTDIR)$(TARGETDIR)/ebin/
install -pm 0644 $(APPFILES) $(DESTDIR)$(TARGETDIR)/ebin/
install -pm 0644 $(SRC) $(DESTDIR)$(TARGETDIR)/src/
# install the man page
install -d $(DESTDIR)$(MAN_DIR)
install -pm 0644 $(MANPAGES) $(DESTDIR)$(MAN_DIR)
# create startup script
install -pm 0755 tsung.sh $(DESTDIR)$(SCRIPT)
install -pm 0755 tsung-recorder.sh $(DESTDIR)$(REC_SCRIPT)
install -pm 0755 $(PERL_SCRIPTS) $(DESTDIR)$(TOOLS_BINDIR)
# tsung-plotter
install -pm 0755 $(TSPLOT) $(DESTDIR)$(BINDIR)/tsplot
install -d $(DESTDIR)$(LIBDIR)/tsung_plotter
install -d $(DESTDIR)$(SHARE_DIR)/tsung_plotter
install -pm 0644 $(TSUNG_PLOTTER_LIB) $(DESTDIR)$(LIBDIR)/tsung_plotter
install -pm 0644 $(TSUNG_PLOTTER_CONF) $(DESTDIR)$(SHARE_DIR)/tsung_plotter
install -d $(DESTDIR)$(CONFDIR)
install -pm 0644 $(CONFFILE) $(DESTDIR)$(CONFDIR)/
install -d $(DESTDIR)$(TEMPLATES_DIR)
install -d $(DESTDIR)$(TEMPLATES_DIR)/style
install -pm 0644 $(TEMPLATES) $(DESTDIR)$(TEMPLATES_DIR)/
install -pm 0644 $(TEMPLATES_STYLE) $(DESTDIR)$(TEMPLATES_DIR)/style
install -pm 0644 $(DTD) $(DESTDIR)$(SHARE_DIR)/
install_recorder:
install -d $(DESTDIR)$(RECORDER_TARGETDIR)/priv
install -d $(DESTDIR)$(RECORDER_TARGETDIR)/ebin
install -d $(DESTDIR)$(RECORDER_TARGETDIR)/src
install -d $(DESTDIR)$(RECORDER_TARGETDIR)/include
install -pm 0644 $(INC_FILES) $(DESTDIR)$(RECORDER_TARGETDIR)/include
install -pm 0644 $(RECORDER_TARGET) $(DESTDIR)$(RECORDER_TARGETDIR)/ebin
install -pm 0644 $(RECORDER_APPFILES) $(DESTDIR)$(RECORDER_TARGETDIR)/ebin
install -pm 0644 $(RECORDER_SRC) $(DESTDIR)$(RECORDER_TARGETDIR)/src
install_controller:
install -d $(DESTDIR)$(CONTROLLER_TARGETDIR)/priv
install -d $(DESTDIR)$(CONTROLLER_TARGETDIR)/ebin
install -d $(DESTDIR)$(CONTROLLER_TARGETDIR)/src
install -d $(DESTDIR)$(CONTROLLER_TARGETDIR)/include
install -pm 0644 $(INC_FILES) $(DESTDIR)$(CONTROLLER_TARGETDIR)/include
install -pm 0644 $(CONTROLLER_TARGET) $(DESTDIR)$(CONTROLLER_TARGETDIR)/ebin
install -pm 0644 $(CONTROLLER_APPFILES) $(DESTDIR)$(CONTROLLER_TARGETDIR)/ebin
install -pm 0644 $(CONTROLLER_SRC) $(DESTDIR)$(CONTROLLER_TARGETDIR)/src
uninstall:
rm -rf $(TARGETDIR) $(SCRIPT)
Makefile: Makefile.in config.status
@$(SHELL) ./config.status --file=$@
%.pl: %.pl.in vsn.mk
@$(SHELL) ./config.status --file=$@
%.py: %.py.in vsn.mk
@$(SHELL) ./config.status --file=$@
%.spec: %.spec.in vsn.mk
@$(SHELL) ./config.status --file=$@
%.xml: %.xml.in
@$(SHELL) ./config.status --file=$@
%.sh :%.sh.in vsn.mk
@$(SHELL) ./config.status --file=$@
$(APPFILES): $(APPFILES_IN)
@$(SHELL) ./config.status --file=$@:$<
$(CONTROLLER_APPFILES): $(CONTROLLER_APPFILES_IN)
@$(SHELL) ./config.status --file=$@:$<
$(RECORDER_APPFILES): $(RECORDER_APPFILES_IN)
@$(SHELL) ./config.status --file=$@:$<
config.status: configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
configure: configure.ac $(CONFIGURE_DEPENDENCIES)
@echo "running autoconf"
@autoconf
doc:
$(MAKE) -C man man
user_guide:
$(MAKE) -C docs latexpdf
release: Makefile tsung.spec doc user_guide
rm -fr $(distdir)
mkdir -p $(distdir)
tar zcf tmp.tgz $(SRC) $(APPFILES_IN) $(INC_FILES) $(LIBSRC) \
$(CONTROLLER_SRC) $(CONTROLLER_APPFILES_IN) $(TESTSRC) \
$(RECORDER_APPFILES_IN) \
$(RECORDER_SRC) $(TEMPLATES) $(TEMPLATES_STYLE)\
man/*.erl man/*.txt man/*.dia man/*.png man/Makefile man/*.sgml man/*.1 \
docs/*.rst docs/Makefile docs/*.txt docs/README docs/*.py docs/_static docs/_templates \
$(USERMANUAL) $(USERMANUAL_SRC) $(USERMANUAL_IMG) $(DTD) \
COPYING README.md LISEZMOI TODO $(CONFFILE_SRC) $(TEST_CONFFILE_SRC) \
tsung.sh.in vsn.mk src/test/*.csv src/test/*.txt \
src/test/*.out \
$(DEBIAN) $(PERL_SCRIPTS_SRC) CONTRIBUTORS CHANGELOG.md \
$(TSPLOT_SRC) $(TSUNG_PLOTTER_CONF) $(TSUNG_PLOTTER_LIB)\
configure configure.ac config.guess *.m4 config.sub Makefile.in \
install-sh tsung.spec.in tsung.spec tsung-recorder.sh.in
tar -C $(distdir) -zxf tmp.tgz
mkdir $(distdir)/ebin
tar zvcf $(distdir).tar.gz $(distdir)
rm -fr $(distdir)
rm -fr tmp.tgz
snapshot:
$(MAKE) TYPE=snapshot release
$(EBIN)/%.beam: src/test/%.erl $(INC_FILES)
@echo "Compiling test $< ... "
@$(CC) -W0 $(OPT) -I $(INC) -I $(ERLANG_XMERL_DIR) -o $(EBIN) $<
$(EBIN)/%.beam: src/lib/%.erl $(INC_FILES)
@echo "Compiling $< ... "
@$(CC) -W0 $(OPT) -I $(INC) -I $(ERLANG_XMERL_DIR) -o $(EBIN) $<
# to avoid circular dependency
$(EBIN)/ts_plugin.beam: src/$(APPLICATION)/ts_plugin.erl $(INC_FILES)
@echo "Compiling $< ... "
@$(CC) $(OPT) -I $(INC) -I $(ERLANG_XMERL_DIR) -pa $(EBIN) -o $(EBIN) $<
# to avoid circular dependency
$(EBIN)/gen_ts_transport.beam: src/$(APPLICATION)/gen_ts_transport.erl $(INC_FILES)
@echo "Compiling $< ... "
@$(CC) $(OPT) -I $(INC) -I $(ERLANG_XMERL_DIR) -pa $(EBIN) -o $(EBIN) $<
$(EBIN)/%.beam: src/$(APPLICATION)/%.erl $(INC_FILES) $(BEHAVIORS)
@echo "Compiling $< ... "
@$(CC) $(OPT) -I $(INC) -I $(ERLANG_XMERL_DIR) -pa $(EBIN) -o $(EBIN) $<
$(EBIN)/%.beam: src/$(RECORDER_APPLICATION)/%.erl $(INC_FILES) $(BEHAVIORS)
@echo "Compiling $< ... "
@$(CC) $(OPT) -I $(INC) -I $(ERLANG_XMERL_DIR) -pa $(EBIN) -o $(EBIN) $<
$(EBIN)/%.beam: src/$(CONTROLLER_APPLICATION)/%.erl $(INC_FILES) $(BEHAVIORS)
@echo "Compiling $< ... "
@$(CC) $(OPT) -I $(INC) -I $(ERLANG_XMERL_DIR) -pa $(EBIN) -o $(EBIN) $<
%:%.sh
# Override makefile default implicit rule