38168531204b4e0aea0cea353962e0288013e7a5
[pkg/netris.git] / debian / rules
1 #!/usr/bin/make -f
2 # rules file for netris
3 # copyright 2002++ by Gerfried Fuchs <rhonda@debian.at>
4 # Licenced the same way as netris itself
5
6 COPT = -g
7 INSTALL = install
8 INSTALL_FILE    = $(INSTALL) -p    -oroot -groot -m644
9 INSTALL_PROGRAM = $(INSTALL) -p    -oroot -groot -m755
10 INSTALL_SCRIPT  = $(INSTALL) -p    -oroot -groot -m755
11 INSTALL_DIR     = $(INSTALL) -p -d -oroot -groot -m755
12
13 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
14         COPT += -O0
15 else
16         COPT += -O2
17 endif
18 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
19         INSTALL_PROGRAM += -s
20 endif
21
22
23 include /usr/share/quilt/quilt.make
24
25 clean: unpatch
26         $(checkdir)
27         $(checkroot)
28         -rm -rf debian/netris debian/substvars debian/files \
29                 build-stamp install-stamp config.h .depend
30         [ ! -f Makefile ] || $(MAKE) clean
31         -rm -rf Makefile
32
33
34 build: build-stamp
35 build-stamp: patch
36         $(checkdir)
37         ./Configure -g
38         $(MAKE) COPT="$(COPT)"
39         touch build-stamp
40
41
42 install: install-stamp
43 install-stamp: build
44         $(checkdir)
45         $(checkroot)
46         -rm -rf debian/netris
47         $(INSTALL_DIR) debian/netris
48         cd debian/netris && $(INSTALL_DIR) usr/games usr/share/man/man6 \
49                 usr/share/doc/netris/examples
50         $(INSTALL_PROGRAM) netris debian/netris/usr/games
51         $(INSTALL_PROGRAM) sr     debian/netris/usr/games/netris-sample-robot
52         $(INSTALL_FILE) debian/netris*.6 debian/netris/usr/share/man/man6
53         $(INSTALL_FILE) FAQ robot_desc   debian/netris/usr/share/doc/netris
54         $(INSTALL_FILE) sr.c debian/netris/usr/share/doc/netris/examples
55         gzip -9 debian/netris/usr/share/man/man6/netris*.6 \
56                 debian/netris/usr/share/doc/netris/FAQ \
57                 debian/netris/usr/share/doc/netris/robot_desc \
58                 debian/netris/usr/share/doc/netris/examples/sr.c
59         touch install-stamp
60
61
62 # Build architecture-independent files here.
63 binary-indep: build
64 # We have nothing to do by default.
65
66
67 # Build architecture-dependent files here.
68 binary-arch: build install
69         $(checkdir)
70         $(checkroot)
71         $(INSTALL_DIR) debian/netris/DEBIAN debian/netris/usr/share/menu
72         $(INSTALL_FILE) debian/menu      debian/netris/usr/share/menu/netris
73         $(INSTALL_FILE) debian/copyright debian/README.Debian \
74                 debian/netris/usr/share/doc/netris
75         $(INSTALL_FILE) debian/changelog \
76                 debian/netris/usr/share/doc/netris/changelog.Debian
77         gzip -9 debian/netris/usr/share/doc/netris/changelog.Debian
78         $(INSTALL_SCRIPT) debian/postinst debian/postrm \
79                 debian/netris/DEBIAN
80         dpkg-shlibdeps -Tdebian/substvars -dDepends \
81                 debian/netris/usr/games/netris*
82         dpkg-gencontrol -ldebian/changelog -isp -Tdebian/substvars -pnetris \
83                 -Pdebian/netris
84         cd debian/netris && find * -type f ! -regex '^DEBIAN/.*' -print0 | \
85                 xargs -r0 md5sum > DEBIAN/md5sums
86         dpkg --build debian/netris ..
87
88
89 binary: binary-indep binary-arch
90
91 define checkdir
92         test -f debian/rules
93 endef
94
95 define checkroot
96         test root = "`whoami`"
97 endef
98
99 .PHONY: clean build install binary-indep binary-arch binary