Debian Codegraph @

src/Makefile

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
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 @printf "%10s %-20s\n" LINK $@
29
30 win/$(PROGNAME).res: win/$(PROGNAME).rc
31 $(RC) $< -O coff -o $@
32
33 $(PROGNAME).o: $(OBJECTS)
34 $(LD) $(LDFLAGS) -nostdlib -r -o $@ $(OBJECTS)
35 @printf "%10s %-20s\n" LINK $@
36
37 tests: $(PROGNAME).o
38 env CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
39 LDFLAGS="$(LDFLAGS)" LDADD="$(LDADD)" LIBS="$(LIBS)" \
40 $(MAKE) -C tests all
41
42 test-depgen:
43 env CC="$(CC)" $(MAKE) -C tests depgen
44
45 test-clean:
46 env RM="$(RM)" $(MAKE) -C tests clean
47
48 # Hack to descend into tests and clean since it isn't included in SUBDIRS.
49 pre-clean: test-clean
50
51 # Track the build number in the dynamically generated file, version.h.
52 # Use INSTALL_STATUS/INSTALL_OK from buildsys in lieu of something more
53 # appropriate for automatically generated source files.
54 version.h: FORCE
55 @xversion=`../scripts/version.sh` ; \
56 i="$@" ; \
57 if test -r "$$i" ; then \
58 xoldversion=`grep -E '^/\*"' "$$i" | sed -e 's%^/\*"%%' -e 's%"\*/$$%%' -e 'q'` ; \
59 else \
60 xoldversion=x$$xversion ; \
61 fi ; \
62 if test "x$$xversion" != "x$$xoldversion" ; then \
63 ${INSTALL_STATUS} ; \
64 echo "#ifndef VERSION_H" > "$$i" ; \
65 echo "#define VERSION_H" >> "$$i" ; \
66 echo '/*"'"$$xversion"'"*/' >> "$$i" ; \
67 echo " $$xversion" | sed -e '/^[ \t\r]$$/q' -e 's/^ /#define VERSION_STRING "/' -e 's/$$/"/' -e 'q' >> "$$i" ; \
68 echo "#endif" >> "$$i" ; \
69 ${INSTALL_OK} ; \
70 fi
71
72 # Since version.h is dynamically generated, explicitly specify everything that
73 # depends on it.
74 buildid.o: version.h
75
76 splint:
77 splint -f .splintrc ${OBJECTS:.o=.c} main.c main-gcu.c
78
79 clean-coverage:
80 rm -f tests/ran-already
81 rm -f $(GCOVS) $(GCOBJS)
82
83 coverage: CFLAGS+=-fprofile-arcs -ftest-coverage
84 coverage: LDFLAGS+=-lgcov
85 coverage: clean-coverage clean gen-covs
86
87 tests/ran-already : tests
88 touch $@
89
90 gen-covs: tests/ran-already $(GCOVS)
91 ./gen-coverage $(GCOVS)
92
93 %.gcov: %
94 (gcov -o $(dir $^) -p $^ >/dev/null)
95
96 install-extra:
97 # For Windows, copy the executable and the DLLs it needs.
98 if test x"${ENABLEWIN}" = xyes ; then \
99 for i in ${PROG} ; do \
100 ${INSTALL_STATUS}; \
101 if ${INSTALL} -m 755 $$i ../$$i ; then \
102 ${INSTALL_OK}; \
103 else \
104 ${INSTALL_FAILED}; \
105 fi \
106 done ; \
107 for i in zlib1.dll libpng12.dll ; do \
108 ${INSTALL_STATUS}; \
109 if ${INSTALL} -m 644 win/dll/$$i ../$$i ; then \
110 ${INSTALL_OK}; \
111 else \
112 ${INSTALL_FAILED}; \
113 fi \
114 done \
115 fi
116
117 post-install:
118 # For a shared installation, set appropriate owner for executable
119 # and mark it as setgid.
120 if [ "x$(SETEGID)" != "x" ]; then \
121 ${INSTALL_STATUS}; \
122 if chown root:${SETEGID} ${DESTDIR}${bindir}/${PROG} && chmod g+s ${DESTDIR}${bindir}/${PROG} ; then \
123 ${INSTALL_OK}; \
124 else \
125 ${INSTALL_FAILED}; \
126 fi \
127 fi
128
129 FORCE :
130 .PHONY : tests coverage clean-coverage tests/ran-already