1#*****************************************************************************
2# DESCRIPTION: Dinotrace: Makefile pre-configure version
3#
4# This file is part of Dinotrace.
5#
6# Author: Wilson Snyder <wsnyder@wsnyder.org>
7#
8# Code available from: http://www.veripool.org/dinotrace
9#
10#*****************************************************************************
11#
12# This file is covered by the GNU public licence.
13#
14# Dinotrace is free software; you can redistribute it and/or modify
15# it under the terms of the GNU General Public License as published by
16# the Free Software Foundation; either version 3, or (at your option)
17# any later version.
18#
19# Dinotrace is distributed in the hope that it will be useful,
20# but WITHOUT ANY WARRANTY; without even the implied warranty of
21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22# GNU General Public License for more details.
23#
24# You should have received a copy of the GNU General Public License
25# along with Dinotrace; see the file COPYING.  If not, write to
26# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
27# Boston, MA 02111-1307, USA.
28#
29#****************************************************************************/
30#
31# make all	to compile and build Dinotrace.
32# make install	to install it.
33# make TAGS	to update tags tables.
34#
35# make clean  or  make mostlyclean
36#      Delete all files from the current directory that are normally
37#      created by building the program.	 Don't delete the files that
38#      record the configuration.  Also preserve files that could be made
39#      by building, but normally aren't because the distribution comes
40#      with them.
41#
42# make distclean
43#      Delete all files from the current directory that are created by
44#      configuring or building the program.  If you have unpacked the
45#      source and built the program without creating any other files,
46#      `make distclean' should leave only the files that were in the
47#      distribution.
48#
49# make maintainer-clean
50#      Delete everything from the current directory that can be
51#      reconstructed with this Makefile.  This typically includes
52#      everything deleted by distclean, plus more: C source files
53#      produced by Bison, tags tables, info files, and so on.
54#
55# make extraclean
56#      Still more severe - delete backup and autosave files, too.
57
58#### Start of system configuration section. ####
59
60abs_srcdir = @abs_srcdir@
61srcdir = @srcdir@
62VPATH = @srcdir@
63HOST = @HOST@
64
65INSTALL = @INSTALL@
66INSTALL_PROGRAM = @INSTALL_PROGRAM@
67INSTALL_DATA = @INSTALL_DATA@
68MAKEINFO = makeinfo
69TEXI2DVI = texi2dvi
70PERL = @PERL@
71
72#### Don't edit: You're much better using configure switches to set these
73prefix = @prefix@
74exec_prefix = @exec_prefix@
75
76# Directory in which to install scripts.
77bindir = @bindir@
78
79# Directory in which to install library files.
80datadir = @datadir@
81
82# Directory in which to install documentation info files.
83infodir = @infodir@
84
85# Directory in which to install package specific files
86# Note this gets coded into src/config.h also
87pkgdatadir = @pkgdatadir@
88
89#### End of system configuration section. ####
90######################################################################
91
92SHELL = /bin/sh
93
94SUBDIRS = src lisp
95
96INFOS = dinotrace.info INSTALL FAQ dinotrace.txt
97
98CPPCHECK = cppcheck
99CPPCHECK_FLAGS = --enable=all --suppress=variableScope --inline-suppr
100
101# Files that can be generated, but should be up to date for a distribution.
102DISTDEP = $(INFOS) Makefile src/dinodoc.pl src/dist_date.pl
103# Files to distribute.
104DISTBIN = $(wildcard bin/dinotrace-*)
105DISTFILES = $(INFOS) COPYING Changes TODO configure *.in *.ac \
106	config.sub \
107	install-sh mkinstalldirs *.texi *.com \
108	html_texi_clean \
109	src/*.in src/*.h src/*.c src/*.pl src/*.com lisp/* traces/* \
110	$(DISTBIN)
111
112all: dinotrace_exe info
113
114obj_dir:
115	-mkdir -p $@
116obj_dbg:
117	-mkdir -p $@
118bin:
119	-mkdir -p bin
120
121.PHONY:dinotrace_exe
122.PHONY:dinotrace_dbg
123.PHONY:dinotrace
124dinotrace_exe dinotrace: obj_dir bin
125	@echo making dinotrace in obj_dir
126	cd obj_dir && $(MAKE) -f $(abs_srcdir)/src/Makefile dinotrace
127	(cp obj_dir/dinotrace ./dinotrace >/dev/null 2>&1\
128	 || cp obj_dir/dinotrace.exe ./dinotrace.exe >/dev/null 2>&1)
129	(cp obj_dir/dinotrace bin/dinotrace-$(HOST) >/dev/null 2>&1\
130	 || cp obj_dir/dinotrace.exe bin/dinotrace-$(HOST).exe >/dev/null 2>&1)
131
132dinotrace_dbg: obj_dbg
133	@echo making dinotrace in obj_dbg
134	cd obj_dbg && $(MAKE) DT_DEBUG=1 -f $(abs_srcdir)/src/Makefile dinotrace
135	(cp obj_dbg/dinotrace ./dinotrace_dbg >/dev/null 2>&1\
136	 || cp obj_dbg/dinotrace.exe ./dinotrace_dbg.exe >/dev/null 2>&1)
137
138cppcheck: obj_dbg
139	cd obj_dbg && $(CPPCHECK) $(CPPCHECK_FLAGS) -DDEBUG -I$(srcdir) ..
140
141info: $(INFOS)
142
143# Use --no-split to avoid creating filenames > 14 chars.
144dinotrace.info: dinotrace.texi
145	$(MAKEINFO) -I$(srcdir) $(srcdir)/dinotrace.texi --no-split --output=$@
146
147dinotrace.txt: dinotrace.texi
148	$(MAKEINFO) -I$(srcdir) $(srcdir)/dinotrace.texi --output=$@ \
149	--no-headers --no-validate
150
151INSTALL: install.texi
152	$(MAKEINFO) -I$(srcdir) $(srcdir)/install.texi --output=$@ \
153	--no-headers --no-validate
154
155FAQ: faq.texi
156	$(MAKEINFO) -I$(srcdir) $(srcdir)/faq.texi --output=$@ \
157	--no-headers --no-validate
158
159%.html: %.texi
160	perl html_texi_clean $*.texi >$*.tmp
161	texi2html -monolithic $*.tmp
162	mv $*.tmp.html $*.html
163	rm $*.tmp
164
165dvi: dinotrace.dvi
166
167dinotrace.dvi: dinotrace.texi
168	$(TEXI2DVI) $(srcdir)/dinotrace.texi
169
170installdirs:
171	$(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(infodir)
172
173install: all info installdirs install-info
174	for p in dinotrace; do \
175	  $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \
176	done
177	@echo ""
178	@echo "*** Lisp files not installed, you may want to"
179	@echo "*** cd lisp ; make install"
180	@echo ""
181	@echo "Type 'setenv DISPLAY :0.0' then 'dinotrace' to test."
182
183# Don't cd, to avoid breaking install-sh references.
184install-info: info installdirs
185	for i in *.info*; do \
186	  $(INSTALL_DATA) $$i $(DESTDIR)$(infodir)/$$i; \
187	done
188
189uninstall:
190	cd $(DESTDIR)$(bindir)  && rm -f dinotrace
191	cd $(DESTDIR)$(infodir) && rm -f dinotrace.info*
192
193# autoheader might not change config.h.in, so touch a stamp file.
194${srcdir}/config.h.in: stamp-h.in
195${srcdir}/stamp-h.in: configure.ac Makefile.in ${srcdir}/Makefile.in ${srcdir}/config.h.in
196	cd ${srcdir} && autoheader
197	echo timestamp > ${srcdir}/stamp-h.in
198config.h: stamp-h
199stamp-h: config.h.in config.status
200	./config.status
201Makefile: Makefile.in config.status
202	./config.status
203src/Makefile: src/Makefile.in config.status
204	./config.status
205config.status: configure
206	./config.status --recheck
207configure: configure.ac
208	autoconf
209
210maintainer-clean::
211	@echo "This command is intended for maintainers to use;"
212	@echo "rebuilding the deleted files requires makeinfo."
213	rm -f *.info* $(INFOS) faq.html dinotrace.html configure bin/*
214
215clean mostlyclean distclean maintainer-clean maintainer-copy::
216	for dir in $(SUBDIRS); do \
217	  echo making $@ in $$dir ; \
218	  (cd $$dir && $(MAKE) $@) ; \
219	done
220
221clean mostlyclean distclean maintainer-clean::
222	rm -rf obj_*
223	rm -f $(SCRIPTS) *.tmp
224	rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.log
225	rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs
226	rm -f *.ev *.evs *.ov *.ovs *.cv *.cvs *.ma *.mas
227
228distclean maintainer-clean::
229	rm -f Makefile config.status config.cache config.log dinotrace dinotrace.exe TAGS
230	rm -rf autom4te.cache
231
232TAGFILES=${srcdir}/src/*.c ${srcdir}/src/*.h ${srcdir}/src/[a-z]*.in \
233	${srcdir}/[a-z]*.in ${srcdir}/*.texi
234
235TAGS:	$(TAGFILES)
236	etags $(TAGFILES)
237
238tag:
239	distname=`sed -e '/DTVERSION/!d' \
240	-e 's/[^0-9]*\([0-9.a-z]*\).*/dinotrace_\1/' \
241	-e 's/[^A-Za-z0-9]/_/g' \
242	-e q src/config.h.in`; \
243	svnorcvs tag $$distname
244
245valgrind: dinotrace
246	valgrind --suppressions=$(HOME)/.valgrind.supp ./dinotrace
247
248# Don't depend on DISTFILES because there's no rule for "standards.info*".
249dist: $(DISTDEP) maintainer-copy
250	distname=`sed -e '/DTVERSION/!d' \
251	-e 's/[^0-9]*\([0-9.a-z]*\).*/dinotrace-\1/' -e q src/config.h.in`; \
252	rm -fr $$distname; \
253	mkdir $$distname $$distname/src $$distname/lisp $$distname/traces $$distname/bin; \
254	for file in $(DISTFILES); do \
255	  ln $$file $$distname/$$file \
256	  || { echo copying $$file instead; cp -p $$file $$distname/$$file;}; \
257	done; \
258	chmod -R a+r $$distname; \
259	tar chf $$distname.tar $$distname; \
260	gzip --force --best $$distname.tar; \
261	rm -fr $$distname; \
262
263maintainer-dist: dist tag
264	echo "****** Did you rebuild all versions in .../bin ?"
265	svnorcvs release *.gz
266
267maintainer-diff:
268	distname=`sed -e '/DTVERSION/!d' \
269	-e 's/[^0-9]*\([0-9.a-z]*\).*/dinotrace_\1/' \
270	-e 's/[^A-Za-z0-9]/_/g' \
271	-e q src/config.h.in`; \
272	svnorcvs diff $$distname
273
274