File: rules

package info (click to toggle)
posh 0.12.3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,328 kB
  • ctags: 1,621
  • sloc: ansic: 14,596; xml: 1,604; sh: 1,365; perl: 964; makefile: 131
file content (146 lines) | stat: -rwxr-xr-x 4,660 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
#!/usr/bin/make -f

define checkdir
	test -f debian/rules
endef

INSTALL = install
INSTALL_FILE    = $(INSTALL) -p    -o root -g root  -m  644
INSTALL_PROGRAM = $(INSTALL) -p    -o root -g root  -m  755
INSTALL_SCRIPT  = $(INSTALL) -p    -o root -g root  -m  755
INSTALL_DIR     = $(INSTALL) -p -d -o root -g root  -m  755

CFLAGS := $(shell dpkg-buildflags --get CFLAGS)
CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)

DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)

ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	CONFARGS = --host=$(DEB_HOST_GNU_TYPE)
	STRIP := $(DEB_HOST_GNU_TYPE)-strip
	OBJCOPY := $(DEB_HOST_GNU_TYPE)-objcopy
else
	STRIP := strip
	OBJCOPY := objcopy
endif

CONFARGS += --prefix=/usr \
	     --bindir=/bin \
	     --mandir=/usr/share/man \
	     CFLAGS="$(CFLAGS)" \
	     CPPFLAGS="$(CPPFLAGS)" \
	     LDFLAGS="$(LDFLAGS)"

posh_version := $(shell dpkg-parsechangelog | sed -n '/^Version: \(.*\)$$/ {s//\1/;p}')

configure: stamp-configure
stamp-configure:
	$(checkdir)

	touch configure aclocal.m4 stamp-h.in Makefile.in config.h.in
	./configure $(CONFARGS)

	touch stamp-configure

build: build-arch build-indep
build-indep:

build-arch: build-arch-stamp
build-arch-stamp: stamp-configure
	$(checkdir)

	$(MAKE)
	LANG=C $(MAKE) check

	touch build-arch-stamp

clean: checkroot
	$(checkdir)
	# Disable the posh -i tests due to sbuild issues
	rm -f tests/ttylovers.t
	rm -f build-stamp stamp-configure

	# Add here commands to clean up after the build process.
	if [ -f Makefile ]; then \
	  $(MAKE) distclean; \
	fi

	rm -rf debian/posh debian/posh.substvars debian/posh-dbg
	find . -type f -a \( -name \#\*\# -o -name .\*\~ -o -name \*\~ -o -name DEADJOE -o -name \*.orig -o -name \*.rej -o -name \*.bak -o -name .\*.orig -o -name .\*.rej -o -name .SUMS -o -name TAGS -o -name core -o \( -path \*/.deps/\* -a -name \*.P \) \) -exec rm -f {} \;

install: build checkroot
	$(checkdir)

	# Add here commands to install the package into debian/<packagename>
	$(MAKE) install LDFLAGS="" INSTALL_PROGRAM='$(INSTALL_PROGRAM)' \
		DESTDIR=$(CURDIR)/debian/posh

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install checkroot
	$(checkdir)

	$(INSTALL_DIR) debian/posh/DEBIAN \
		debian/posh/usr/share/doc/posh \
		debian/posh/usr/share/menu \
		debian/posh-dbg/usr/lib/debug/bin \
		debian/posh-dbg/usr/share/doc \
		debian/posh-dbg/DEBIAN

	$(OBJCOPY) --only-keep-debug debian/posh/bin/posh \
		debian/posh-dbg/usr/lib/debug/bin/posh.dbg
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	$(STRIP) --remove-section=.comment --remove-section=.note debian/posh/bin/posh
endif
	$(OBJCOPY) --add-gnu-debuglink=debian/posh-dbg/usr/lib/debug/bin/posh.dbg debian/posh/bin/posh

	$(INSTALL_SCRIPT) debian/posh.config debian/posh/DEBIAN/config
	po2debconf debian/posh.templates >debian/posh/DEBIAN/templates

	$(INSTALL_FILE) debian/menu debian/posh/usr/share/menu/posh
	$(INSTALL_FILE) debian/changelog debian/posh/usr/share/doc/posh/changelog
	gzip -9f debian/posh/usr/share/doc/posh/changelog
	$(INSTALL_FILE) debian/copyright debian/posh/usr/share/doc/posh/copyright
	chmod a-x debian/posh/usr/share/man/man1/posh.1
	gzip -9f debian/posh/usr/share/man/man1/posh.1

	$(INSTALL_SCRIPT) debian/posh.postinst debian/posh/DEBIAN/postinst
	$(INSTALL_SCRIPT) debian/posh.prerm debian/posh/DEBIAN/prerm
	$(INSTALL_SCRIPT) debian/posh.postrm debian/posh/DEBIAN/postrm

	ln -s posh debian/posh-dbg/usr/share/doc/posh-dbg

	dpkg-shlibdeps -Tdebian/posh.substvars -dDepends debian/posh/bin/posh
	dpkg-gencontrol -ldebian/changelog -isp -pposh -Tdebian/posh.substvars -Pdebian/posh
	cd debian/posh && find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums

	chown -R root:root debian/posh
	chmod -R g-w,a+rX debian/posh

	dpkg --build debian/posh ..

	dpkg-gencontrol -ldebian/changelog -isp -pposh-dbg -Pdebian/posh-dbg
	cd debian/posh-dbg && find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums

	chown -R root:root debian/posh-dbg
	chmod -R g-w,a+rX debian/posh-dbg

	dpkg --build debian/posh-dbg ..

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install prebuild build build-indep

prebuild:
	printf "define(POSH_VERSION, %s)\n" $(posh_version) >acinclude.m4

	autoreconf -fi

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