2006-04-12 20:19:42 +00:00
|
|
|
# $Id$
|
2006-04-11 21:19:46 +00:00
|
|
|
# ------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Copyright (C) 2002-2005 Novell/SUSE
|
2010-10-07 15:42:36 -07:00
|
|
|
# Copyright (C) 2010 Canonical, Ltd.
|
2006-04-11 21:19:46 +00:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of version 2 of the GNU General Public
|
|
|
|
# License published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, contact Novell, Inc.
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
# Make.rules - common make targets and variables for building the SHASS
|
|
|
|
# product.
|
|
|
|
#
|
|
|
|
# NOTES:
|
|
|
|
# - must define the package NAME before including this file.
|
|
|
|
# - After checking in to cvs, you'll need to delele the hardlinked
|
|
|
|
# Make.rules files that already exist in the individual application
|
|
|
|
# directories
|
|
|
|
|
2006-11-03 22:07:47 +00:00
|
|
|
DISTRIBUTION=AppArmor
|
2010-10-07 15:37:30 -07:00
|
|
|
VERSION=$(shell cat common/Version)
|
2006-04-11 21:19:46 +00:00
|
|
|
|
|
|
|
# OVERRIDABLE variables
|
|
|
|
# Set these variables before including Make.rules to change its behavior
|
|
|
|
# SPECFILE - for packages that have a non-standard specfile name
|
|
|
|
# EXTERNAL_PACKAGE - for packages that have upstream versions that
|
|
|
|
# we're locally modifying (e.g. imnxcerttool/gnutls).
|
|
|
|
#
|
|
|
|
# use 'make BUILDIR=/some/where/else/' to override the /usr/src/redhat
|
|
|
|
# location -- it *should* pick out the right thing to do based on the
|
|
|
|
# .rpmmacros file, but you can still use BUILDDIR to override that.
|
|
|
|
TESTBUILDDIR=$(shell [ -f ${HOME}/.rpmmacros ] && awk '/^%_topdir/ {print $$2}' ${HOME}/.rpmmacros)
|
2007-01-11 21:55:08 +00:00
|
|
|
ifndef BUILDDIR
|
2006-04-11 21:19:46 +00:00
|
|
|
BUILDDIR=$(shell if [ -d "${TESTBUILDDIR}" ] ; then \
|
|
|
|
echo ${TESTBUILDDIR} | sed "s^/$$^^" ; \
|
|
|
|
elif [ -d "/usr/src/redhat" ] ; then \
|
|
|
|
echo "/usr/src/redhat" ; \
|
|
|
|
elif [ -d "/usr/src/packages" ] ; then \
|
|
|
|
echo "/usr/src/packages" ; \
|
|
|
|
else \
|
|
|
|
echo "/tmp/${NAME}" ; \
|
|
|
|
fi ;)
|
|
|
|
endif
|
|
|
|
ifndef DISTRO
|
|
|
|
DISTRO=$(shell if [ -f /etc/slackware-version ] ; then \
|
|
|
|
echo slackware ; \
|
|
|
|
elif [ -f /etc/debian_version ] ; then \
|
|
|
|
echo debian ;\
|
2010-10-07 15:38:31 -07:00
|
|
|
elif which rpm > /dev/null ; then \
|
|
|
|
if [ "$(rpm --eval '0%{?suse_version}')" != "0" ] ; then \
|
|
|
|
echo suse ;\
|
|
|
|
elif [ "$(rpm --eval '%{_host_vendor}')" = redhat ] ; then \
|
|
|
|
echo rhel4 ;\
|
|
|
|
elif [ "$(rpm --eval '0%{?fedora}')" != "0" ] ; then \
|
|
|
|
echo rhel4 ;\
|
|
|
|
else \
|
|
|
|
echo unknown ;\
|
|
|
|
fi ;\
|
2006-04-11 21:19:46 +00:00
|
|
|
else \
|
|
|
|
echo unknown ;\
|
|
|
|
fi)
|
|
|
|
endif
|
2007-01-11 21:55:08 +00:00
|
|
|
RPMARG=--define "_topdir $(BUILDDIR:/=)" \
|
2006-04-11 21:19:46 +00:00
|
|
|
--define "vendor NOVELL, Inc." \
|
|
|
|
--define "distribution ${DISTRIBUTION}" \
|
|
|
|
--define "debug_package %{nil}" \
|
|
|
|
--define "immunix_version ${VERSION}" \
|
2007-01-11 21:55:08 +00:00
|
|
|
$(shell [ -d ${BUILDDIR}/BUILDROOT ] && echo --define \"buildroot $(BUILDDIR:/=)/BUILDROOT\") \
|
2006-04-11 21:19:46 +00:00
|
|
|
$(shell [ -n "${DISTRO}" ] && echo --define \"distro ${DISTRO}\")
|
|
|
|
|
2010-10-18 12:12:37 -07:00
|
|
|
REPO_VERSION_CMD=([ -x /usr/bin/bzr ] && /usr/bin/bzr version-info . 2> /dev/null || awk '{ print "revno: "$2 }' common/.stamp_rev) | awk '/^revno:/ { print $2 }'
|
2006-04-11 21:19:46 +00:00
|
|
|
|
|
|
|
ifdef EXTERNAL_PACKAGE
|
|
|
|
RPMARG+=--define "_sourcedir $(shell pwd)"
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef SPECFILE
|
|
|
|
SPECFILE = $(NAME).spec
|
2006-10-31 14:08:34 +00:00
|
|
|
endif
|
2006-04-11 21:19:46 +00:00
|
|
|
RELEASE_DIR = $(NAME)-$(VERSION)
|
2010-10-18 12:12:37 -07:00
|
|
|
TAR = /bin/tar czvp -h --exclude .svn --exclude .bzr --exclude .bzrignore --exclude ${RELEASE_DIR}/${RELEASE_DIR} $(shell test -f ${NAME}.exclude && echo "-X ${NAME}.exclude")
|
2006-10-16 21:08:58 +00:00
|
|
|
LDCONFIG = /sbin/ldconfig
|
2006-04-11 21:19:46 +00:00
|
|
|
|
|
|
|
RPMSUBDIRS=SOURCES SPECS BUILD BUILDROOT SRPMS RPMS/i386 RPMS/i586 \
|
|
|
|
RPMS/i686 RPMS/athlon RPMS/noarch RPMS/x86_64
|
2007-01-11 21:55:08 +00:00
|
|
|
BUILDRPMSUBDIRS=$(foreach subdir, $(RPMSUBDIRS), $(BUILDDIR:/=)/$(subdir))
|
2006-04-11 21:19:46 +00:00
|
|
|
|
|
|
|
ifdef EXTERNAL_PACKAGE
|
|
|
|
.PHONY: rpm
|
|
|
|
rpm: clean $(BUILDRPMSUBDIRS)
|
|
|
|
rpmbuild -ba ${RPMARG} ${SPECFILE}
|
|
|
|
|
|
|
|
else
|
|
|
|
.PHONY: rpm
|
2010-10-18 12:12:37 -07:00
|
|
|
rpm: clean $(BUILDRPMSUBDIRS)
|
|
|
|
__REPO_VERSION=`$(value REPO_VERSION_CMD)` ; \
|
|
|
|
__TARBALL=$(NAME)-$(VERSION)-$${__REPO_VERSION}.tar.gz ; \
|
|
|
|
make $${__TARBALL} ; \
|
|
|
|
cp $${__TARBALL} $(BUILDDIR)/SOURCES/
|
2006-04-11 21:19:46 +00:00
|
|
|
cp ${SPECFILE} $(BUILDDIR)/SPECS/
|
|
|
|
rpmbuild -ba ${RPMARG} ${SPECFILE}
|
|
|
|
|
|
|
|
.PHONY: ${SPECFILE}
|
|
|
|
${SPECFILE}: ${SPECFILE}.in
|
2010-10-18 12:12:37 -07:00
|
|
|
__REPO_VERSION=`$(value REPO_VERSION_CMD)` ; \
|
2006-04-11 21:19:46 +00:00
|
|
|
sed -e "s/@@immunix_version@@/${VERSION}/g" \
|
2010-10-18 12:12:37 -07:00
|
|
|
-e "s/@@repo_version@@/$${__REPO_VERSION}/g" $< > $@
|
2006-04-11 21:19:46 +00:00
|
|
|
|
2010-10-18 12:12:37 -07:00
|
|
|
%.tar.gz: clean ${SPECFILE}
|
2006-04-11 21:19:46 +00:00
|
|
|
-rm -rf $(RELEASE_DIR)
|
|
|
|
mkdir $(RELEASE_DIR)
|
2010-10-18 12:12:37 -07:00
|
|
|
$(TAR) --exclude $@ . | tar xz -C $(RELEASE_DIR)
|
|
|
|
$(TAR) --exclude $@ -f $@ $(RELEASE_DIR)
|
2006-04-11 21:19:46 +00:00
|
|
|
rm -rf $(RELEASE_DIR)
|
|
|
|
|
2007-08-16 22:11:01 +00:00
|
|
|
ifndef OVERRIDE_TARBALL
|
2006-04-11 21:19:46 +00:00
|
|
|
.PHONY: tarball
|
|
|
|
tarball: clean $(TARBALL)
|
2007-08-16 22:11:01 +00:00
|
|
|
endif
|
2006-10-31 14:08:34 +00:00
|
|
|
|
2006-04-11 21:19:46 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: version
|
|
|
|
.SILENT: version
|
|
|
|
version:
|
|
|
|
rpm -q --define "_sourcedir ." ${RPMARG} --specfile ${SPECFILE}
|
|
|
|
|
2010-10-07 15:25:21 -07:00
|
|
|
.PHONY: repo_version
|
|
|
|
.SILENT: repo_version
|
|
|
|
repo_version:
|
2010-10-18 12:12:37 -07:00
|
|
|
$(value REPO_VERSION_CMD)
|
|
|
|
|
2010-10-07 15:25:21 -07:00
|
|
|
|
2006-04-11 21:19:46 +00:00
|
|
|
.PHONY: build_dir
|
|
|
|
build_dir: $(BUILDRPMSUBDIRS)
|
|
|
|
|
|
|
|
$(BUILDRPMSUBDIRS):
|
|
|
|
mkdir -p $(BUILDRPMSUBDIRS)
|
|
|
|
|
2007-04-03 20:12:16 +00:00
|
|
|
.PHONY: _clean
|
|
|
|
.SILENT: _clean
|
|
|
|
_clean:
|
|
|
|
-rm -f ${NAME}-${VERSION}-*.tar.gz
|
2007-04-26 21:20:02 +00:00
|
|
|
-rm -f ${MANPAGES} *.[0-9].gz ${HTMLMANPAGES} pod2htm*.tmp
|
2007-04-03 20:12:16 +00:00
|
|
|
|
2007-04-03 18:51:56 +00:00
|
|
|
# =====================
|
|
|
|
# manpages
|
|
|
|
# =====================
|
|
|
|
|
|
|
|
POD2MAN = /usr/bin/pod2man
|
|
|
|
POD2HTML = /usr/bin/pod2html
|
|
|
|
MANDIR = /usr/share/man
|
|
|
|
DOCDIR = /usr/share/doc/${NAME}-${VERSION}
|
|
|
|
|
|
|
|
# get list of directory numbers based on definition of MANPAGES variable
|
|
|
|
MANDIRS=$(sort $(foreach dir, 1 2 3 4 5 6 7 8, $(patsubst %.${dir}, ${dir}, $(filter %.${dir}, ${MANPAGES}))))
|
|
|
|
HTMLMANPAGES=$(foreach manpage, ${MANPAGES}, ${manpage}.html)
|
|
|
|
|
|
|
|
.PHONY: install_manpages
|
|
|
|
install_manpages: $(MANPAGES)
|
|
|
|
$(foreach dir, ${MANDIRS}, \
|
|
|
|
install -d ${DESTDIR}/${MANDIR}/man${dir} ; \
|
|
|
|
install -m 644 $(filter %.${dir}, ${MANPAGES}) ${DESTDIR}/${MANDIR}/man${dir}; \
|
|
|
|
$(foreach aa_page, $(filter %.${dir}, ${AA_MANPAGES}), \
|
|
|
|
ln -sf $(aa_page) ${DESTDIR}/${MANDIR}/man${dir}/${aa_page:%=aa-%};))
|
|
|
|
|
|
|
|
%.1: %.pod
|
|
|
|
$(POD2MAN) $< --release=NOVELL/SUSE --center=AppArmor --section=1 > $@
|
|
|
|
|
|
|
|
%.2: %.pod
|
|
|
|
$(POD2MAN) $< --release=NOVELL/SUSE --center=AppArmor --section=2 > $@
|
|
|
|
|
|
|
|
%.3: %.pod
|
|
|
|
$(POD2MAN) $< --release=NOVELL/SUSE --center=AppArmor --section=3 > $@
|
|
|
|
|
|
|
|
%.4: %.pod
|
|
|
|
$(POD2MAN) $< --release=NOVELL/SUSE --center=AppArmor --section=4 > $@
|
|
|
|
|
|
|
|
%.5: %.pod
|
|
|
|
$(POD2MAN) $< --release=NOVELL/SUSE --center=AppArmor --section=5 > $@
|
|
|
|
|
|
|
|
%.6: %.pod
|
|
|
|
$(POD2MAN) $< --release=NOVELL/SUSE --center=AppArmor --section=6 > $@
|
|
|
|
|
|
|
|
%.7: %.pod
|
|
|
|
$(POD2MAN) $< --release=NOVELL/SUSE --center=AppArmor --section=7 > $@
|
|
|
|
|
|
|
|
%.8: %.pod
|
|
|
|
$(POD2MAN) $< --release=NOVELL/SUSE --center=AppArmor --section=8 > $@
|
|
|
|
|
|
|
|
%.1.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
|
|
|
%.2.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
|
|
|
%.3.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
|
|
|
%.4.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
|
|
|
%.5.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
|
|
|
%.6.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
|
|
|
%.7.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
|
|
|
%.8.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
2006-04-11 21:19:46 +00:00
|
|
|
A2PS_ARGS=-Ec -g --line-numbers=1
|
|
|
|
ENSCRIPT_ARGS=-C -2jGr -f Courier6 -E
|
|
|
|
%.c.ps: %.c
|
|
|
|
#a2ps ${A2PS_ARGS} $< -o $@
|
|
|
|
enscript ${ENSCRIPT_ARGS} -o $@ $<
|
|
|
|
|
|
|
|
%.pm.ps: %.pm
|
|
|
|
enscript ${ENSCRIPT_ARGS} -o $@ $<
|