linux/debian/rules

83 lines
2.4 KiB
Makefile
Executable File

#!/usr/bin/make -f
#
# Generally nothing needs to be modified below this line
#
SHELL := sh -e
DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
srcver := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')
VERSION := $(word 1,$(subst -, ,$(srcver)))
MAJOR := $(word 1,$(subst ., ,$(VERSION))).$(word 2,$(subst ., ,$(VERSION)))
include debian/rules.defs
setup: debian/setup-stamp
debian/setup-stamp: $(BUILD_DIR) $(STAMPS_DIR)
dh_testdir
$(MAKE) -f debian/rules.gen setup-$(DEB_HOST_ARCH)
touch $@
build: debian/control debian/build-stamp
debian/build-stamp: $(BUILD_DIR) $(STAMPS_DIR) debian/setup-stamp
dh_testdir
$(MAKE) -f debian/rules.gen build-$(DEB_HOST_ARCH)
touch $@
$(BUILD_DIR) $(STAMPS_DIR):
@[ -d $@ ] || mkdir $@
orig: ../orig/linux-$(MAJOR)-$(VERSION)
rsync --delete --exclude debian --exclude .svn -av ../orig/linux-$(MAJOR)-$(VERSION)/ .
../orig/linux-$(MAJOR)-$(VERSION):
if [ -f "../linux-$(MAJOR)_$(VERSION).orig.tar.gz" ]; then \
mkdir -p ../orig; \
tar -C ../orig -xzf ../linux-$(MAJOR)_$(VERSION).orig.tar.gz; \
else \
echo "Can't find orig tarball." >&2; \
exit 1; \
fi
clean: unpatch
dh_testdir
rm -f version.Debian
cd debian; rm -f *.kpatches.arch
rm -rf $(BUILD_DIR) $(STAMPS_DIR)
dh_clean
binary-indep:
dh_testdir
$(MAKE) -f debian/rules.gen binary-indep
binary-arch:
dh_testdir
$(MAKE) -f debian/rules.gen binary-arch-$(DEB_HOST_ARCH)
binary: binary-indep binary-arch
#
# Makes the master debian/control file by substituting
# variable values into the template.
#
debian/control debian/rules.gen: debian/bin/gencontrol.py debian/changelog $(wildcard debian/templates/control.*.in)
if [ -f debian/control.md5sum ]; then \
if md5sum $^ | diff - debian/control.md5sum > /dev/null; then true; else \
$(MAKE) -f debian/rules debian/control-real; \
fi \
else \
$(MAKE) -f debian/rules debian/control-real; \
fi
debian/control-real: debian/bin/gencontrol.py debian/changelog $(wildcard debian/templates/control.*.in)
debian/bin/gencontrol.py
md5sum $^ > debian/control.md5sum
@echo
@echo This target is made to fail intentionally, to make sure
@echo that it is NEVER run during the automated build. Please
@echo ignore the following error, the debian/control file has
@echo been generated SUCCESSFULLY.
@echo
exit 1
.PHONY: clean build setup binary-indep binary-arch binary patch unpatch source tree