1include rules.$(shell uname)
2
3PATH := $(PATH):.
4
5export PATH
6
7#
8# To use this makefile:
9#
10#   "make"                    with no arguments builds the tools
11#   "make tests"              runs all the tests (1 minute at least)
12#   "sudo root make install"  installs the tools
13#   "make install_tests"      tests the installed tools
14#
15
16INSTALLABLES= covtool.exe \
17	      covmerge.exe \
18	      covannotate.exe \
19	      covtoolhelper.o \
20	      covtoolhelper_debug.o \
21	      covtoolhelper.c \
22	      README \
23	      cov++ \
24	      cov++.cfg \
25	      COPYRIGHT \
26	      covtool_version \
27	      gen_html
28
29
30install:
31	mkdir -p $(INSTALL_DIR)/bin $(INSTALL_DIR)/share/covtool $(INSTALL_DIR)/libexec/covtool
32	for f in covtool.exe covmerge.exe covannotate.exe; do \
33		mv $${f} $${f%.*} ;\
34		$(INSTALL_PROGRAM) $${f%.*} $(INSTALL_DIR)/bin ;\
35	done
36	$(INSTALL_DATA) covtoolhelper.o covtoolhelper_debug.o covtoolhelper.c $(INSTALL_DIR)/libexec/covtool
37	$(INSTALL_DATA) README COPYRIGHT covtool_version $(INSTALL_DIR)/share/covtool
38	$(INSTALL_SCRIPT) cov++ gen_html $(INSTALL_DIR)/bin
39
40install_tests:
41	cd install_test ; $(MAKE) all ; $(MAKE) tests
42	@if grep '^[-+]' install_test/covmerge.ann >/dev/null ; \
43	 then \
44	   echo "Installation test succeded" ;\
45	 else \
46	   echo "Installation test failed" ;\
47	   exit 1 ;\
48	 fi
49	 @echo ""
50	 @echo ""
51	 @echo ""
52	 @echo "You are all set.  See README for an overview of how to use the tools"
53	 @echo ""
54	 @echo ""
55	 @echo ""
56
57
58
59
60all:: covtool.exe
61all:: covtoolhelper.o
62all:: covtoolhelper_debug.o
63
64covtoolhelper_debug.o: covtoolhelper.c
65	rm -f covtoolhelper.o
66	$(MAKE) DEBUGGING=1 covtoolhelper.o
67	mv covtoolhelper.o covtoolhelper_debug.o
68	$(MAKE) covtoolhelper.o
69
70covtool.exe: covtool.o covlib.a
71	$(LN) -o $@ $+
72
73covlib.a:  covstream.o bomb.o read_database.o
74	rm -f $@
75	ar cvq $@ $+
76
77
78backup::
79	-zip -ru ../covtool.zip *
80
81clean::
82	cd example; $(MAKE) clean
83	cd install_test;  $(MAKE) clean
84	cd tests; $(MAKE) clean
85
86depend::
87	makedepend -I. -I/usr/include/g++ *.c
88
89
90
91all:: covmerge.exe
92covmerge.exe: covmerge.o read_database.o
93	$(LN) -g -o $@ covmerge.o read_database.o
94
95
96
97all:: covannotate.exe covlib.a
98covannotate.exe: covannotate.o covlib.a
99	$(LN) -o $@ covannotate.o covlib.a
100
101
102tests clean ::
103	cd tests; $(MAKE) $@
104
105
106tests::
107	cd tests; $(MAKE) icov_test
108
109
110tests clean ::
111	cd cov++_test; $(MAKE) $@
112
113clean::
114	find * -name 'core' -print | xargs rm -f
115	rm -f log log.make
116
117all::    # must be next to last
118	@echo ""
119	@echo ""
120	@echo ""
121	@echo "Now run $(MAKE) tests"
122	@echo ""
123	@echo ""
124	@echo ""
125
126tests::  # must be last
127	@echo ""
128	@echo ""
129	@echo ""
130	@echo "Now run '$(MAKE) install' as root"
131	@echo ""
132	@echo ""
133	@echo ""
134
135
136# DO NOT DELETE
137
138
139