File: rules

package info (click to toggle)
liboop 1.0-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,616 kB
  • ctags: 451
  • sloc: sh: 8,335; ansic: 2,507; makefile: 142
file content (158 lines) | stat: -rwxr-xr-x 4,320 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/usr/bin/make -f
# debian/rules file for libraries
#
# To build the packages, run `dpkg-buildpackage' or `debuild' from the
# parent directory of this file. (You may need to specify the `-rfakeroot'
# option if you are using dpkg-buildpackage and are not running as root)
#
# $Id: rules,v 1.8 2003/04/30 07:45:50 timshel Exp $
#
# Copyright (C) 1999, 2000, 2001, 2002  Timshel Knoll <timshel@debian.org>
# Licensed under the terms of the GNU General Public License
#
# Based originally on Sample debian/rules that uses debhelper, from dh-make,
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This is the debhelper compatibility version to use.
export DH_COMPAT=4

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE       ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE      ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)


CFLAGS += -g
ifeq (, $(findstring noopt, $(DEB_BUILD_OPTIONS)))
	CFLAGS += -O2
else
	CFLAGS += -O0
endif


# The name of the library - this is the base name of the packages that
# will be built
LIBRARY = liboop

# This is the soname of the package being built - we have to know this
# before the start of the build because changing the control file half
# way though the build probably isn't a good idea, and this would also
# mean renaming the $(LIBRARY)$(SONAME).{files,docs,...} files
SONAME = 4

# A list of variables to substitute when generating files from .in files
# If you put an 'x' here, then all @x@'s in .in files will be substituted
# with the value of $(x) in the output file
SUBSTS = SONAME

GENFILES = debian/control \
	debian/$(LIBRARY)$(SONAME).files \
	debian/$(LIBRARY)$(SONAME).dirs

# We can't use these until after the package has been built ... otherwise
# they will fail because no .libs/lib*.so.* exists
version = $(shell ls .libs/lib*.so.* | \
	    awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) \
	         print substr($$0,RSTART)}')
major = $(shell ls .libs/lib*.so.* | \
	  awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}')

# This builds a substitution list for sed based on the SUBSTS variable
# and the variables whose names SUBSTS contains ...
SUBSTLIST = $(foreach subst, $(SUBSTS),s/@$(subst)@/$($(subst))/g;)

# A sane default rule 
default:
	@echo "Try: debian/rules [configure|build|clean|install|binary|binary-arch|binary-indep]"
	@echo "Vars:"
	@echo "	SUBSTLIST:	$(SUBSTLIST)"
	@echo "	SONAME:		$(SONAME)"

# Pattern rules:

# How to generate files from .in's
debian/%: debian/%.in debian/rules
	sed -e '$(SUBSTLIST)' < $< > $@

# This puts the $(LIBRARY)* packaging files in their right places
# Could I / should I use ln?
debian/$(LIBRARY)$(SONAME).%: debian/$(LIBRARY).%
	cp $< $@

# Do the substitution/moving stuff
packaging-files: $(GENFILES)

configure: packaging-files configure-stamp
configure-stamp:
	dh_testdir

	env CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) \
		--build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr

	touch $@

build: configure-stamp build-stamp
build-stamp:
	dh_testdir

	$(MAKE)

	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

	-$(MAKE) distclean
	-$(MAKE) -C liboop.org distclean

	-test -r /usr/share/misc/config.sub && \
	   cp -f /usr/share/misc/config.sub config.sub
	-test -r /usr/share/misc/config.guess && \
	   cp -f /usr/share/misc/config.guess config.guess

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
	$(MAKE) -C liboop.org install \
		DESTDIR=$(CURDIR)/debian/tmp/usr/share/doc/liboop-doc/html

binary-indep:
# Nothing to do

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_movefiles

	dh_installdocs
	dh_installman
	dh_installinfo
	dh_installchangelogs
	dh_link
	dh_strip
	dh_compress -Xliboop-doc/html
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
#	 Don't add the depends for adapter libraries - programs which link
#	 with them will also link with the appropriate library
	dh_shlibdeps -Xliboop-
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch

.PHONY: packaging-files configure build install
.PHONY: binary-indep binary-arch binary clean