Rev 36 | Rev 43 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3 | magnus | 1 | #!/usr/bin/make -f |
2 | # |
||
3 | # To build the packages, run `dpkg-buildpackage' or `debuild' from the |
||
4 | # parent directory of this file. (You may need to specify the `-rfakeroot' |
||
5 | # option if you are using dpkg-buildpackage and are not running as root) |
||
6 | # |
||
7 | # Copyright (C) 1999, 2000, 2001, 2002 Timshel Knoll <timshel@debian.org> |
||
8 | # Licensed under the terms of the GNU General Public License |
||
9 | # |
||
10 | # Based originally on Sample debian/rules that uses debhelper, from dh-make, |
||
11 | # GNU copyright 1997 to 1999 by Joey Hess. |
||
12 | |||
13 | # Uncomment this to turn on verbose mode. |
||
14 | #export DH_VERBOSE=1 |
||
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 | |||
42 | magnus | 21 | ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) |
22 | buildflags := --build=$(DEB_BUILD_GNU_TYPE) |
||
3 | magnus | 23 | else |
42 | magnus | 24 | buildflags := --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) |
3 | magnus | 25 | endif |
26 | |||
42 | magnus | 27 | buildflags += $(shell dpkg-buildflags --export=configure) |
3 | magnus | 28 | |
29 | # The name of the library - this is the base name of the packages that |
||
30 | # will be built |
||
31 | LIBRARY = liboop |
||
32 | |||
33 | # This is the soname of the package being built - we have to know this |
||
34 | # before the start of the build because changing the control file half |
||
35 | # way though the build probably isn't a good idea, and this would also |
||
36 | # mean renaming the $(LIBRARY)$(SONAME).{files,docs,...} files |
||
37 | SONAME = 4 |
||
38 | |||
39 | # A list of variables to substitute when generating files from .in files |
||
40 | # If you put an 'x' here, then all @x@'s in .in files will be substituted |
||
41 | # with the value of $(x) in the output file |
||
42 | SUBSTS = SONAME |
||
43 | |||
44 | GENFILES = debian/control \ |
||
36 | magnus | 45 | debian/$(LIBRARY)$(SONAME).install \ |
3 | magnus | 46 | debian/$(LIBRARY)$(SONAME).dirs |
47 | |||
48 | # We can't use these until after the package has been built ... otherwise |
||
49 | # they will fail because no .libs/lib*.so.* exists |
||
50 | version = $(shell ls .libs/lib*.so.* | \ |
||
51 | awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) \ |
||
52 | print substr($$0,RSTART)}') |
||
53 | major = $(shell ls .libs/lib*.so.* | \ |
||
54 | awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}') |
||
55 | |||
56 | # This builds a substitution list for sed based on the SUBSTS variable |
||
57 | # and the variables whose names SUBSTS contains ... |
||
58 | SUBSTLIST = $(foreach subst, $(SUBSTS),s/@$(subst)@/$($(subst))/g;) |
||
59 | |||
60 | # A sane default rule |
||
61 | default: |
||
62 | @echo "Try: debian/rules [configure|build|clean|install|binary|binary-arch|binary-indep]" |
||
63 | @echo "Vars:" |
||
64 | @echo " SUBSTLIST: $(SUBSTLIST)" |
||
65 | @echo " SONAME: $(SONAME)" |
||
66 | |||
67 | # Pattern rules: |
||
68 | |||
69 | # How to generate files from .in's |
||
70 | debian/%: debian/%.in debian/rules |
||
71 | sed -e '$(SUBSTLIST)' < $< > $@ |
||
72 | |||
73 | # This puts the $(LIBRARY)* packaging files in their right places |
||
74 | # Could I / should I use ln? |
||
75 | debian/$(LIBRARY)$(SONAME).%: debian/$(LIBRARY).% |
||
76 | cp $< $@ |
||
77 | |||
78 | # Do the substitution/moving stuff |
||
79 | packaging-files: $(GENFILES) |
||
80 | |||
81 | configure: packaging-files configure-stamp |
||
13 | magnus | 82 | configure-stamp: |
3 | magnus | 83 | dh_testdir |
84 | |||
42 | magnus | 85 | [ -f debian/autoreconf.before ] || dh_autoreconf |
13 | magnus | 86 | |
42 | magnus | 87 | ./configure --prefix=/usr $(buildflags) |
3 | magnus | 88 | |
89 | touch $@ |
||
90 | |||
42 | magnus | 91 | build: build-arch |
92 | build-indep: |
||
93 | build-arch: build-stamp |
||
94 | build-stamp: configure-stamp |
||
3 | magnus | 95 | dh_testdir |
96 | |||
97 | $(MAKE) |
||
98 | |||
99 | touch $@ |
||
100 | |||
13 | magnus | 101 | clean: |
3 | magnus | 102 | dh_testdir |
103 | dh_testroot |
||
104 | rm -f build-stamp configure-stamp |
||
105 | |||
8 | magnus | 106 | [ ! -f Makefile ] || $(MAKE) distclean |
3 | magnus | 107 | |
42 | magnus | 108 | dh_autoreconf_clean |
109 | dh_clean libtool configure |
||
3 | magnus | 110 | |
36 | magnus | 111 | install: build |
3 | magnus | 112 | dh_testdir |
113 | dh_testroot |
||
36 | magnus | 114 | dh_prep |
3 | magnus | 115 | |
5 | magnus | 116 | $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp |
117 | |||
36 | magnus | 118 | binary-indep: |
5 | magnus | 119 | dh_testdir |
120 | dh_testroot |
||
36 | magnus | 121 | dh_install -i |
3 | magnus | 122 | |
4 | magnus | 123 | dh_installdocs -i |
124 | dh_installman -i |
||
125 | dh_installinfo -i |
||
126 | dh_installchangelogs -i |
||
127 | dh_link -i |
||
128 | dh_compress -i -Xliboop-doc/html |
||
129 | dh_fixperms -i |
||
130 | dh_installdeb -i |
||
131 | dh_gencontrol -i |
||
132 | dh_md5sums -i |
||
133 | dh_builddeb -i |
||
134 | |||
36 | magnus | 135 | binary-arch: install |
3 | magnus | 136 | dh_testdir |
137 | dh_testroot |
||
36 | magnus | 138 | dh_install -a |
3 | magnus | 139 | |
4 | magnus | 140 | dh_installdocs -a |
141 | dh_installman -a |
||
142 | dh_installinfo -a |
||
143 | dh_installchangelogs -a |
||
144 | dh_link -a |
||
33 | magnus | 145 | dh_strip -a --dbg-package=liboop-dbg |
4 | magnus | 146 | dh_compress -a -Xliboop-doc/html |
147 | dh_fixperms -a |
||
148 | dh_makeshlibs -a |
||
149 | dh_installdeb -a |
||
3 | magnus | 150 | # Don't add the depends for adapter libraries - programs which link |
151 | # with them will also link with the appropriate library |
||
4 | magnus | 152 | dh_shlibdeps -a -Xliboop- |
153 | dh_gencontrol -a |
||
154 | dh_md5sums -a |
||
155 | dh_builddeb -a |
||
3 | magnus | 156 | |
157 | binary: binary-indep binary-arch |
||
158 | |||
159 | .PHONY: packaging-files configure build install |
||
160 | .PHONY: binary-indep binary-arch binary clean |