| 1 | #!/usr/bin/make -f |
|---|
| 2 | # Based on public domain debhelper example rules.multi2 by Joey Hess. |
|---|
| 3 | # |
|---|
| 4 | # Copyright (C) 2005,2006 Olly Betts |
|---|
| 5 | # |
|---|
| 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. |
|---|
| 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 | |
|---|
| 17 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
|---|
| 18 | CFLAGS += -O0 |
|---|
| 19 | CXXFLAGS += -O0 |
|---|
| 20 | else |
|---|
| 21 | CFLAGS += -O2 |
|---|
| 22 | CXXFLAGS += -O2 |
|---|
| 23 | endif |
|---|
| 24 | ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) |
|---|
| 25 | STRIP=/bin/true |
|---|
| 26 | endif |
|---|
| 27 | |
|---|
| 28 | # Make sure DEB_BUILD_GNU_TYPE and DEB_HOST_GNU_TYPE are set even if |
|---|
| 29 | # we aren't called from dpkg-buildpackage, but don't reset them if |
|---|
| 30 | # they're already set so the caller can override dpkg-architecture. |
|---|
| 31 | export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
|---|
| 32 | export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
|---|
| 33 | |
|---|
| 34 | build: build-stamp |
|---|
| 35 | build-stamp: |
|---|
| 36 | dh_testdir |
|---|
| 37 | |
|---|
| 38 | ./configure --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --enable-docdir=\$${prefix}/share/doc/survex CFLAGS=$(CFLAGS) CXXFLAGS=$(CXXFLAGS) STRIP=$(STRIP) |
|---|
| 39 | $(MAKE) |
|---|
| 40 | ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) |
|---|
| 41 | $(MAKE) check |
|---|
| 42 | endif |
|---|
| 43 | touch build-stamp |
|---|
| 44 | |
|---|
| 45 | clean: |
|---|
| 46 | dh_testdir |
|---|
| 47 | dh_testroot |
|---|
| 48 | rm -f build-stamp |
|---|
| 49 | |
|---|
| 50 | -$(MAKE) distclean |
|---|
| 51 | |
|---|
| 52 | dh_clean |
|---|
| 53 | |
|---|
| 54 | install: DH_OPTIONS= |
|---|
| 55 | install: build |
|---|
| 56 | dh_testdir |
|---|
| 57 | dh_testroot |
|---|
| 58 | dh_clean -k |
|---|
| 59 | dh_installdirs |
|---|
| 60 | |
|---|
| 61 | $(MAKE) DESTDIR=`pwd`/debian/tmp install |
|---|
| 62 | install -d debian/survex/usr/share/vim/addons/ftdetect |
|---|
| 63 | install -d debian/survex/usr/share/vim/addons/syntax |
|---|
| 64 | install -m 0644 vim/ftdetect/survex.vim debian/survex/usr/share/vim/addons/ftdetect |
|---|
| 65 | install -m 0644 vim/syntax/survex.vim debian/survex/usr/share/vim/addons/syntax |
|---|
| 66 | |
|---|
| 67 | dh_install --fail-missing |
|---|
| 68 | |
|---|
| 69 | # This single target is used to build all the packages, all at once, or |
|---|
| 70 | # one at a time. So keep in mind: any options passed to commands here will |
|---|
| 71 | # affect _all_ packages. Anything you want to only affect one package |
|---|
| 72 | # should be put in another target, such as the install target. |
|---|
| 73 | binary-common: |
|---|
| 74 | # Avoid warning: |
|---|
| 75 | # dpkg-gencontrol: warning: unknown substitution variable ${misc:Depends} |
|---|
| 76 | echo 'misc:Depends=' > debian/survex.substvars |
|---|
| 77 | dh_testdir |
|---|
| 78 | dh_testroot |
|---|
| 79 | dh_installchangelogs |
|---|
| 80 | dh_installdocs |
|---|
| 81 | dh_installexamples |
|---|
| 82 | dh_installmenu |
|---|
| 83 | # FIXME: investigate using dh_installmime |
|---|
| 84 | # dh_installmime |
|---|
| 85 | dh_strip |
|---|
| 86 | dh_link |
|---|
| 87 | dh_compress |
|---|
| 88 | dh_fixperms |
|---|
| 89 | dh_installdeb |
|---|
| 90 | dh_shlibdeps |
|---|
| 91 | dh_gencontrol |
|---|
| 92 | dh_md5sums |
|---|
| 93 | dh_builddeb |
|---|
| 94 | |
|---|
| 95 | # Build architecture independent packages using the common target. |
|---|
| 96 | binary-indep: build install |
|---|
| 97 | $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common |
|---|
| 98 | |
|---|
| 99 | # Build architecture dependant packages using the common target. |
|---|
| 100 | binary-arch: build install |
|---|
| 101 | $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common |
|---|
| 102 | |
|---|
| 103 | # Any other binary targets build just one binary package at a time. |
|---|
| 104 | binary-%: build install |
|---|
| 105 | make -f debian/rules binary-common DH_OPTIONS=-p$* |
|---|
| 106 | |
|---|
| 107 | binary: binary-indep binary-arch |
|---|
| 108 | .PHONY: build clean binary-indep binary-arch binary-common binary install |
|---|