#!/usr/bin/make -f DIR:=$(shell pwd) arch=$(shell dpkg --print-architecture) mcidir=debian/tmp-main/DEBIAN build: $(checkdir) ./configure --prefix=/usr $(MAKE) touch build clean: $(checkdir) -rm -f build -$(MAKE) -i distclean || $(MAKE) -f Makefile.in -i distclean -rm -rf debian/tmp* *~ *.orig ./#*# tmp.* debian/files* -rm -f config.cache config.status config.h install config.log find -name '*~' -print0 | xargs -r0 rm -- binary: binary-arch binary-indep binary-trees: checkroot build $(checkdir) -rm -rf debian/tmp-{main,dev} install -d debian/tmp-{main,dev}/{DEBIAN,etc/dpkg,usr/doc/dpkg} install -d debian/tmp-dev/usr/{lib/dpkg,doc/dpkg-dev,man/man1,man/man8,sbin,bin} set -e; if [ $(arch) = i386 ]; then \ sed -e 's/^# i386elf: //' $(mcidir)/preinst ; \ else \ sed -e '/^# i386elf: /d' debian/preinst >$(mcidir)/preinst ; \ fi set -e; if [ -f debian/shlibs.default.$(arch) ]; then \ echo /etc/dpkg/shlibs.default >debian/tmp-dev/DEBIAN/conffiles ; \ cp debian/shlibs.default.$(arch) \ debian/tmp-dev/etc/dpkg/shlibs.default ; \ fi cp debian/{prerm,postinst} $(mcidir)/. chmod +x $(mcidir)/{postinst,prerm,preinst} $(MAKE) prefix=$(DIR)/debian/tmp-main/usr \ datadir=$(DIR)/debian/tmp-main/var/lib/dpkg \ etcdir=$(DIR)/debian/tmp-main/etc \ install find debian/tmp-main/usr/man -type f | xargs gzip -9v set -e; for f in dpkg-buildpackage dpkg-gencontrol dpkg-distaddfile \ dpkg-parsechangelog dpkg-genchanges dpkg-shlibdeps; do \ rm debian/tmp-main/usr/man/man1/$$f.1; \ ln -s dpkg-source.1.gz debian/tmp-main/usr/man/man1/$$f.1.gz ; \ done gzip -9v debian/tmp-main/usr/doc/dpkg/changelog.* cp debian/copyright debian/tmp-main/usr/doc/dpkg/copyright cp debian/copyright debian/tmp-dev/usr/doc/dpkg-dev/copyright cp debian/dev-README debian/tmp-dev/usr/doc/dpkg-dev/README cp TODO debian/tmp-dev/usr/doc/dpkg/WISHLIST set -e; for f in \ usr/doc/dpkg/{programmer.html,policy.html,developer-keys.pgp,changelog.manuals.gz} \ usr/bin/dpkg-{source,genchanges,gencontrol,shlibdeps,buildpackage,parsechangelog} \ usr/bin/{dpkg-distaddfile,822-date,dpkg-scanpackages} \ usr/man/man1/dpkg-{source,genchanges,gencontrol,shlibdeps,buildpackage}.1.gz \ usr/man/man1/{dpkg-parsechangelog,dpkg-distaddfile,822-date}.1.gz \ usr/man/man5 usr/man/man8/dpkg-scanpackages.8.gz usr/lib/emacs \ usr/lib/dpkg/parsechangelog usr/lib/dpkg/controllib.pl \ ; do mv debian/tmp-main/$$f debian/tmp-dev/$$f; done binary-indep: checkroot build binary-trees $(checkdir) dpkg-gencontrol -pdpkg-dev -Pdebian/tmp-dev chown -R root.root debian/tmp-dev chmod -R g-ws,a+r,u+w debian/tmp-dev dpkg-deb --build debian/tmp-dev .. set -e -x; cd doc; for f in policy programmer; do \ debiandoc2ps -pa4 -O $$f.sgml | gzip -9v >../../$$f.ps.gz; \ dpkg-distaddfile -f../debian/files $$f.ps.gz byhand -; \ GZIP=-9v tar zcf ../../$$f.html.tar.gz $$f.html; \ dpkg-distaddfile -f../debian/files $$f.html.tar.gz byhand -; \ done binary-arch: checkroot build binary-trees touch debian/tmp-main/var/lib/dpkg/{status,available} dpkg-shlibdeps -dPre-Depends main/dpkg dselect/dselect dpkg-gencontrol -pdpkg -Pdebian/tmp-main chown -R root.root debian/tmp-main chmod -R g-ws,a+r,u+w debian/tmp-main set -e; cd debian/tmp-main; \ version=`sed -n 's/^Version: //p' DEBIAN/control`; \ file=dpkg_$${version}_$(arch).nondebbin.tar; \ tar cf ../../../$${file} usr var && gzip -9vf ../../../$${file}; \ cd ../..; dpkg-distaddfile $${file}.gz byhand - rm debian/tmp-main/var/lib/dpkg/{status,available} dpkg-deb --build debian/tmp-main .. define checkdir test -f include/dpkg.h endef checkroot: $(checkdir) test root = "`whoami`" .PHONY: binary source diff clean checkroot