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
# -*- makefile -*-
# The name of the package
package := $(shell sed -n -e 's/Package: *\([a-z]\)/\1/p' debian/control)
doc := usr/share/doc/$(package)
share := usr/share/$(package)
man := usr/share/man/man8
menu := usr/share/menu
tmp := debian/tmp
DPKG_EXPORT_BUILDTOOLS=1
include /usr/share/dpkg/buildtools.mk
CFLAGS = -Wall -g
LDFLAGS=
ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -Os
endif
# Set -ffile-prefix-map for reproducible builds regardless of build path
CFLAGS += -ffile-prefix-map=$(CURDIR)=.
build:
ln -sf /usr/share/misc/config.sub .
ln -sf /usr/share/misc/config.guess .
rm -f config.cache
autoupdate
dh_autoreconf
GZIP=/bin/gzip BZIP2=/bin/bzip2 ./configure --prefix=/usr \
--infodir=/usr/share/info \
--mandir=/usr/share/man \
--bindir=/usr/sbin
make CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" bindir=/usr/sbin && \
touch build
clean:
dh_autoreconf_clean
rm -f debian/magicfilter.debhelper.log
rm -f config.sub config.guess
rm -f build
[ ! -f Makefile ] || $(MAKE) distclean || $(MAKE) -f Makefile.in distclean
rm -rf *~ filters/*~ $(tmp) debian/*~ debian/files debian/substvars
rm -rf debian/tmp
binary-indep: build
# There are no architecture-independent files to be uploaded
# generated by this package. If there were any they would be
# made here.
binary-arch: build
rm -rf $(tmp)
install -d $(tmp)
cd $(tmp) &&\
install -d usr/sbin $(share) $(doc) $(man) $(menu) etc/magicfilter
$(MAKE) install prefix=$(tmp)/usr\
bindir=$(tmp)/usr/sbin infodir=$(tmp)/$(info) mandir=$(tmp)/$(man)
ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
$(STRIP) --remove-section=.comment --remove-section=.note --strip-unneeded $(tmp)/usr/sbin/magicfilter
endif
install -p -m 755 magicfilterconfig $(tmp)/usr/sbin/magicfilterconfig
install -m 644 filters/README* $(tmp)/$(doc)/
install -m 644 debian/menu $(tmp)/$(menu)/$(package)
install -m 644 quiet.ps $(tmp)/$(share)/quiet.ps
cd filters && install -p -m 755 *-filter ../$(tmp)/etc/magicfilter
install -p -m 644 debian/changelog $(tmp)/$(doc)/changelog.Debian
install -p -m 644 ChangeLog $(tmp)/$(doc)/changelog
cd $(tmp)/$(doc) && gzip -9nf changelog.Debian README* changelog
install -p -m 644 debian/copyright $(tmp)/$(doc)
install -p -m 644 magicfilterconfig.8 $(tmp)/$(man)
gzip -9nf $(tmp)/$(man)/*
dpkg-shlibdeps $(tmp)/usr/sbin/$(package)
install -d $(tmp)/DEBIAN
cd $(tmp) &&\
md5sum `find * -name DEBIAN -prune -o -type f -print`\
| LC_ALL=C sort > DEBIAN/md5sums
dpkg-gencontrol -isp
install -m 755 debian/prerm debian/postrm debian/postinst $(tmp)/DEBIAN
cd filters && ls -1 *-filter|sed -e 's,^,/etc/magicfilter/,'\
| LC_ALL=C sort > ../$(tmp)/DEBIAN/conffiles
chmod 644 $(tmp)/DEBIAN/conffiles
chmod -R g-ws,og=rX $(tmp)
dpkg-deb --build --root-owner-group $(tmp) ..
chmod a+r debian/files
# Below here is fairly generic really
binary: binary-indep binary-arch
source diff:
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
.PHONY: binary binary-arch binary-indep clean
build-arch: build
build-indep:
|