#! /usr/bin/make -f # # debian/rules file - for troffcvt. # # Copyright 1996, 1997 by Ben Pfaff. # Copyright 2001 by Colin Watson. # Original Makefile by Ian Jackson. # # This Makefile 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 Makefile 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 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # # The author may be contacted at on the # Internet, or as Ben Pfaff, 12167 Airport Rd, DeWitt MI 48820, USA # through more mundane means. export package=troffcvt # It's really not a good idea to hard-code this, but we're guaranteed # a FSSTND filesystem under Debian GNU/Linux so we might as well take # advantage of it. NOTE: Our utilities must come before /usr/bin, # otherwise if the package is already installed there may be # interference. export PATH=$(CURDIR)/lib:/bin:/usr/bin:/usr/bin/X11 export TROFFCVT_LIB_DIR=$(CURDIR)/debian/troffcvt/usr/share/troffcvt docdir=usr/share/doc/$(package) # troffcvt version. troffcvt_version = 1.04 # Checker with version. export troffcvt = troffcvt-$(troffcvt_version) packages = $(wrprc) $(etm) $(imboot) $(memmgr) $(msub) $(portlib) \ $(tokenscan) $(troffcvt) # Most packages depend on these tools. tools = lib/_x_ $(imboot)/_b_ $(msub)/_b_ $(wrprc)/_b_ # Dependent library versions wrprc_version = 2.11 etm_version = 1.09 imboot_version = 1.03 memmgr_version = 1.04 msub_version = 1.13 portlib_version = 1.01 tokenscan_version = 1.08 # Package directory names wrprc = WRPRC-$(wrprc_version) etm = etm imboot = imboot-$(imboot_version) memmgr = memmgr-$(memmgr_version) msub = msub-$(msub_version) portlib = portlib-$(portlib_version) tokenscan = tokenscan include /usr/share/dpkg/buildflags.mk # # Main targets # build-indep: build-arch: dh_testdir $(MAKE) -f debian/rules $(troffcvt)/_b_ touch $@ build: build-indep build-arch wrprc: $(wrprc)/_b_ etm: $(etm)/_b_ imboot: $(imboot)/_b_ memmgr: $(memmgr)/_b_ msub: $(msub)/_b_ portlib: $(portlib)/_b_ tokenscan: $(tokenscan)/_b_ unpack: lib/_x_ config/_x_ $(wrprc)/_x_ $(imboot)/_x_ $(msub)/_x_ \ $(portlib)/_x_ $(troffcvt)/_x_ memmgr-$(memmgr_version)/_x_ \ etm/_x_ tokenscan/_x_ patch: unpack clean: dh_testdir dh_clean -rm -rf $(packages) -rm -rf config lib install: build dh_testdir dh_testroot dh_prep dh_installdirs # Install into debian/troffcvt. make install install.man -C $(troffcvt) \ LIBDIR=$(CURDIR)/debian/troffcvt/usr/share/troffcvt \ USRLIBDIR=$(CURDIR)/debian/troffcvt/usr/share/troffcvt \ LOCALROOTDIR=$(CURDIR)/debian/troffcvt/usr \ MANROOT=$(CURDIR)/debian/troffcvt/usr/share/man \ # Convert documentation to HTML. (cd $(troffcvt)/doc; \ for d in *.ms; do \ soelim $$d | tblcvt | troff2html -ms tmac.wrprc -a tc.wrprc-html - \ > ../../debian/troffcvt/usr/share/doc/$(package)/`echo $$d | sed -e 's/\.ms/\.html/'`; \ done) debian/docs: debian/docs.in sed -e 's,@troffcvt@,$(troffcvt),g' $< > $@ binary-indep: build # There are no architecture-independent files. binary-arch: build install debian/docs dh_testdir dh_testroot dh_installdocs dh_installman dh_installchangelogs dh_link dh_strip dh_compress $(docdir)/Changes-1.01 $(docdir)/Changes-1.02 \ $(docdir)/Changes-1.03 $(docdir)/Changes-1.04 dh_fixperms dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb # # Miscellaneous # binary: binary-indep binary-arch .PHONY: binary binary-arch binary-indep install clean # # Build targets. # define build-link-farm set -e; \ file_list=`find subdir -name \*.[ah] -o -perm /111 -a -type f`; \ cd lib; \ for d in $$file_list; do \ ln -sf ../$$d .; \ done endef $(imboot)/_b_: lib/_x_ $(imboot)/_x_ sed $(imboot)/imboot.pl > lib/imboot \ -e "s#\$$(PERLPATH)#`which perl`#" \ -e "s#\$$(CONFIGROOTDIR)#`pwd`/config#" chmod a+x lib/imboot touch $(imboot)/_b_ $(msub)/_b_: lib/_x_ $(imboot)/_b_ $(msub)/_x_ gcc $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(msub)/msub.c -o lib/msub touch $(msub)/_b_ $(wrprc)/_b_: lib/_x_ config/_x_ $(msub)/_b_ $(wrprc)/_x_ sed $(wrprc)/config/site.def > $(wrprc)/config/site.def.temp \ -e "s%^#define ConfigRootDir .*\$$%#define ConfigRootDir \"`pwd`/config\"%" mv $(wrprc)/config/site.def.temp $(wrprc)/config/site.def (set -e; cd $(wrprc); make World; make install) touch $(wrprc)/_b_ $(portlib)/_b_: $(tools) $(portlib)/_x_ make -C $(portlib) World \ INCLUDES="-I $(CURDIR)/lib" \ CCOPTIONS="$(CPPFLAGS) $(CFLAGS)" \ LDFLAGS="$(LDFLAGS) -L $(CURDIR)/lib" $(build-link-farm:subdir=$(portlib)) touch $@ $(etm)/_b_: $(tools) $(etm)/_x_ make -C $(etm) World \ INCLUDES="-I $(CURDIR)/lib" \ CCOPTIONS="$(CPPFLAGS) $(CFLAGS)" \ LDFLAGS="$(LDFLAGS) -L $(CURDIR)/lib" $(build-link-farm:subdir=$(etm)) touch $@ $(tokenscan)/_b_: $(tools) $(tokenscan)/_x_ make -C $(tokenscan) World \ INCLUDES="-I $(CURDIR)/lib" \ CCOPTIONS="$(CPPFLAGS) $(CFLAGS)" \ LDFLAGS="$(LDFLAGS) -L $(CURDIR)/lib" $(build-link-farm:subdir=$(tokenscan)) touch $@ $(memmgr)/_b_: $(tools) $(memmgr)/_x_ make -C $(memmgr) World \ INCLUDES="-I $(CURDIR)/lib" \ CCOPTIONS="$(CPPFLAGS) $(CFLAGS)" \ LDFLAGS="$(LDFLAGS) -L $(CURDIR)/lib" $(build-link-farm:subdir=$(memmgr)) touch $@ $(troffcvt)/_b_: $(portlib)/_b_ $(etm)/_b_ $(tokenscan)/_b_ $(memmgr)/_b_ $(troffcvt)/_x_ make -C $(troffcvt) World \ INCLUDES="-I $(CURDIR)/lib" \ CCOPTIONS="$(CPPFLAGS) $(CFLAGS)" \ LDFLAGS="$(LDFLAGS) -L $(CURDIR)/lib" $(build-link-farm:subdir=$(troffcvt)) touch $@ # # Extract (_x_) targets # # The troffcvt libraries have the nasty property of changing form # after being compiled. Instead of dealing with this # lib/_x_: rm -rf lib mkdir lib touch lib/_x_ config/_x_: rm -rf config mkdir config touch config/_x_ $(wrprc)/_x_ $(imboot)/_x_ $(msub)/_x_ \ $(portlib)/_x_ $(troffcvt)/_x_: \ %/_x_: tarballs/%.tar ! test -e $(@:%/_x_=%) || rm -rf $(@:%/_x_=%) tar xf tarballs/$(@:%/_x_=%).tar test -f patches/$(@:%/_x_=%).diff \ && (set -e; cd $(@:%/_x_=%); \ patch -s -p1 < ../patches/$(@:%/_x_=%).diff) \ || true touch $@ memmgr-$(memmgr_version)/_x_: tarballs/MemMgr-$(memmgr_version).tar ! test -e $(@:%/_x_=%) || rm -rf $(@:%/_x_=%) tar xf tarballs/MemMgr-$(memmgr_version).tar touch $@ etm/_x_: tarballs/ETM-$(etm_version).tar ! test -e $(@:%/_x_=%) || rm -rf $(@:%/_x_=%) tar xf tarballs/ETM-$(etm_version).tar touch $@ tokenscan/_x_: tarballs/TS-$(tokenscan_version).tar ! test -e $(@:%/_x_=%) || rm -rf $(@:%/_x_=%) tar xf tarballs/TS-$(tokenscan_version).tar touch $@ # Local Variables: # mode:makefile # End: