view debian/rules @ 340:53b3cb6cae3d noffle

[svn] cleanup
author godisch
date Tue, 04 Mar 2003 21:20:07 +0000
parents fa7a42b18bc8
children 31295db432f5
line wrap: on
line source

#!/usr/bin/make -f
# $Id: rules 474 2003-03-04 20:47:54Z godisch $

#export MAINT_BUILD=1

BUILDDIR = debian/noffle
DEBDIR   = $(BUILDDIR)/DEBIAN
DOCDIR   = $(BUILDDIR)/usr/share/doc/noffle
SPOOLDIR = $(BUILDDIR)/var/spool/noffle
MANDIR   = $(BUILDDIR)/usr/share/man
testdir  = test -f src/noffle.c -a -f debian/rules
testroot = test x`whoami` = xroot

# FOR AUTOCONF 2.13 ONLY
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
	CONFFLAGS += $(DEB_HOST_GNU_TYPE)
else
	CONFFLAGS += --host $(DEB_BUILD_GNU_TYPE) --build $(DEB_HOST_GNU_TYPE)
endif

# FOR AUTOCONF 2.52 AND NEWER ONLY
#ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
#	CONFFLAGS += --build $(DEB_HOST_GNU_TYPE)
#else
#	CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
#endif

CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif
export CFLAGS

ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	STRIP_FLAG =
else
	STRIP_FLAG = -s
endif

clean:
	$(testdir)
	-rm -f configure-stamp build-stamp debian/files debian/substvars
#ifneq ($(MAINT_BUILD),1)
#	# ---------- prevent automake etc. from being called
#	# if you have changed anything, set MAINT_BUILD to 1
#	touch configure.in && \
#	touch Makefile.am docs/Makefile.am src/Makefile.am packages/Makefile.am packages/redhat/Makefile.am && \
#	touch aclocal.m4   && \
#	touch Makefile.in docs/Makefile.in src/Makefile.in packages/Makefile.in packages/redhat/Makefile.in && \
#	touch configure    && \
#	touch stamp-h.in config.h.in
#	# ---------- endif
#else
#	aclocal
#	autoconf
#	autoheader
#	automake
#	-rm -f config.log
#endif
	-$(MAKE) -i distclean
	-rm -rf debian/noffle

configure: configure-stamp
configure-stamp:
	$(testdir)
	./configure $(CONFFLAGS) --prefix=/usr --mandir=/usr/share/man \
		--with-configfile=/etc/news/noffle.conf \
		--with-usersfile=/etc/news/noffle.users --enable-auth=no
	touch configure-stamp

build: build-stamp
build-stamp: configure
	$(testdir)
	$(MAKE)
	touch build-stamp

binary: binary-arch

binary-indep:

binary-arch: build
	$(testdir)
	$(testroot)
	-rm -rf debian/noffle

	# installing binaries
	install -o news -g news -m 6755 -D $(STRIP_FLAG) src/noffle $(BUILDDIR)/usr/bin/noffle
	install -o root -g root -m 0755 -D debian/noffle-cronfetch $(BUILDDIR)/usr/sbin/noffle-cronfetch

	# installing locking directory
	install -d -o root -g root -m 0755 $(BUILDDIR)/var/lock
	install -d -o news -g news -m 2755 $(BUILDDIR)/var/lock/noffle

	# installing spool directories
	install -d -o root -g root -m 0755 $(BUILDDIR)/var/spool
	install -d -o news -g news -m 2755 $(SPOOLDIR)/data $(SPOOLDIR)/outgoing $(SPOOLDIR)/overview $(SPOOLDIR)/requested
	ln -s ../../lock/noffle $(SPOOLDIR)/lock
	chown news:news $(SPOOLDIR)/lock

	# installing shared files
	install -D -o root -g root -m 0644 debian/linda        $(BUILDDIR)/usr/share/linda/overrides/noffle
	install -D -o root -g root -m 0644 debian/lintian      $(BUILDDIR)/usr/share/lintian/overrides/noffle
	install -D -o root -g root -m 0644 debian/conf.debian  $(BUILDDIR)/usr/share/noffle/conf.debian
	install -D -o root -g root -m 0644 noffle.conf.example $(BUILDDIR)/usr/share/noffle/noffle.conf
	install -D -o root -g root -m 0644 debian/slrn.sl      $(BUILDDIR)/usr/share/slrn/macros/noffle.sl
	install -D -o root -g root -m 0644 debian/gnus.el      $(BUILDDIR)/usr/share/emacs/site-lisp/gnus/noffle.el

	# installing manuals
	install -d -o root -g root -m 0755 $(MANDIR)/man1 $(MANDIR)/man5 $(MANDIR)/man8
	sed 's@/etc/noffle\.conf@/etc/news/noffle.conf@g' docs/noffle.1      > $(MANDIR)/man1/noffle.1
	sed 's@/etc/noffle\.conf@/etc/news/noffle.conf@g' docs/noffle.conf.5 > $(MANDIR)/man5/noffle.conf.5
	chown root:root $(MANDIR)/man1/noffle.1 $(MANDIR)/man5/noffle.conf.5
	chmod 0644      $(MANDIR)/man1/noffle.1 $(MANDIR)/man5/noffle.conf.5
	install    -o root -g root -m 0644 debian/noffle-cronfetch.8 $(MANDIR)/man8
	find $(MANDIR) -type f -print0 | xargs -0 gzip -9

	# installing documentation
	install -D -o root -g root -m 0644 ChangeLog        $(DOCDIR)/changelog
	install -D -o root -g root -m 0644 debian/changelog $(DOCDIR)/changelog.Debian
	install    -o root -g root -m 0644 debian/copyright debian/README.Debian AUTHORS NEWS TODO docs/FAQ docs/INTERNALS docs/NOTES $(DOCDIR)
	ln -s ../../noffle $(DOCDIR)/examples
	install -D -o root -g root -m 0644 debian/xinetd    $(DOCDIR)/examples/xinetd.conf
	find $(DOCDIR) -type f \( -size +8 -o -name 'changelog*' \) -print0 | xargs -0 gzip -9

	# installing config files
	install -d -o root -g root -m 0755 $(BUILDDIR)/etc/news $(BUILDDIR)/etc/default
	install -D -o root -g root -m 0644 debian/cron.d     $(BUILDDIR)/etc/cron.d/noffle
	install -D -o root -g root -m 0755 debian/cron.daily $(BUILDDIR)/etc/cron.daily/noffle
	install -D -o root -g root -m 0755 debian/init       $(BUILDDIR)/etc/init.d/noffle
	install -D -o root -g root -m 0644 debian/logcheck   $(BUILDDIR)/etc/logcheck/ignore.d.paranoid/noffle
	install -D -o root -g root -m 0644 debian/logcheck   $(BUILDDIR)/etc/logcheck/ignore.d.server/noffle
	install -D -o root -g root -m 0644 debian/logcheck   $(BUILDDIR)/etc/logcheck/ignore.d.workstation/noffle
	install -D -o root -g root -m 0755 debian/ip-up      $(BUILDDIR)/etc/ppp/ip-up.d/noffle
	install -D -o root -g root -m 0755 debian/ip-down    $(BUILDDIR)/etc/ppp/ip-down.d/noffle

	# installing packaging information
	install -d -o root -g root -m 0755 $(DEBDIR)
	install    -o root -g root -m 0644 debian/control $(DEBDIR)
	install    -o root -g root -m 0755 debian/config debian/preinst debian/postinst debian/prerm debian/postrm $(DEBDIR)
	cd $(BUILDDIR) && find usr -type f -print0 | xargs -0 md5sum | tee DEBIAN/md5sums
	cd $(BUILDDIR) && find ./etc -type f | cut -c 2- | tee DEBIAN/conffiles
	po2debconf debian/templates > $(DEBDIR)/templates
	chown root:root $(DEBDIR)/md5sums $(DEBDIR)/conffiles $(DEBDIR)/templates
	chmod 0644      $(DEBDIR)/md5sums $(DEBDIR)/conffiles $(DEBDIR)/templates

	# building Debian package
	dpkg-shlibdeps $(BUILDDIR)/usr/bin/noffle
	dpkg-gencontrol -isp -pnoffle -P$(BUILDDIR)
	dpkg --build $(BUILDDIR) ..
	# binary target finished

.PHONY: clean configure build binary binary-indep binary-arch