File: rules

package info (click to toggle)
lpe 1.2.6.11
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,792 kB
  • ctags: 1,020
  • sloc: ansic: 12,804; sh: 10,515; makefile: 351; cs: 137; perl: 111; sed: 93
file content (131 lines) | stat: -rwxr-xr-x 3,752 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
#! /usr/bin/make -f
## debian/rules for LPE
## by Gergely Nagy <algernon@debian.org>

PACKAGE = lpe
PKGDIR	= ${CURDIR}/debian/${PACKAGE}

CFLAGS	= -O2
ifneq (,$(findstring debug,${DEB_BUILD_OPTIONS}))
	CFLAGS += -g
endif

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

default: build

bootstrap: bootstrap-stamp
bootstrap-stamp:
#	rm -f ltconfig
#	libtoolize --force --copy
#	aclocal
#	autoconf
#	cp /usr/share/misc/config.sub /usr/share/misc/config.guess \
#	   ./
	touch bootstrap-stamp

config: config-stamp
config-stamp: bootstrap-stamp
	$(testdir)
	CFLAGS="${CFLAGS}" ./configure  --prefix=/usr \
					--mandir=/usr/share/man \
					--infodir=/usr/share/info \
					--sysconfdir=/etc \
					--build=${DEB_BUILD_GNU_TYPE} \
					--host=${DEB_HOST_GNU_TYPE}
	touch config-stamp

build: config 
	$(testdir)
	$(MAKE)

clean: clean1
	rm -rf debian/${PACKAGE}.substvars ${PKGDIR} debian/files \
	       config-stamp patch-stamp bootstrap-stamp \
	       debian/patched config.cache autom4te.cache
#	rm ltmain.sh aclocal.m4 configure config.sub config.guess ltconfig

clean1:
	$(testdir)
#	$(testroot)
	-$(MAKE) distclean

install: build
	$(testdir)
	$(testroot)
	rm -rf debian/files debian/${PACKAGE}.substvars ${PKGDIR}
## Install the directories
	install -d ${PKGDIR}
	$(MAKE) prefix=${PKGDIR}/usr mandir=\$${prefix}/share/man install
	rm -f ${PKGDIR}/usr/share/doc/${PACKAGE}/COPYING \
	      ${PKGDIR}/usr/share/doc/${PACKAGE}/NEWS

lpe: build install
	$(testdir)
	$(testroot)
## Install various files
# directories
#	install -d ${PKGDIR}/usr/lib/menu
# menu entry
#	install -m 0644 debian/local/${PACKAGE}.menu \
#		${PKGDIR}/usr/lib/menu/${PACKAGE}
# changelogs
	install -m 0644 NEWS \
		${PKGDIR}/usr/share/doc/${PACKAGE}/changelog
	install -m 0644 debian/changelog \
		${PKGDIR}/usr/share/doc/${PACKAGE}/changelog.Debian
# copyright
	install -m 0644 debian/copyright \
		${PKGDIR}/usr/share/doc/${PACKAGE}/copyright
# strip binaries
ifeq (,$(findstring nostrip,${DEB_BUILD_OPTIONS}))
	strip --remove-section=.comment --remove-section=.note $(find-binaries)
endif
# compress stuff
	find ${PKGDIR}/usr/share/man/ -type f | xargs gzip -9f
	gzip -9f ${PKGDIR}/usr/share/doc/${PACKAGE}/changelog \
		 ${PKGDIR}/usr/share/doc/${PACKAGE}/changelog.Debian \
		 ${PKGDIR}/usr/share/doc/${PACKAGE}/BUGS \
		 ${PKGDIR}/usr/share/doc/${PACKAGE}/CUSTOMIZE \
		 ${PKGDIR}/usr/share/doc/${PACKAGE}/IDEAS \
		 ${PKGDIR}/usr/share/doc/${PACKAGE}/MODES \
		 ${PKGDIR}/usr/share/doc/${PACKAGE}/README \
		 ${PKGDIR}/usr/share/doc/${PACKAGE}/TODO
# fix some permissions
	chmod 0644 ${PKGDIR}/usr/lib/${PACKAGE}/*
# install maintainer scripts into DEBIAN/
	install -d ${PKGDIR}/DEBIAN
	install -m 0755 debian/maint/postinst \
			debian/maint/prerm \
			${PKGDIR}/DEBIAN
## Generate ${shlibs:Depends}
	dpkg-shlibdeps -Tdebian/${PACKAGE}.substvars -dDepends $(find-binaries)
## Generate DEBIAN/control
	dpkg-gencontrol -isp -p${PACKAGE} -Tdebian/${PACKAGE}.substvars -P${PKGDIR}
## Generate DEBIAN/md5sums
	cd ${PKGDIR} >/dev/null ;\
	 find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums
## Build the binary package
	dpkg --build ${PKGDIR} ..

binary-indep:
binary-arch: lpe
binary: binary-indep binary-arch


## Some handy macros
define testdir
	test -e debian/control || ( echo "debian/control not found"; exit 1 )
endef

define testroot
	test "x`whoami`" = "xroot" || ( echo "You must run this as root!"; exit 1 )
endef

define find-binaries
	$(shell find ${PKGDIR} -type f \( -name '*.so' -or -path '*/bin/lpe' \) -print)
endef

.PHONY: build clean binary-indep binary-arch binary install unpatch \
	clean1 patch config lpe bootstrap default