#!/usr/bin/make -f # -*- makefile -*- # debian/rules for libg2 # Author: Andreas Tille # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 pkglib=libg20 pkgdev=libg2-dev export DEB_BUILD_MAINT_OPTIONS=hardening=+all %: dh $@ # Compile with -fPIC on all platforms #override_dh_auto_configure: # dh_auto_configure -- CFLAGS="$(dpkg-buildflags --get CFLAGS) -fPIC" FFLAGS="$(dpkg-buildflags --get FFLAGS) -fPIC" # Use the latest version number in the CHANGES file version:=$(shell head -n 1 CHANGES | \ awk '{if (match($$0,/^[0-9]+\.[0-9]+[A-Za-z]/)) print substr($$0,RSTART,RLENGTH)}') rversion:=$(shell head -n 1 CHANGES | \ awk '{if (match($$0,/^[0-9]+\.[0-9]+/)) print substr($$0,RSTART,RLENGTH)}') major:=$(shell head -n 1 CHANGES | \ awk '{if (match($$0,/^[0-9]+/)) print substr($$0,RSTART,RLENGTH)}') # Locate autogenerated files that may need preservation. infiles:=$(shell \ find $(CURDIR) -name '*.in' \ | sed 's/\.in//' \ | xargs -I'{}' sh -c 'test ! -e {} || echo {}' \ ) execute_before_dh_autoreconf: # Preserve files that will be regenerated from .in files. set -e $(foreach infile,$(infiles),; cp -v $(infile) $(infile).orig) override_dh_auto_build: $(MAKE) depend $(MAKE) libg2.a DEBCFLAGS="$(CPPFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)" # clean up and build the shared lib -rm -f src/*.o src/*/*.o $(MAKE) \ PICFLAG="-fPIC" \ RVERSION=$(rversion) \ MVERSION=$(major) \ DEBCFLAGS="$(CPPFLAGS) $(CFLAGS)" \ LDFLAGS="$(LDFLAGS)" \ shared dh_auto_configure --sourcedirectory=g2_perl -- LIBS="-L$(CURDIR) -lg2" $(MAKE) -C ./g2_perl LD_RUN_PATH="" override_dh_auto_install: $(MAKE) RVERSION=$(rversion) MVERSION=$(major) install prefix=$(CURDIR)/debian/libg2-dev mv $(CURDIR)/debian/$(pkgdev)/usr/lib/lib*.so.0* $(CURDIR)/debian/$(pkglib)/usr/lib $(MAKE) -C ./g2_perl install DESTDIR=$(CURDIR)/debian/libg2$(major)-perl execute_after_dh_auto_clean: # Restore files that were erased by previous autoreconfiguration. set -e $(foreach infile,$(infiles), \ ; test ! -e $(infile).orig \ || mv -v $(infile).orig $(infile) \ )