1 | #!/usr/bin/make -f |
---|
2 | # Based on public domain debhelper example rules.multi2 by Joey Hess. |
---|
3 | # |
---|
4 | # Copyright (C) 2005,2006,2010 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 | ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
---|
28 | NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
---|
29 | MAKEFLAGS += -j$(NUMJOBS) |
---|
30 | endif |
---|
31 | |
---|
32 | ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) |
---|
33 | # Disable the testsuite when cross-compiling. |
---|
34 | DEB_BUILD_OPTIONS += nocheck |
---|
35 | endif |
---|
36 | |
---|
37 | build: build-stamp |
---|
38 | build-stamp: |
---|
39 | dh_testdir |
---|
40 | |
---|
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)" |
---|
48 | $(MAKE) |
---|
49 | ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) |
---|
50 | $(MAKE) check DISPLAY= |
---|
51 | endif |
---|
52 | touch build-stamp |
---|
53 | |
---|
54 | clean: |
---|
55 | dh_testdir |
---|
56 | dh_testroot |
---|
57 | |
---|
58 | [ ! -f Makefile ] || $(MAKE) distclean |
---|
59 | |
---|
60 | rm -f config.sub config.guess |
---|
61 | dh_clean |
---|
62 | |
---|
63 | install: DH_OPTIONS= |
---|
64 | install: build |
---|
65 | dh_testdir |
---|
66 | dh_testroot |
---|
67 | dh_prep |
---|
68 | dh_installdirs |
---|
69 | |
---|
70 | $(MAKE) DESTDIR=`pwd`/debian/tmp install |
---|
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 |
---|
77 | |
---|
78 | dh_install --fail-missing |
---|
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. |
---|
84 | binary-common: |
---|
85 | dh_testdir |
---|
86 | dh_testroot |
---|
87 | dh_installchangelogs |
---|
88 | dh_installdocs |
---|
89 | dh_installexamples |
---|
90 | dh_installmenu |
---|
91 | # FIXME: investigate using dh_installmime |
---|
92 | # dh_installmime |
---|
93 | dh_strip |
---|
94 | dh_link |
---|
95 | dh_compress |
---|
96 | dh_fixperms |
---|
97 | dh_installdeb |
---|
98 | dh_shlibdeps |
---|
99 | dh_gencontrol |
---|
100 | dh_md5sums |
---|
101 | dh_builddeb |
---|
102 | |
---|
103 | # Build architecture independent packages using the common target. |
---|
104 | binary-indep: build install |
---|
105 | $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common |
---|
106 | |
---|
107 | # Build architecture dependant packages using the common target. |
---|
108 | binary-arch: build install |
---|
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 | |
---|
115 | binary: binary-indep binary-arch |
---|
116 | .PHONY: build clean binary-indep binary-arch binary-common binary install |
---|