#!/usr/bin/make -f # -*- makefile -*- soversion = 8 libversion = $(soversion).2 # architecture dependent variables DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) CROSS=$(DEB_HOST_GNU_TYPE)-gcc else CROSS=gcc endif ifeq (,$(filter noudeb,$(DEB_BUILD_PROFILES))) buildudeb = yes endif ifneq (,$(findstring /$(DEB_HOST_ARCH)/,/i386/powerpc/sparc/s390/)) build64 = yes CC64 = $(CROSS) -m64 lib64dir = usr/lib64 gencontrol_flags = -- \ '-Vdevxx:Depends=libc6-dev-$(ARCH64)' ifeq ($(DEB_HOST_ARCH),i386) ARCH64 = amd64 HOST64 = x86_64-linux-gnu endif ifeq ($(DEB_HOST_ARCH),powerpc) ARCH64 = ppc64 HOST64 = ppc64-linux-gnu endif ifeq ($(DEB_HOST_ARCH),sparc) ARCH64 = sparc64 HOST64 = sparc64-linux-gnu endif ifeq ($(DEB_HOST_ARCH),s390) ARCH64 = s390x HOST64 = s390x-linux-gnu endif endif ifneq (,$(findstring /$(DEB_HOST_ARCH)/,/amd64/ppc64/)) build32 = yes CC32 = $(CROSS) -m32 lib32dir = usr/lib32 gencontrol_flags = -- \ '-Vdevxx:Depends=libc6-dev-$(ARCH32)' ifeq ($(DEB_HOST_ARCH),amd64) ARCH32 = i386 HOST32 = i486-linux-gnu endif ifeq ($(DEB_HOST_ARCH),ppc64) ARCH32 = powerpc HOST32 = powerpc-linux-gnu endif endif unexport CPPFLAGS CFLAGS LDFLAGS ifneq ($(filter nobiarch,$(DEB_BUILD_PROFILES)),) build32 = build64 = endif CFLAGS := $(shell dpkg-buildflags --get CFLAGS) CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) CFLAGS := $(CFLAGS) -I/usr/include/ncursesw CC = $(CROSS) SHELL = bash p_rl = libreadline$(soversion)t64 p_rlu = libreadline$(soversion)-udeb p_rl32 = lib32readline$(soversion) p_rl64 = lib64readline$(soversion) p_comm = readline-common p_commu = readline-common-udeb p_rld = libreadline-dev p_rld32 = lib32readline-dev p_rld64 = lib64readline-dev p_doc = readline-doc p_rlfe = rlfe d = debian/tmp du = debian/tmp-udeb d32 = debian/tmp32 d64 = debian/tmp64 d_rl = debian/$(p_rl) d_rlu = debian/$(p_rlu) d_rl32 = debian/$(p_rl32) d_rl64 = debian/$(p_rl64) d_comm = debian/$(p_comm) d_commu = debian/$(p_commu) d_rld = debian/$(p_rld) d_rld32 = debian/$(p_rld32) d_rld64 = debian/$(p_rld64) d_doc = debian/$(p_doc) d_rlfe = debian/$(p_rlfe) srcdir = $(CURDIR) builddir = $(CURDIR)/build builddiru = $(CURDIR)/buildudeb builddir32 = $(CURDIR)/build32 builddir64 = $(CURDIR)/build64 default: build configure: configure-stamp configure-stamp: dh_testdir cp -p /usr/share/misc/config.* ./support/ rm -rf $(builddir) mkdir $(builddir) find . -type d | xargs chmod g-s chmod +x configure cd $(builddir) && \ CC=$(CC) CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" $(srcdir)/configure \ --prefix=/usr\ --host=$(DEB_HOST_GNU_TYPE) \ --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) ifneq ($(buildudeb),) rm -rf $(builddiru) mkdir $(builddiru) cd $(builddiru) && \ CFLAGS="$(CFLAGS) -Os" CPPFLAGS="$(CPPFLAGS)" $(srcdir)/configure \ --prefix=/usr\ --host=$(DEB_HOST_GNU_TYPE) \ --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) endif ifneq ($(build32),) rm -rf $(builddir32) mkdir $(builddir32) cd $(builddir32) && \ CC="$(CC32)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" $(srcdir)/configure \ --host=$(HOST32) --prefix=/usr endif ifneq ($(build64),) rm -rf $(builddir64) mkdir $(builddir64) cd $(builddir64) && \ CC="$(CC64)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" $(srcdir)/configure \ --host=$(HOST64) --prefix=/usr endif touch configure-stamp debian/%:debian/%.in sed 's/#DEB_HOST_MULTIARCH#/$(DEB_HOST_MULTIARCH)/g' $< > $@ build: build-stamp $(if $(filter cross,$(DEB_BUILD_PROFILES)),,build-rlfe-stamp) build-arch: build build-indep: build build-stamp: configure-stamp dh_testdir $(MAKE) -C $(builddir) \ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \ SHOBJ_CFLAGS="-fPIC -D_REENTRANT" \ SHOBJ_LDFLAGS='$(LDFLAGS) -shared' \ SHLIB_LIBS="-ltinfo" ifneq ($(buildudeb),) $(MAKE) -C $(builddiru) \ CFLAGS="$(CFLAGS) -Os" CPPFLAGS="$(CPPFLAGS)" \ SHOBJ_CFLAGS="-fPIC -D_REENTRANT" \ SHOBJ_LDFLAGS='$(LDFLAGS) -shared' \ SHLIB_LIBS="-ltinfo" endif ifneq ($(build32),) $(MAKE) -C $(builddir32) \ CC="$(CC32)" \ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \ SHOBJ_CFLAGS="-fPIC -D_REENTRANT" \ SHOBJ_LDFLAGS='$(LDFLAGS) -shared' \ SHLIB_LIBS="-ltinfo" SHLIB_XLDFLAGS='-Wl,-soname,`echo $$@ | sed s/\\..$$$$//`' endif ifneq ($(build64),) $(MAKE) -C $(builddir64) \ CC="$(CC64)" \ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \ SHOBJ_CFLAGS="-fPIC -D_REENTRANT" \ SHOBJ_LDFLAGS='$(LDFLAGS) -shared' \ SHLIB_LIBS="-ltinfo" SHLIB_XLDFLAGS='-Wl,-soname,`echo $$@ | sed s/\\..$$$$//`' endif $(MAKE) -C $(builddir)/doc info touch build-stamp build-rlfe-stamp: configure-stamp dh_testdir ln -sf libhistory.so.$(libversion) \ $(builddir)/shlib/libhistory.so.$(soversion) ln -sf libhistory.so.$(soversion) $(builddir)/shlib/libhistory.so ln -sf libreadline.so.$(libversion) \ $(builddir)/shlib/libreadline.so.$(soversion) ln -sf libreadline.so.$(soversion) $(builddir)/shlib/libreadline.so rm -rf $(builddir)/examples/rlfe cp -a examples/rlfe $(builddir)/examples/ ln -sf ../../.. $(builddir)/examples/rlfe/readline chmod +x $(builddir)/examples/rlfe/configure cd $(builddir)/examples/rlfe \ && ./configure --prefix=/usr --host=$(DEB_HOST_GNU_TYPE) \ CFLAGS="$(CFLAGS) -Wno-implicit-int -Wno-implicit-function-declaration -Wno-builtin-declaration-mismatch -D_GNU_SOURCE" CPPFLAGS="$(CPPFLAGS)" $(MAKE) -C $(builddir)/examples/rlfe \ CFLAGS="$(CFLAGS) -Wno-implicit-int -Wno-implicit-function-declaration -Wno-builtin-declaration-mismatch -D_GNU_SOURCE" CPPFLAGS="$(CPPFLAGS)" \ LDFLAGS="$(LDFLAGS) -g -L$(builddir)/shlib" \ LIBS="-lreadline -ltinfo -lutil" rlfe touch build-rlfe-stamp clean: dh_testdir dh_testroot rm -f configure*-stamp build*-stamp install-stamp rm -rf autom4te.cache rm -rf $(builddir) $(builddir32) $(builddir64) $(builddiru) rm -rf debian/tmp* rm -f doc/*.dvi rm -f debian/shlibs.local find . -type d | xargs chmod g-s rm -f support/config.guess support/config.sub rm -f debian/libreadline8t64.preinst debian/libreadline8t64.postrm dh_clean install: install-stamp install-stamp: dh_testdir dh_testroot dh_prep rm -rf $(d) mkdir -p $(d)/usr/bin mkdir -p $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig $(MAKE) -C $(builddir) install \ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS) -D_REENTRANT" \ SHOBJ_LDFLAGS='-shared $(LDFLAGS)' \ SHLIB_XLDFLAGS='-Wl,-soname,`echo $$@ | sed s/\\..$$$$//`' \ SHLIB_LIBS=-ltinfo \ DESTDIR=$(CURDIR)/$(d) \ mandir=/usr/share/man \ infodir=/usr/share/info : # move $(p_rl) dh_installdirs -p$(p_rl) \ usr/lib/$(DEB_HOST_MULTIARCH) \ usr/share/doc cp -a $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/lib{history,readline}.so.* $(d_rl)/usr/lib/$(DEB_HOST_MULTIARCH)/ : # move $(p_comm) dh_installdirs -p$(p_comm) \ etc \ usr/share/readline \ usr/share/info \ usr/share/doc mv $(d)/usr/share/man $(d_comm)/usr/share/. mv $(d_comm)/usr/share/man/man3/history.3 \ $(d_comm)/usr/share/man/man3/history.3readline mv $(d_comm)/usr/share/man/man3/readline.3 \ $(d_comm)/usr/share/man/man3/readline.3readline mv $(d)/usr/share/info/rluserman.info $(d_comm)/usr/share/info/. install -m 644 debian/inputrc $(d_comm)/usr/share/readline/ : # move $(p_rld) dh_installdirs -p$(p_rld) \ usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \ usr/share/doc \ usr/share/info ln -s libhistory.so.$(soversion) \ $(d_rld)/usr/lib/$(DEB_HOST_MULTIARCH)/libhistory.so ln -s libreadline.so.$(soversion) \ $(d_rld)/usr/lib/$(DEB_HOST_MULTIARCH)/libreadline.so mv $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/lib{history,readline}.a \ $(d_rld)/usr/lib/$(DEB_HOST_MULTIARCH)/. mv $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/readline.pc \ $(d_rld)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/. mv $(d)/usr/include $(d_rld)/usr/. : # remove HAVE_CONFIG_H from installed headers awk '/^#if defined \(HAVE_CONFIG_H\)/, /^#endif/ \ {if ($$0 == "#else") print "#include "; next} {print}' \ $(d_rld)/usr/include/readline/chardefs.h \ > $(d_rld)/usr/include/readline/chardefs.h.new if diff -u $(d_rld)/usr/include/readline/chardefs.h \ $(d_rld)/usr/include/readline/chardefs.h.new; \ then \ rm -f $(d_rld)/usr/include/readline/chardefs.h.new; \ else \ mv -f $(d_rld)/usr/include/readline/chardefs.h.new \ $(d_rld)/usr/include/readline/chardefs.h; \ fi ifeq (,$(filter cross,$(DEB_BUILD_PROFILES))) : # install $(p_rlfe) dh_installdirs -p$(p_rlfe) \ usr/bin usr/share/man/man1 \ usr/share/doc/$(p_rlfe) cp -p $(builddir)/examples/rlfe/rlfe $(d_rlfe)/usr/bin/. cp -p debian/rlfe.1 $(d_rlfe)/usr/share/man/man1/. endif ifneq ($(buildudeb),) rm -rf $(du) mkdir -p $(du)/usr/bin mkdir -p $(du)/usr/lib/pkgconfig $(MAKE) -C $(builddiru) install \ CC="$(CCu)" \ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS) -D_REENTRANT" \ SHOBJ_LDFLAGS='-shared $(LDFLAGS)' \ SHLIB_XLDFLAGS='-Wl,-soname,`echo $$@ | sed s/\\..$$$$//`' \ SHLIB_LIBS=-ltinfo \ DESTDIR=$(CURDIR)/$(du) \ mandir=/usr/share/man \ infodir=/usr/share/info dh_installdirs -p$(p_rlu) \ usr/lib/$(DEB_HOST_MULTIARCH) cp -p $(du)/usr/lib/$(DEB_HOST_MULTIARCH)/lib{history,readline}.so.$(libversion) \ $(d_rlu)/usr/lib/$(DEB_HOST_MULTIARCH)/ ln -s libhistory.so.$(libversion) \ $(d_rlu)/usr/lib/$(DEB_HOST_MULTIARCH)/libhistory.so.$(soversion) ln -s libreadline.so.$(libversion) \ $(d_rlu)/usr/lib/$(DEB_HOST_MULTIARCH)/libreadline.so.$(soversion) dh_installdirs -p$(p_commu) \ usr/share/readline install -m 644 debian/inputrc $(d_commu)/usr/share/readline/ endif ifneq ($(build32),) rm -rf $(d32) mkdir -p $(d32)/usr/bin mkdir -p $(d32)/usr/lib/pkgconfig $(MAKE) -C $(builddir32) install \ CC="$(CC32)" \ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS) -D_REENTRANT" \ SHOBJ_LDFLAGS='-shared $(LDFLAGS)' \ SHLIB_XLDFLAGS='-Wl,-soname,`echo $$@ | sed s/\\..$$$$//`' \ SHLIB_LIBS=-ltinfo \ DESTDIR=$(CURDIR)/$(d32) \ mandir=/usr/share/man \ infodir=/usr/share/info dh_installdirs -p$(p_rl32) \ $(lib32dir) \ usr/share/doc cp -p $(d32)/usr/lib/lib{history,readline}.so.$(libversion) \ $(d_rl32)/$(lib32dir)/ ln -s libhistory.so.$(libversion) \ $(d_rl32)/$(lib32dir)/libhistory.so.$(soversion) ln -s libreadline.so.$(libversion) \ $(d_rl32)/$(lib32dir)/libreadline.so.$(soversion) dh_installdirs -p$(p_rld32) \ $(lib32dir) \ usr/share/doc ln -s libhistory.so.$(soversion) \ $(d_rld32)/$(lib32dir)/libhistory.so ln -s libreadline.so.$(soversion) \ $(d_rld32)/$(lib32dir)/libreadline.so mv $(d32)/usr/lib/lib{history,readline}.a $(d_rld32)/$(lib32dir)/. endif ifneq ($(build64),) rm -rf $(d64) mkdir -p $(d64)/usr/bin mkdir -p $(d64)/usr/lib/pkgconfig $(MAKE) -C $(builddir64) install \ CC="$(CC64)" \ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS) -D_REENTRANT" \ SHOBJ_LDFLAGS='-shared $(LDFLAGS)' \ SHLIB_XLDFLAGS='-Wl,-soname,`echo $$@ | sed s/\\..$$$$//`' \ SHLIB_LIBS=-ltinfo \ DESTDIR=$(CURDIR)/$(d64) \ mandir=/usr/share/man \ infodir=/usr/share/info dh_installdirs -p$(p_rl64) \ $(lib64dir) \ usr/share/doc dh_installdirs -p$(p_rld64) \ usr/share/doc cp -p $(d64)/usr/lib/lib{history,readline}.so.$(libversion) \ $(d_rl64)/$(lib64dir)/ ln -s libhistory.so.$(libversion) \ $(d_rl64)/$(lib64dir)/libhistory.so.$(soversion) ln -s libreadline.so.$(libversion) \ $(d_rl64)/$(lib64dir)/libreadline.so.$(soversion) dh_installdirs -p$(p_rld64) \ $(lib64dir) \ usr/share/doc ln -s libhistory.so.$(soversion) \ $(d_rld64)/$(lib64dir)/libhistory.so ln -s libreadline.so.$(soversion) \ $(d_rld64)/$(lib64dir)/libreadline.so mv $(d64)/usr/lib/lib{history,readline}.a $(d_rld64)/$(lib64dir)/. endif : # $(p_doc) mkdir -p $(d_doc)/usr/share/info mv $(d)/usr/share/info/{readline.info,history.info} \ $(d_doc)/usr/share/info/. touch install-stamp binary-indep: build install dh_testdir dh_testroot mkdir -p $(d_doc)/usr/share/doc/$(p_rl)/examples cp -p $(builddir)/examples/Makefile examples/*.c \ $(d_doc)/usr/share/doc/$(p_rl)/examples/ sed -i \ -e '/^srcdir =/s,=.*,= /usr/share/doc/$(p_rl)/examples,' \ -e '/^VPATH =/s,=.*,= .:/usr/share/doc/$(p_rl)/examples,' \ -e '/^top_srcdir =/s,=.*,= /usr/include/readline,' \ -e '/^BUILD_DIR =/s,=.*,= /usr/src/readline6/build,' \ -e 's/-ffile-prefix-map=[^ ]*[ ]*//g' \ -e 's/-fdebug-prefix-map=[^ ]*[ ]*//g' \ $(d_doc)/usr/share/doc/$(p_rl)/examples/Makefile dh_link -p$(p_doc) \ /usr/share/doc/$(p_rl)/examples /usr/share/doc/$(p_doc)/examples mkdir -p $(d_comm)/usr/share/lintian/overrides cp -p debian/readline-common.overrides \ $(d_comm)/usr/share/lintian/overrides/readline-common dh_installdocs -p$(p_comm) debian/inputrc.arrows dh_installdocs -p$(p_doc) dh_installchangelogs -i dh_installdocs -i dh_fixperms -i dh_compress -i dh_installdeb -i dh_gencontrol -i dh_md5sums -i dh_builddeb -i binary-arch: build install debian/libreadline8t64.preinst debian/libreadline8t64.postrm dh_testdir dh_testroot dh_installdocs -p$(p_rl) \ USAGE debian/inputrc.arrows dh_installchangelogs -p$(p_rl) CHANGES dh_installexamples -p$(p_rl) \ examples/Inputrc ln -sf $(p_rl) $(d_rld)/usr/share/doc/$(p_rld) dh_installdocs -p$(p_rlfe) examples/rlfe/README dh_installchangelogs -p$(p_rlfe) examples/rlfe/ChangeLog dh_fixperms -p$(p_rl) -p$(p_rld) -p$(p_rlfe) dh_strip -p$(p_rl) -p$(p_rld) -p$(p_rlfe) dh_compress -p$(p_rl) -p$(p_rld) -p$(p_rlfe) \ -X.c -XMakefile dh_makeshlibs -p$(p_rl) --add-udeb=$(p_rlu) cp -p debian/libreadline.shlibs debian/shlibs.local dh_shlibdeps -p$(p_rl) -p$(p_rld) -p$(p_rlfe) \ -L $(p_rl) -l $(d_rl)/usr/lib ifneq ($(buildudeb),) dh_compress -p$(p_rlu) dh_fixperms -p$(p_rlu) dh_strip -p$(p_rlu) dh_makeshlibs -p$(p_rlu) -dh_shlibdeps -p$(p_rlu) \ -L $(p_rlu) -l $(d_rlu)/usr/lib endif ifneq ($(build32),) -ls -l $(d_rld)/usr/share/doc/$(p_rl) dh_installdocs -p$(p_rl32) \ USAGE debian/inputrc.arrows dh_installchangelogs -p$(p_rl32) CHANGES ln -sf $(p_rl32) $(d_rld32)/usr/share/doc/$(p_rld32) dh_compress -p$(p_rl32) -p$(p_rld32) dh_fixperms -p$(p_rl32) -p$(p_rld32) dh_strip -p$(p_rl32) -p$(p_rld32) dh_makeshlibs -p$(p_rl32) -dh_shlibdeps -p$(p_rl32) -p$(p_rld32) \ -L $(p_rl32) -l $(d_rl32)/usr/lib -ls -l $(d_rld)/usr/share/doc/$(p_rl) endif ifneq ($(build64),) -ls -l $(d_rld)/usr/share/doc/$(p_rl) dh_installdocs -p$(p_rl64) \ USAGE debian/inputrc.arrows dh_installchangelogs -p$(p_rl64) CHANGES ln -sf $(p_rl64) $(d_rld64)/usr/share/doc/$(p_rld64) dh_compress -p$(p_rl64) -p$(p_rld64) dh_fixperms -p$(p_rl64) -p$(p_rld64) dh_strip -p$(p_rl64) -p$(p_rld64) dh_makeshlibs -p$(p_rl64) -dh_shlibdeps -p$(p_rl64) -p$(p_rld64) \ -L $(p_rl64) -l $(d_rl64)/usr/lib -ls -l $(d_rld)/usr/share/doc/$(p_rl) endif dh_installdeb -a dh_gencontrol -a $(gencontrol_flags) dh_md5sums -a dh_builddeb -a binary: binary-indep binary-arch .PHONY: binary binary-arch binary-indep clean # Local Variables: # mode: makefile # end: