File: rules

package info (click to toggle)
angband 283-3
  • links: PTS
  • area: non-free
  • in suites: hamm, slink
  • size: 3,548 kB
  • ctags: 5,453
  • sloc: ansic: 65,942; makefile: 204; sh: 31
file content (161 lines) | stat: -rwxr-xr-x 6,028 bytes parent folder | download
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
#!/usr/bin/make -f
############################ -*- Mode: Makefile -*- ###########################
## rules ---
## Author           : Manoj Srivastava ( srivasta@tiamat.datasync.com )
## Created On       : Sat Dec 28 18:16:05 1996
## Created On Node  : tiamat.datasync.com
## Last Modified By : Manoj Srivastava
## Last Modified On : Mon Mar  9 03:59:52 1998
## Last Machine Used: tiamat.datasync.com
## Update Count     : 51
## Status           : Unknown, Use with caution!
## HISTORY          :
## Description      :
##
###############################################################################

FILES_TO_CLEAN = debian/files angband debian/buildinfo debian/substvars
STAMPS_TO_CLEAN = stamp-configure stamp-build stamp-binary
DIRS_TO_CLEAN  = debian/tmp
thisdir=$(shell pwd)

install_file=    /usr/bin/install -p    -o root -g root  -m  644
install_program= /usr/bin/install -p    -o root -g root  -m  755
install_game=    /usr/bin/install -p    -o root -g games -m 2755
make_directory=  /usr/bin/install -p -d -o root -g root  -m  755

package = $(shell grep Source debian/control | sed 's/^Source: //')
DOCDIR := debian/tmp/usr/doc/$(package)
MANDIR := debian/tmp/usr/man/man6

# Make sure we stay in sync with the code
##LIBDIR := $(shell grep "define DEFAULT_PATH" src/config.h 2>/dev/null | \
##            sed -e 's/^.*DEFAULT_PATH *//g' -e 's/"//g')
## libdir should be /var/lib/games/angband/
LIBDIR:= var/lib/games/angband
STATICDIR:= usr/lib/games/angband
CONFLIBDIR:= etc/angband

TMPLIBDIR:= debian/tmp/$(LIBDIR)
TMPSTATICDIR:= debian/tmp/$(STATICDIR)
TMPCONFLIBDIR:= debian/tmp/$(CONFLIBDIR)

STATICLIBS=help info
DYNAMICLIBS=user bone save data apex xtra
CONFLIBS=edit file

all build: stamp-build
stamp-build:
	$(checkdir)
	-(cd lib; for dir in $(DYNAMICLIBS); do \
            test -d $$dir || $(make_directory) $$dir; \
          done)
	(cd src; $(MAKE))
	dpkg -l gcc 'libc*' binutils ldso make dpkg-dev | \
          awk '$$1 == "ii" { printf("%s-%s\n", $$2, $$3) }' > \
           debian/buildinfo
	touch stamp-build

clean:
# Undoes the effect of `make -f debian/rules build'.
	$(checkdir)
	rm -f  $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
	rm -rf $(DIRS_TO_CLEAN)
	-(cd src; $(MAKE) clean)
	rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
	  -name '*~' -o -name '*.bak' -o -name '#*#' -o \
	  -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
	  -size 0 \) -print` TAGS


binary-indep:	checkroot build
	$(checkdir)
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch: build stamp-binary

stamp-binary:
	@test root = "`whoami`" || (echo need root priviledges; exit 1)
	$(checkdir)
	-rm -rf debian/tmp
	$(make_directory)       $(DOCDIR)
	$(make_directory)       $(MANDIR)
	$(make_directory)       $(TMPLIBDIR)
	$(make_directory)       $(TMPSTATICDIR)
	$(make_directory)       $(TMPCONFLIBDIR)
	$(make_directory)       debian/tmp/DEBIAN
	$(make_directory)       debian/tmp/usr/games
	$(make_directory)       debian/tmp/usr/lib/menu
	$(install_game)         angband debian/tmp/usr/games/angband
	(cd $(TMPLIBDIR);       $(make_directory) $(STATICLIBS) \
                                    $(DYNAMICLIBS) $(CONFLIBS))
	(cd lib; tar cf -       $(DYNAMICLIBS)) |  (cd $(TMPLIBDIR); tar xf -)
	(cd lib; tar cf -       $(STATICLIBS)) | (cd $(TMPSTATICDIR); tar xf -)
	(cd lib; tar cf -       $(CONFLIBS)) |  (cd $(TMPCONFLIBDIR); tar xf -)
	(cd $(TMPLIBDIR);      \
          for dir in $(STATICLIBS); do \
	    ( cd $$dir; \
            for file in ../../../../../$(STATICDIR)/$$dir/*; \
              do ln -s /$(STATICDIR)/$$dir/`basename $$file` . ; done; ); \
          done ;)
	(cd $(TMPLIBDIR);      \
          for dir in $(CONFLIBS); do \
	    (cd $$dir; \
            for file in ../../../../../$(CONFLIBDIR)/$$dir/*; do \
              ln -s /$(CONFLIBDIR)/$$dir/`basename $$file` . ; \
            done;); \
          done;)
	rm -f debian/conffiles
	(cd $(TMPCONFLIBDIR); \
           for dir in $(CONFLIBS); do \
	    (cd $$dir; \
            for file in *; do \
              echo /$(CONFLIBDIR)/$$dir/$$file >> $(thisdir)/debian/conffiles; \
            done;); \
          done;)
	$(install_file)         debian/README.edit   $(TMPCONFLIBDIR)
	$(install_file)         debian/README.file   $(TMPCONFLIBDIR)
	$(install_file)         debian/conffiles     debian/tmp/DEBIAN/conffiles
	$(install_file)         README               $(DOCDIR)
	$(install_file)         debian/changelog     $(DOCDIR)/changelog.Debian
	$(install_file)         debian/README.debian $(DOCDIR)/
	$(install_file)         debian/Xresources    $(DOCDIR)/
	$(install_file)         debian/buildinfo     $(DOCDIR)/buildinfo.Debian
	$(install_file)         src/angband.man      $(MANDIR)/angband.6
	gzip -9fqr              $(DOCDIR)
	gzip -9fqr              $(MANDIR)
# Make sure the copyright file is not compressed
	$(install_file)         debian/copyright     $(DOCDIR)/
	chown -R root.games     $(TMPLIBDIR)
	chmod -R gu+w           $(TMPLIBDIR)/*
	chown -R root.root      $(TMPSTATICDIR) $(TMPCONFLIBDIR)
	$(install_file)         debian/menuentry \
	                         debian/tmp/usr/lib/menu/$(package)
	$(install_program)      debian/postinst \
                                debian/tmp/DEBIAN/postinst
	$(install_program)      debian/postrm \
                                debian/tmp/DEBIAN/postrm
	dpkg-shlibdeps          debian/tmp/usr/games/angband
	dpkg-gencontrol
	chown -R root.root      debian/tmp/DEBIAN debian/tmp/usr/doc
	chmod -R go=rX          debian/tmp/DEBIAN debian/tmp/usr/doc
	dpkg --build            debian/tmp ..

define checkdir
	test -f src/angband.h -a -f debian/rules
endef

# Below here is fairly generic really

binary:		binary-indep binary-arch

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

checkroot:
	$(checkdir)
	test root = "`whoami`" || (echo need root priviledges; exit 1)

.PHONY: binary binary-arch binary-indep clean checkroot