File: rules

package info (click to toggle)
libident 0.22-3.1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 124 kB
  • ctags: 97
  • sloc: ansic: 1,041; makefile: 203; sh: 14
file content (114 lines) | stat: -rwxr-xr-x 3,650 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
# -*- makefile -*-

package  = $(shell grep "^Package: "  debian/control  |head -n 1|sed 's/Package: \(.*\)/\1/g')
source   = $(shell grep "^Source: "   debian/control  |head -n 1|sed 's/Source: \(.*\)/\1/g')
version  = $(shell grep "^$(source) " debian/changelog|head -n 1|sed 's/.*(\(.*\)\-[^\-]*).*/\1/g')
revision = $(shell grep "^$(source) " debian/changelog|head -n 1|sed 's/.*([^\-]*\-\(.*\)).*/\1/g')

installexe = install -g root -o root -m 755
installbin = $(installexe)
installdoc = install -g root -o root -m 644

tmpdir     = $(shell pwd)/debian/tmp
tmpdir-dev = $(tmpdir)-dev
instdirs   = $(tmpdir) \
	     $(tmpdir)/DEBIAN \
	     $(tmpdir)/usr/share/doc/libident \
	     $(tmpdir)/usr/sbin \
	     $(tmpdir)/usr/lib \
	     $(tmpdir)/usr/share/man/man8 \
	     $(tmpdir-dev) \
	     $(tmpdir-dev)/DEBIAN \
	     $(tmpdir-dev)/usr \
	     $(tmpdir-dev)/usr/share/doc \
	     $(tmpdir-dev)/usr/include \
	     $(tmpdir-dev)/usr/lib \
	     $(tmpdir-dev)/usr/share/man/man3

CC=gcc
CFLAGS=-g -Wall -DHAVE_ANSIHEADERS -D_REENTRANT
LDFLAGS=

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
    CFLAGS += -O0
else
    CFLAGS += -O2
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
    installbin += -s
endif

build:
	$(checkdir)
	echo 'char _id_version[] = "libident' $(version) Debian $(debian)'";' \
		>version.c
	$(MAKE) all INSTROOT=/usr CC="$(CC)" CFLAGS="$(CFLAGS)"
	$(MAKE) testers CC="$(CC)" CFLAGS="$(CFLAGS)"
	touch build

clean:
	$(checkdir)
	-rm -f build stamp-build
	-$(MAKE) -i clean
	-rm -rf *~ debian/tmp* debian/*~ debian/files* \
		debian/substvars* *.orig ./#*#

binary-indep: 
# None
	@echo 'No independent package components.' ; false

binary binary-arch:	checkroot build $(instdirs)
	$(MAKE) INSTROOT=$(tmpdir-dev)/usr install-dev
	$(MAKE) INSTROOT=$(tmpdir)/usr install
	$(installdoc) debian/copyright \
				$(tmpdir)/usr/share/doc/libident
	$(installdoc) README \
				$(tmpdir)/usr/share/doc/libident
	$(installdoc) debian/changelog \
				$(tmpdir)/usr/share/doc/libident/changelog.Debian
	$(installdoc) debian/in.identtestd.8 \
				$(tmpdir)/usr/share/man/man8
	$(installbin) -s ident-tester \
				$(tmpdir)/usr/sbin/in.identtestd
	gzip -v9 $(tmpdir)/usr/share/man/man?/*
	gzip -v9 $(tmpdir-dev)/usr/share/man/man?/*
	for manalias in ident_lookup ident_id ident_free id_open id_close id_query \
			id_parse id_fileno ; do \
		ln -s ident.3.gz $(tmpdir-dev)/usr/share/man/man3/$$manalias.3.gz ; \
	done
	# dont compress copyright
	gzip -v9 $(tmpdir)/usr/share/doc/libident/README
	gzip -v9 $(tmpdir)/usr/share/doc/libident/changelog.Debian
	strip --strip-debug    $(tmpdir-dev)/usr/lib/libident.a
	strip --strip-unneeded $(tmpdir)/usr/lib/libident.so.$(version)
	strip --remove-section=.comment $(tmpdir)/usr/lib/libident.so.$(version)
	ln -s libident $(tmpdir-dev)/usr/share/doc/libident-dev
	dpkg-shlibdeps $(tmpdir)/usr/sbin/in.identtestd
	dpkg-gencontrol -P$(tmpdir)     -plibident     -isp
	dpkg-gencontrol -P$(tmpdir-dev) -plibident-dev -isp
	$(installexe) debian/postinst $(tmpdir)/DEBIAN/postinst
	$(installexe) debian/postrm   $(tmpdir)/DEBIAN/postrm
	$(installdoc) debian/shlibs   $(tmpdir)/DEBIAN
	$(installexe) debian/postinst-dev $(tmpdir-dev)/DEBIAN/postinst
	chown -R root.root $(tmpdir) $(tmpdir-dev)
	chmod -R g-ws $(tmpdir) $(tmpdir-dev)
	dpkg --build $(tmpdir) ..
	dpkg --build $(tmpdir-dev) ..

define checkdir
	test -f id_open.c && test -f debian/rules
endef

checkroot:
	$(checkdir)
	test root = "`whoami`"

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

zapdirs:
	-rm -rf $(tmpdir) $(tmpdir-dev)

$(instdirs): zapdirs
	install -d -m 755 $@
	chmod g-s $@