File: rules

package info (click to toggle)
bclock 1.0-12
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 144 kB
  • ctags: 787
  • sloc: makefile: 904; ansic: 710; sh: 4
file content (100 lines) | stat: -rwxr-xr-x 2,319 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
#!/usr/bin/make -f

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

package		= bclock
rootdir		= `pwd`/debian/tmp
docdir		= $(rootdir)/usr/share/doc/$(package)
bindir		= $(rootdir)/usr/bin
mandir		= $(rootdir)/usr/share/man
man1dir		= $(mandir)/man1
menudir		= $(rootdir)/usr/share/menu

CFLAGS = -g -Wall
ifneq (,$(findstring noopt, $(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif

#ifneq (,$(findstring debug, $(DEB_BUILD_OPTIONS)))
#CFLAGS += -g
#endif

ifeq (,$(findstring nostrip, $(DEB_BUILD_OPTIONS)))
install_exec += -s
NOSTRIP = true
endif

build: debian/build.stamp
debian/build.stamp:
	$(checkdir)
	xmkmf -a
	CDEBUGFLAGS="${CFLAGS}" $(MAKE)
	touch $@

clean-build:
	$(RM) debian/build*.stamp
	-$(MAKE) clean

binary: binary-arch binary-indep

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

binary-arch: debian/binary-arch.stamp
debian/binary-arch.stamp: build
	$(checkdir)
	$(RM) -r $(rootdir)
	$(install_dir) $(rootdir)/DEBIAN
	$(install_dir) $(docdir)
	$(install_dir) $(bindir)
	$(install_dir) $(man1dir)
	$(install_dir) $(menudir)
	# binary
	$(install_exec) bclock $(bindir)
	if [ -n ${NOSTRIP} ]; then \
	  strip --remove-section=.comment --remove-section=.note $(bindir)/bclock ; fi
	# changelog
	$(install_nonex) debian/changelog $(docdir)/changelog.Debian
	# docs
	$(install_nonex) README $(docdir)
	gzip -9fr $(docdir)/
	# copyright
	$(install_nonex) debian/copyright $(docdir)
	# menu
	$(install_nonex) debian/menu $(menudir)/$(package)
	# manpage
	$(install_nonex) bclock.man $(man1dir)/bclock.1
	gzip -9f $(man1dir)/bclock.1
	# control
	$(install_script) debian/postinst debian/postrm $(rootdir)/DEBIAN
	dpkg-shlibdeps $(bindir)/bclock
	dpkg-gencontrol -isp
	# fixperms
	chown -R root.root $(rootdir)
	chmod -R g-ws $(rootdir)
	# deb
	dpkg --build $(rootdir) ..
	touch binary-arch

define checkdir
	test -f bclock.c -a -f debian/rules
endef

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

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

clean: clean-build clean-binary