Debian Codegraph @

src/Makefile

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 MKPATH=../mk/
2 include $(MKPATH)buildsys.mk
3
4 # import source list
5 include Makefile.src
6 INCLUDE = $(HDRS) $(INCS)
7 OBJECTS = $(ANGFILES) $(ZFILES)
8 SRCS = ${OBJECTS:.o=.c} ${MAINFILES:.o=.c}
9 PROG = $(PROGNAME)$(PROG_SUFFIX)
10 # Will dynamically generate version.h with the build number.
11 CFLAGS += -DHAVE_VERSION_H -DALLOW_BORG
12
13 CFLAGS += -I. -fPIC -std=c99 -O0
14 # Replace above line with the two below and then look at gmon.out
15 # to do performance monitoring
16 # CFLAGS += -g -pg -I. -fPIC -std=c99 -O0
17 # LDFLAGS += -g -pg
18
19 # gcov intermediate data
20 GCOBJS = $(OBJECTS:.o=.gcno) $(OBJECTS:.o=.gcda)
21 GCOVS = $(OBJECTS:.o=.c.gcov)
22
23 CLEAN = angband.o $(OBJECTS) win/angband.res version.h
24 DISTCLEAN = autoconf.h tests/.deps
25
26 $(PROG): $(PROGNAME).o $(MAINFILES)
27 $(CC) -o $@ $(PROGNAME).o $(MAINFILES) $(LDFLAGS) $(LDADD) $(LIBS)
28
29 win/$(PROGNAME).res: win/$(PROGNAME).rc
30 $(RC) $< -O coff -o $@
31
32 $(PROGNAME).o: $(OBJECTS)
33 $(LD) $(LDFLAGS) -nostdlib -r -o $@ $(OBJECTS)
34
35 tests: $(PROGNAME).o
36 env CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
37 LDFLAGS="$(LDFLAGS)" LDADD="$(LDADD)" LIBS="$(LIBS)" \
38 $(MAKE) -C tests all
39
40 test-depgen:
41 env CC="$(CC)" $(MAKE) -C tests depgen
42
43 test-clean:
44 env RM="$(RM)" $(MAKE) -C tests clean
45
46 # Hack to descend into tests and clean since it isn't included in SUBDIRS.
47 pre-clean: test-clean
48
49 # Track the build number in the dynamically generated file, version.h.
50 # Use INSTALL_STATUS/INSTALL_OK from buildsys in lieu of something more
51 # appropriate for automatically generated source files.
52 version.h: FORCE
53 @xversion=`../scripts/version.sh` ; \
54 i="$@" ; \
55 if test -r "$$i" ; then \
56 xoldversion=`grep -E '^/\*"' "$$i" | sed -e 's%^/\*"%%' -e 's%"\*/$$%%' -e 'q'` ; \
57 else \
58 xoldversion=x$$xversion ; \
59 fi ; \
60 if test "x$$xversion" != "x$$xoldversion" ; then \
61 ${INSTALL_STATUS} ; \
62 echo "#ifndef VERSION_H" > "$$i" ; \
63 echo "#define VERSION_H" >> "$$i" ; \
64 echo '/*"'"$$xversion"'"*/' >> "$$i" ; \
65 echo " $$xversion" | sed -e '/^[ \t\r]$$/q' -e 's/^ /#define VERSION_STRING "/' -e 's/$$/"/' -e 'q' >> "$$i" ; \
66 echo "#endif" >> "$$i" ; \
67 ${INSTALL_OK} ; \
68 fi
69
70 # Since version.h is dynamically generated, explicitly specify everything that
71 # depends on it.
72 buildid.o: version.h
73
74 splint:
75 splint -f .splintrc ${OBJECTS:.o=.c} main.c main-gcu.c
76
77 clean-coverage:
78 rm -f tests/ran-already
79 rm -f $(GCOVS) $(GCOBJS)
80
81 coverage: CFLAGS+=-fprofile-arcs -ftest-coverage
82 coverage: LDFLAGS+=-lgcov
83 coverage: clean-coverage clean gen-covs
84
85 tests/ran-already : tests
86 touch $@
87
88 gen-covs: tests/ran-already $(GCOVS)
89 ./gen-coverage $(GCOVS)
90
91 %.gcov: %
92 (gcov -o $(dir $^) -p $^ >/dev/null)
93
94 install-extra:
95 # For Windows, copy the executable and the DLLs it needs.
96 if test x"${ENABLEWIN}" = xyes ; then \
97 for i in ${PROG} ; do \
98 ${INSTALL_STATUS}; \
99 if ${INSTALL} -m 755 $$i ../$$i ; then \
100 ${INSTALL_OK}; \
101 else \
102 ${INSTALL_FAILED}; \
103 fi \
104 done ; \
105 for i in zlib1.dll libpng12.dll ; do \
106 ${INSTALL_STATUS}; \
107 if ${INSTALL} -m 644 win/dll/$$i ../$$i ; then \
108 ${INSTALL_OK}; \
109 else \
110 ${INSTALL_FAILED}; \
111 fi \
112 done \
113 fi
114
115 post-install:
116 # For a shared installation, set appropriate owner for executable
117 # and mark it as setgid.
118 if [ "x$(SETEGID)" != "x" ]; then \
119 ${INSTALL_STATUS}; \
120 if chown root:${SETEGID} ${DESTDIR}${bindir}/${PROG} && chmod g+s ${DESTDIR}${bindir}/${PROG} ; then \
121 ${INSTALL_OK}; \
122 else \
123 ${INSTALL_FAILED}; \
124 fi \
125 fi
126
127 FORCE :
128 .PHONY : tests coverage clean-coverage tests/ran-already