File: rules

package info (click to toggle)
hugs98 98.200109-5
  • links: PTS
  • area: main
  • in suites: woody
  • size: 3,344 kB
  • ctags: 5,368
  • sloc: ansic: 42,923; haskell: 6,574; xml: 1,143; yacc: 1,119; makefile: 332; sh: 260
file content (115 lines) | stat: -rwxr-xr-x 3,663 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
#! /usr/bin/make -f
# -*- Makefile -*-

# Written by Antti-Juhani Kaijanaho <ajk@debian.org>.  Use, distribute
# and modify as you please.

# Modified slightly by William Irwin <wli@debian.org>

install := install -o root -g root
install_exec := $(install) -m 755 -s
install_dir := $(install) -m 755 -d
install_nonex = $(install) -m 644
install_script := $(install) -m 755
install_zipped := false
install_symlink = ln -s
GZIP := gzip -9v

tmpdir    := $(shell pwd)/debian/tmp
# These must not be :='s
rootdir    = $(tmpdir)/$(package)
docdir     = $(rootdir)/usr/share/doc/$(package)
sharedir   = $(rootdir)/usr/share
includedir = $(rootdir)/usr/include
mandir     = $(rootdir)/usr/share/man
man1dir    = $(mandir)/man1

build: debian/build.stamp
debian/build.stamp:
	$(checkdir)
	cd src/unix && make config hugsdir=/usr/share/hugs98 HUGSDIR=/usr/share/hugs98 \
		OPTS="--prefix=/usr --datadir=/usr/share --with-readline --mandir=$(mandir)"
	cd src && $(MAKE) HUGSDIR=/usr/share/hugs98 hugsdir=/usr/share/hugs98 CFLAGS+=-DHUGSDIR='\"/usr/share/hugs98\"'
	touch $@

binary: binary-arch binary-indep

binary-indep: debian/binary-indep.stamp
 debian/binary-indep.stamp:
	touch $@

binary-arch: debian/binary-arch.stamp
debian/binary-arch.stamp: package=hugs
debian/binary-arch.stamp: debian/build.stamp
	$(checkdir)
#	Create the filesystem
	$(RM) -r $(rootdir)
	$(install_dir) $(rootdir)
	$(install_dir) $(rootdir)/DEBIAN
	$(install_dir) $(docdir)
#	Install copyright file.
	$(install_nonex) debian/copyright $(docdir)
#	Install the change logs.
	$(install_nonex) debian/changelog $(docdir)/changelog.Debian
	$(GZIP) $(docdir)/changelog.Debian
#	Install the installation scripts
	$(install_script) debian/preinst debian/postinst \
	                  debian/prerm debian/postrm \
	  $(rootdir)/DEBIAN
#	Install the Green Card header file
	$(install_dir) $(includedir)/hugs
	$(install_nonex) src/GreenCard.h src/config.h src/options.h \
	  $(includedir)/hugs
#	Install the menu file
	$(install_dir) $(rootdir)/usr/lib/menu
	$(install_nonex) debian/menu \
	  $(rootdir)/usr/lib/menu/$(package)
#	Install the system.
	cd src && $(MAKE) prefix=$(rootdir)/usr \
	                               hugsdir=$(sharedir)/hugs98 \
	                           install
	chmod -R 644 $(sharedir)/hugs98
	chmod -R a+X $(sharedir)/hugs98
	strip -R .comment -R .note --strip-all $(rootdir)/usr/bin/*
	cd $(rootdir)/usr/bin && mv hugs hugs98 && mv runhugs runhugs98
	cd $(rootdir)/usr/bin && $(install_symlink) hugs98 hugs \
	  && $(install_symlink) runhugs98 runhugs
#	Move the supporting documentation to place
	$(install_dir) $(docdir)/examples
	$(install_nonex) debian/README.Debian $(docdir)
	mv $(sharedir)/hugs98/demos/* $(docdir)/examples
	rmdir $(sharedir)/hugs98/demos
#	Install the manual page
	$(install_dir) $(man1dir)
	$(install_nonex) docs/hugs.1 $(man1dir)
	$(install_nonex) docs/runhugs.1 $(man1dir)
	$(GZIP) $(man1dir)/hugs.1
	$(GZIP) $(man1dir)/runhugs.1
	-rm -f $(man1dir)/hugs.1 $(man1dir)/runhugs.1
#	Generate the binary control file.
	dpkg-shlibdeps $(rootdir)/usr/bin/*
	dpkg-gencontrol -isp -P$(rootdir)
#	Fix permissions.
	chown -R root.root $(rootdir)
	chmod -R g-ws $(rootdir)
#	Genearate the deb.
	dpkg --build $(rootdir) ..
	touch $@

define checkdir
	test -f Install -a -f debian/rules
endef

clean: clean-build clean-binary

clean-binary:
	$(RM) debian/binary-*.stamp
	$(RM) -r debian/tmp
	$(RM) debian/*~ debian/files debian/substvars


clean-build:
	-$(RM) debian/build*.stamp
	set -e ; cd src && if [ -e Makefile ] ; then $(MAKE) veryclean ; fi
	-cd src/unix && $(RM) config.log config.cache config.status
	-cd src && $(RM) Makefile config.h options.h