Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1 | #!/usr/bin/make -f |
| 2 | # MAde with the aid of dh_make, by Craig Small |
| 3 | # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. |
| 4 | # Some lines taken from debmake, by Cristoph Lameter. |
| 5 | |
| 6 | # Uncomment this to turn on verbose mode. |
| 7 | #export DH_VERBOSE=1 |
| 8 | |
| 9 | # packages |
| 10 | NCURSES_PKG = ncurses-examples |
| 11 | NCURSEST_PKG = ncursest-examples |
| 12 | |
| 13 | PACKAGES.indep = # ncurses-examples-docs |
| 14 | PACKAGES.arch = $(NCURSES_PKG) $(NCURSEST_PKG) |
| 15 | |
| 16 | # These are used for cross-compiling and for saving the configure script |
| 17 | # from having to guess our platform (since we know it already) |
| 18 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
| 19 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
| 20 | |
| 21 | CFLAGS = |
| 22 | |
| 23 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
| 24 | CFLAGS += -O0 |
| 25 | else |
| 26 | CFLAGS += -O2 |
| 27 | endif |
| 28 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) |
| 29 | INSTALL_PROGRAM += -s |
| 30 | endif |
| 31 | |
| 32 | verbose = # -v |
| 33 | |
| 34 | configure = \ |
| 35 | CFLAGS="$(CFLAGS)" ../../configure \ |
| 36 | --host=$(DEB_HOST_GNU_TYPE) \ |
| 37 | --build=$(DEB_BUILD_GNU_TYPE) \ |
| 38 | --prefix=/usr \ |
| 39 | --disable-rpath-hack |
| 40 | |
| 41 | .PHONY: all config build install binary clean config-indep config-arch \ |
| 42 | build-indep build-arch install-indep install-arch binary-indep \ |
| 43 | binary-arch |
| 44 | |
| 45 | all: build |
| 46 | |
| 47 | config: config-indep config-arch |
| 48 | build: build-indep build-arch |
| 49 | install: install-indep install-arch |
| 50 | binary: binary-indep binary-arch |
| 51 | clean: |
| 52 | dh_testdir |
| 53 | dh_testroot |
| 54 | dh_clean $(verbose) |
| 55 | rm -rf t |
| 56 | |
| 57 | config-indep: $(PACKAGES.indep:%=config-%-stamp) |
| 58 | config-arch: $(PACKAGES.arch:%=config-%-stamp) |
| 59 | |
| 60 | build-indep: $(PACKAGES.indep:%=build-%-stamp) |
| 61 | build-arch: $(PACKAGES.arch:%=build-%-stamp) |
| 62 | |
| 63 | install-indep: $(PACKAGES.indep:%=install-%-stamp) |
| 64 | install-arch: $(PACKAGES.arch:%=install-%-stamp) |
| 65 | |
| 66 | config-$(NCURSES_PKG)-stamp: |
| 67 | dh_testdir |
| 68 | |
| 69 | rm -rf t/ncurses6 |
| 70 | mkdir -p t/ncurses6 |
| 71 | |
| 72 | cd t/ncurses6; $(configure) \ |
| 73 | --bindir=\$${prefix}/bin/$(NCURSES_PKG) \ |
| 74 | --with-screen=ncursesw6 |
| 75 | |
| 76 | touch $@ |
| 77 | |
| 78 | config-$(NCURSEST_PKG)-stamp: |
| 79 | dh_testdir |
| 80 | |
| 81 | rm -rf t/ncursest6 |
| 82 | mkdir -p t/ncursest6 |
| 83 | |
| 84 | cd t/ncursest6; $(configure) \ |
| 85 | --bindir=\$${prefix}/bin/$(NCURSEST_PKG) \ |
| 86 | --with-screen=ncursestw6 |
| 87 | |
| 88 | touch $@ |
| 89 | |
| 90 | build-$(NCURSES_PKG)-stamp: config-$(NCURSES_PKG)-stamp |
| 91 | dh_testdir |
| 92 | |
| 93 | $(MAKE) -C t/ncurses6 |
| 94 | |
| 95 | touch $@ |
| 96 | |
| 97 | build-$(NCURSEST_PKG)-stamp: config-$(NCURSEST_PKG)-stamp |
| 98 | dh_testdir |
| 99 | |
| 100 | $(MAKE) -C t/ncursest6 |
| 101 | |
| 102 | touch $@ |
| 103 | |
| 104 | install-$(NCURSES_PKG)-stamp: build-$(NCURSES_PKG)-stamp |
| 105 | dh_testdir |
| 106 | dh_testroot |
| 107 | dh_installdirs $(verbose) |
| 108 | dh_prep $(verbose) -p$(NCURSES_PKG) |
| 109 | |
| 110 | $(MAKE) -C t/ncurses6 install DESTDIR=$(CURDIR)/debian/$(NCURSES_PKG) |
| 111 | |
| 112 | touch $@ |
| 113 | |
| 114 | install-$(NCURSEST_PKG)-stamp: build-$(NCURSEST_PKG)-stamp |
| 115 | dh_testdir |
| 116 | dh_testroot |
| 117 | dh_installdirs $(verbose) |
| 118 | dh_prep $(verbose) -p$(NCURSEST_PKG) |
| 119 | |
| 120 | $(MAKE) -C t/ncursest6 install DESTDIR=$(CURDIR)/debian/$(NCURSEST_PKG) |
| 121 | |
| 122 | touch $@ |
| 123 | |
| 124 | # Build architecture-independent files here. |
| 125 | binary-indep: install-indep |
| 126 | ifneq ($(PACKAGES.indep),) |
| 127 | rm -f $(PACKAGES.indep:%=install-%-stamp) |
| 128 | dh_testdir |
| 129 | dh_testroot |
| 130 | dh_installdocs $(verbose) $(PACKAGES.indep:%=-p%) |
| 131 | dh_installman $(verbose) $(PACKAGES.indep:%=-p%) |
| 132 | dh_installexamples $(verbose) $(PACKAGES.indep:%=-p%) |
| 133 | dh_installchangelogs $(verbose) $(PACKAGES.indep:%=-p%) NEWS |
| 134 | dh_compress $(verbose) $(PACKAGES.indep:%=-p%) |
| 135 | dh_fixperms $(verbose) $(PACKAGES.indep:%=-p%) |
| 136 | dh_installdeb $(verbose) $(PACKAGES.indep:%=-p%) |
| 137 | dh_gencontrol $(verbose) $(PACKAGES.indep:%=-p%) |
| 138 | dh_md5sums $(verbose) $(PACKAGES.indep:%=-p%) |
| 139 | dh_builddeb $(verbose) $(PACKAGES.indep:%=-p%) |
| 140 | endif |
| 141 | |
| 142 | # Build architecture-dependent files here. |
| 143 | binary-arch: install-arch |
| 144 | ifneq ($(PACKAGES.arch),) |
| 145 | rm -f $(PACKAGES.arch:%=install-%-stamp) |
| 146 | dh_testdir |
| 147 | dh_testroot |
| 148 | dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%) NEWS |
| 149 | dh_strip $(verbose) $(PACKAGES.arch:%=-p%) |
| 150 | dh_compress $(verbose) $(PACKAGES.arch:%=-p%) |
| 151 | dh_fixperms $(verbose) $(PACKAGES.arch:%=-p%) |
| 152 | dh_installdeb $(verbose) $(PACKAGES.arch:%=-p%) |
| 153 | dh_makeshlibs $(verbose) $(PACKAGES.arch:%=-p%) |
| 154 | dh_shlibdeps $(verbose) $(PACKAGES.arch:%=-p%) |
| 155 | dh_gencontrol $(verbose) $(PACKAGES.arch:%=-p%) |
| 156 | dh_md5sums $(verbose) $(PACKAGES.arch:%=-p%) |
| 157 | dh_builddeb $(verbose) $(PACKAGES.arch:%=-p%) |
| 158 | endif |