axis-historical/debian/rules
2006-08-03 16:35:36 +00:00

167 lines
4.3 KiB
Makefile
Executable file

#!/usr/bin/make -f
# -*- makefile -*-
#!/usr/bin/env python2
# This is a component of AXIS, a front-end for emc
# It is a "script used to control compilation and installation of the
# executable"
#
# Copyright 2006 Jeff Epler <jepler@unpythonic.net> and
# Chris Radek <chris@timeguy.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# 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, write to the Free Software
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
PYTHON_VERSIONS = 2.4
#IS_PURE =
HAVE_DH_PYTHON = yes
DUMMY_PACKAGE =
CHANGELOG =
ARCHITECTURE = any # architecture for binary packages
PYTHON = /usr/bin/python${PYTHON_VERSION}
SETUP_PY = setup.py
SETUP = ${PYTHON} ${SETUP_PY}
DEBPACKAGE = emc2-axis
DESTDIR = ${CURDIR}/debian/${DEBPACKAGE}
CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
export CFLAGS
ifeq (,$(wildcard PKG-INFO))
PKG_INFO = debian/PKG-INFO # generate our own PKG-INFO
else
PKG_INFO = PKG-INFO # use the distributed one
endif
# Macro to run setup.py once for each of the PYTHON_VERSIONS
echo_and_run = { echo $(1); $(1); }
foreach_python_version\
= @$(foreach PYTHON_VERSION, ${PYTHON_VERSIONS}, \
$(call echo_and_run, ${$(firstword $(1))_CMD}) \
&& ) true
# Commands which can be run by the foreach_python_version macro:
SETUP_CLEAN_CMD = ${SETUP} clean --all
SETUP_BUILD_CMD = ${SETUP} build
SETUP_INSTALL_CMD= ${SETUP} install --root='${DESTDIR}' --no-compile
DH_PYTHON_CMD = dh_python -V ${PYTHON_VERSION} -p ${DEBPACKAGE}
configure: configure-stamp
configure-stamp:
dh_testdir
# Add here commands to configure the package.
touch configure-stamp
build: build-stamp $(PKG_INFO)
build-stamp: configure-stamp
dh_testdir
$(call foreach_python_version, SETUP_BUILD)
touch build-stamp
debian/PKG-INFO: ${SETUP_PY}
@echo generating $@; \
python -c 'import sys; from distutils.core import run_setup; \
run_setup(sys.argv[1]).metadata.write_pkg_info("debian")' $<
clean:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
rm -f debian/PKG-INFO
$(call foreach_python_version, SETUP_CLEAN)
rm -rf build dist
dh_clean
rm setup/*.pyc
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
$(call foreach_python_version, SETUP_INSTALL)
mkdir -p ${DESTDIR}/usr/share/doc/emc2-axis
mv ${DESTDIR}/usr/share/doc/axis-*/* ${DESTDIR}/usr/share/doc/emc2-axis
rmdir ${DESTDIR}/usr/share/doc/axis-*
binary-indep: build install dummy-package
binary-arch: build install
export DH_OPTIONS =
ifeq (${ARCHITECTURE},all)
binary-indep: real-packages
else
binary-arch: real-packages
endif
# Build the real packages
ifdef DUMMY_PACKAGE
real-packages: DH_OPTIONS = -N${DUMMY_PACKAGE}
endif
real-packages:
@echo DH_OPTIONS=$$DH_OPTIONS
dh_testdir
dh_testroot
dh_installchangelogs $(CHANGELOG)
dh_installdocs -A $(PKG_INFO)
dh_installexamples
dh_installman
ifndef IS_PURE
dh_strip
endif
dh_compress
dh_fixperms
ifdef HAVE_DH_PYTHON
$(call foreach_python_version, DH_PYTHON)
endif
dh_installdeb
ifndef IS_PURE
dh_shlibdeps
endif
dh_gencontrol
dh_md5sums
dh_builddeb
# Build the dummy package
#
# There's not much to do, since the only content of the package
# is a symlink:
#
# /usr/share/doc/python-<basename> -> python<curver>-<basename>
#
dummy-package: DH_OPTIONS = -p${DUMMY_PACKAGE}
dummy-package:
ifdef DUMMY_PACKAGE
@echo DH_OPTIONS=$$DH_OPTIONS
dh_testdir
dh_testroot
dh_link
dh_fixperms
dh_gencontrol
dh_builddeb
endif
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
.PHONY: dummy-package real-packages
export USE_SYSTEM_BWIDGET := yes
export EMC_RUN_INSTALLED := yes
export EMCROOT := /usr