| [70d428e] | 1 | #!/usr/bin/make -f |
|---|
| [a061c14a] | 2 | # Based on public domain debhelper example rules.multi2 by Joey Hess. |
|---|
| [b462168] | 3 | # |
|---|
| [bc59149] | 4 | # Copyright (C) 2005,2006,2010 Olly Betts |
|---|
| [70d428e] | 5 | # |
|---|
| [a061c14a] | 6 | # GPL licensed. |
|---|
| 7 | # |
|---|
| 8 | # This is a multibinary package. You can build any of the binary packages |
|---|
| 9 | # independently by using the appropriate binary-<package> target. |
|---|
| [70d428e] | 10 | |
|---|
| 11 | # Uncomment this to turn on verbose mode. |
|---|
| 12 | #export DH_VERBOSE=1 |
|---|
| 13 | |
|---|
| 14 | # This has to be exported to make some magic below work. |
|---|
| 15 | export DH_OPTIONS |
|---|
| 16 | |
|---|
| [b462168] | 17 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
|---|
| 18 | CFLAGS += -O0 |
|---|
| [a061c14a] | 19 | CXXFLAGS += -O0 |
|---|
| [b462168] | 20 | else |
|---|
| 21 | CFLAGS += -O2 |
|---|
| [a061c14a] | 22 | CXXFLAGS += -O2 |
|---|
| [b462168] | 23 | endif |
|---|
| 24 | ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) |
|---|
| [a061c14a] | 25 | STRIP=/bin/true |
|---|
| [b462168] | 26 | endif |
|---|
| [bc59149] | 27 | ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
|---|
| 28 | NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
|---|
| 29 | MAKEFLAGS += -j$(NUMJOBS) |
|---|
| 30 | endif |
|---|
| [b462168] | 31 | |
|---|
| [bc59149] | 32 | ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) |
|---|
| 33 | # Disable the testsuite when cross-compiling. |
|---|
| 34 | DEB_BUILD_OPTIONS += nocheck |
|---|
| 35 | endif |
|---|
| [a061c14a] | 36 | |
|---|
| [70d428e] | 37 | build: build-stamp |
|---|
| 38 | build-stamp: |
|---|
| 39 | dh_testdir |
|---|
| 40 | |
|---|
| [bc59149] | 41 | # Use the latest config.sub and config.guess from the autotools-dev |
|---|
| 42 | # package. |
|---|
| 43 | rm -f config.sub config.guess |
|---|
| 44 | ln -s /usr/share/misc/config.sub config.sub |
|---|
| 45 | ln -s /usr/share/misc/config.guess config.guess |
|---|
| 46 | |
|---|
| 47 | ./configure --prefix=/usr --mandir=\$${prefix}/share/man --enable-docdir=\$${prefix}/share/doc/survex CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" STRIP="$(STRIP)" |
|---|
| [70d428e] | 48 | $(MAKE) |
|---|
| [bc59149] | 49 | ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) |
|---|
| 50 | $(MAKE) check DISPLAY= |
|---|
| [7ad2d31] | 51 | endif |
|---|
| [70d428e] | 52 | touch build-stamp |
|---|
| 53 | |
|---|
| 54 | clean: |
|---|
| 55 | dh_testdir |
|---|
| 56 | dh_testroot |
|---|
| 57 | |
|---|
| [bc59149] | 58 | [ ! -f Makefile ] || $(MAKE) distclean |
|---|
| [70d428e] | 59 | |
|---|
| [bc59149] | 60 | rm -f config.sub config.guess |
|---|
| [70d428e] | 61 | dh_clean |
|---|
| 62 | |
|---|
| 63 | install: DH_OPTIONS= |
|---|
| 64 | install: build |
|---|
| 65 | dh_testdir |
|---|
| 66 | dh_testroot |
|---|
| [bc59149] | 67 | dh_prep |
|---|
| [70d428e] | 68 | dh_installdirs |
|---|
| 69 | |
|---|
| [a061c14a] | 70 | $(MAKE) DESTDIR=`pwd`/debian/tmp install |
|---|
| [bc59149] | 71 | install -d debian/survex/usr/share/vim/addons/ftdetect |
|---|
| 72 | install -d debian/survex/usr/share/vim/addons/syntax |
|---|
| 73 | install -d debian/survex/usr/share/vim/registry |
|---|
| 74 | install -m 0644 vim/ftdetect/survex.vim debian/survex/usr/share/vim/addons/ftdetect |
|---|
| 75 | install -m 0644 vim/syntax/survex.vim debian/survex/usr/share/vim/addons/syntax |
|---|
| 76 | install -m 0644 debian/vim-survex.yaml debian/survex/usr/share/vim/registry |
|---|
| [70d428e] | 77 | |
|---|
| [a061c14a] | 78 | dh_install --fail-missing |
|---|
| [70d428e] | 79 | |
|---|
| 80 | # This single target is used to build all the packages, all at once, or |
|---|
| 81 | # one at a time. So keep in mind: any options passed to commands here will |
|---|
| 82 | # affect _all_ packages. Anything you want to only affect one package |
|---|
| 83 | # should be put in another target, such as the install target. |
|---|
| [a061c14a] | 84 | binary-common: |
|---|
| [70d428e] | 85 | dh_testdir |
|---|
| 86 | dh_testroot |
|---|
| [a061c14a] | 87 | dh_installchangelogs |
|---|
| [70d428e] | 88 | dh_installdocs |
|---|
| 89 | dh_installexamples |
|---|
| 90 | dh_installmenu |
|---|
| [a061c14a] | 91 | # FIXME: investigate using dh_installmime |
|---|
| [70d428e] | 92 | # dh_installmime |
|---|
| 93 | dh_strip |
|---|
| [a061c14a] | 94 | dh_link |
|---|
| [70d428e] | 95 | dh_compress |
|---|
| 96 | dh_fixperms |
|---|
| 97 | dh_installdeb |
|---|
| 98 | dh_shlibdeps |
|---|
| 99 | dh_gencontrol |
|---|
| 100 | dh_md5sums |
|---|
| 101 | dh_builddeb |
|---|
| 102 | |
|---|
| [a061c14a] | 103 | # Build architecture independent packages using the common target. |
|---|
| 104 | binary-indep: build install |
|---|
| [34c131f] | 105 | $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common |
|---|
| [70d428e] | 106 | |
|---|
| 107 | # Build architecture dependant packages using the common target. |
|---|
| [a061c14a] | 108 | binary-arch: build install |
|---|
| [70d428e] | 109 | $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common |
|---|
| 110 | |
|---|
| 111 | # Any other binary targets build just one binary package at a time. |
|---|
| 112 | binary-%: build install |
|---|
| 113 | make -f debian/rules binary-common DH_OPTIONS=-p$* |
|---|
| 114 | |
|---|
| [a061c14a] | 115 | binary: binary-indep binary-arch |
|---|
| 116 | .PHONY: build clean binary-indep binary-arch binary-common binary install |
|---|