blob: 2cc34f7305ef00fe1cff5d4fc2ea495915aafdf3 [file] [log] [blame]
Steve Kondikae271bc2015-11-15 02:50:53 +01001#!/usr/bin/make -f
micky3879b9f5e72025-07-08 18:04:53 -04002# Made with the aid of dh_make, by Craig Small
Steve Kondikae271bc2015-11-15 02:50:53 +01003# 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
10NCURSES_PKG = ncurses-examples
11NCURSEST_PKG = ncursest-examples
12
13PACKAGES.indep = # ncurses-examples-docs
14PACKAGES.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)
18DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
19DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
20
micky3879b9f5e72025-07-08 18:04:53 -040021CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
22CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
23LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
Steve Kondikae271bc2015-11-15 02:50:53 +010024
25ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
26 CFLAGS += -O0
27else
28 CFLAGS += -O2
29endif
30ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
31 INSTALL_PROGRAM += -s
32endif
33
34verbose = # -v
35
36configure = \
micky3879b9f5e72025-07-08 18:04:53 -040037 CFLAGS="$(CFLAGS)" \
38 CPPFLAGS="$(CPPFLAGS)" \
39 LDFLAGS="$(LDFLAGS)" ../../configure \
Steve Kondikae271bc2015-11-15 02:50:53 +010040 --host=$(DEB_HOST_GNU_TYPE) \
41 --build=$(DEB_BUILD_GNU_TYPE) \
42 --prefix=/usr \
43 --disable-rpath-hack
44
45.PHONY: all config build install binary clean config-indep config-arch \
46 build-indep build-arch install-indep install-arch binary-indep \
47 binary-arch
48
49all: build
50
51config: config-indep config-arch
52build: build-indep build-arch
53install: install-indep install-arch
54binary: binary-indep binary-arch
55clean:
56 dh_testdir
57 dh_testroot
58 dh_clean $(verbose)
59 rm -rf t
60
61config-indep: $(PACKAGES.indep:%=config-%-stamp)
62config-arch: $(PACKAGES.arch:%=config-%-stamp)
63
64build-indep: $(PACKAGES.indep:%=build-%-stamp)
65build-arch: $(PACKAGES.arch:%=build-%-stamp)
66
67install-indep: $(PACKAGES.indep:%=install-%-stamp)
68install-arch: $(PACKAGES.arch:%=install-%-stamp)
69
70config-$(NCURSES_PKG)-stamp:
71 dh_testdir
72
73 rm -rf t/ncurses6
74 mkdir -p t/ncurses6
75
76 cd t/ncurses6; $(configure) \
micky3879b9f5e72025-07-08 18:04:53 -040077 --datadir=\$${datarootdir}/$(NCURSES_PKG) \
Steve Kondikae271bc2015-11-15 02:50:53 +010078 --with-screen=ncursesw6
79
80 touch $@
81
82config-$(NCURSEST_PKG)-stamp:
83 dh_testdir
84
85 rm -rf t/ncursest6
86 mkdir -p t/ncursest6
87
88 cd t/ncursest6; $(configure) \
micky3879b9f5e72025-07-08 18:04:53 -040089 --datadir=\$${datarootdir}/$(NCURSEST_PKG) \
Steve Kondikae271bc2015-11-15 02:50:53 +010090 --with-screen=ncursestw6
91
92 touch $@
93
94build-$(NCURSES_PKG)-stamp: config-$(NCURSES_PKG)-stamp
95 dh_testdir
96
97 $(MAKE) -C t/ncurses6
98
99 touch $@
100
101build-$(NCURSEST_PKG)-stamp: config-$(NCURSEST_PKG)-stamp
102 dh_testdir
103
104 $(MAKE) -C t/ncursest6
105
106 touch $@
107
108install-$(NCURSES_PKG)-stamp: build-$(NCURSES_PKG)-stamp
109 dh_testdir
110 dh_testroot
111 dh_installdirs $(verbose)
112 dh_prep $(verbose) -p$(NCURSES_PKG)
113
micky3879b9f5e72025-07-08 18:04:53 -0400114 $(MAKE) -C t/ncurses6 install \
115 PACKAGE=$(NCURSES_PKG) \
116 DESTDIR=$(CURDIR)/debian/$(NCURSES_PKG)
Steve Kondikae271bc2015-11-15 02:50:53 +0100117
118 touch $@
119
120install-$(NCURSEST_PKG)-stamp: build-$(NCURSEST_PKG)-stamp
121 dh_testdir
122 dh_testroot
123 dh_installdirs $(verbose)
124 dh_prep $(verbose) -p$(NCURSEST_PKG)
125
micky3879b9f5e72025-07-08 18:04:53 -0400126 $(MAKE) -C t/ncursest6 install \
127 PACKAGE=$(NCURSEST_PKG) \
128 DESTDIR=$(CURDIR)/debian/$(NCURSEST_PKG)
Steve Kondikae271bc2015-11-15 02:50:53 +0100129
130 touch $@
131
132# Build architecture-independent files here.
133binary-indep: install-indep
134ifneq ($(PACKAGES.indep),)
135 rm -f $(PACKAGES.indep:%=install-%-stamp)
136 dh_testdir
137 dh_testroot
138 dh_installdocs $(verbose) $(PACKAGES.indep:%=-p%)
139 dh_installman $(verbose) $(PACKAGES.indep:%=-p%)
140 dh_installexamples $(verbose) $(PACKAGES.indep:%=-p%)
141 dh_installchangelogs $(verbose) $(PACKAGES.indep:%=-p%) NEWS
142 dh_compress $(verbose) $(PACKAGES.indep:%=-p%)
143 dh_fixperms $(verbose) $(PACKAGES.indep:%=-p%)
144 dh_installdeb $(verbose) $(PACKAGES.indep:%=-p%)
145 dh_gencontrol $(verbose) $(PACKAGES.indep:%=-p%)
146 dh_md5sums $(verbose) $(PACKAGES.indep:%=-p%)
147 dh_builddeb $(verbose) $(PACKAGES.indep:%=-p%)
148endif
149
150# Build architecture-dependent files here.
151binary-arch: install-arch
152ifneq ($(PACKAGES.arch),)
153 rm -f $(PACKAGES.arch:%=install-%-stamp)
154 dh_testdir
155 dh_testroot
micky3879b9f5e72025-07-08 18:04:53 -0400156 dh_installdocs $(verbose) $(PACKAGES.arch:%=-p%)
Steve Kondikae271bc2015-11-15 02:50:53 +0100157 dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%) NEWS
158 dh_strip $(verbose) $(PACKAGES.arch:%=-p%)
159 dh_compress $(verbose) $(PACKAGES.arch:%=-p%)
160 dh_fixperms $(verbose) $(PACKAGES.arch:%=-p%)
161 dh_installdeb $(verbose) $(PACKAGES.arch:%=-p%)
162 dh_makeshlibs $(verbose) $(PACKAGES.arch:%=-p%)
163 dh_shlibdeps $(verbose) $(PACKAGES.arch:%=-p%)
164 dh_gencontrol $(verbose) $(PACKAGES.arch:%=-p%)
165 dh_md5sums $(verbose) $(PACKAGES.arch:%=-p%)
166 dh_builddeb $(verbose) $(PACKAGES.arch:%=-p%)
167endif