File: rules

package info (click to toggle)
libopentoken 3.0b-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,416 kB
  • ctags: 51
  • sloc: ada: 8,561; makefile: 120
file content (107 lines) | stat: -rwxr-xr-x 3,336 bytes parent folder | download
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
#!/usr/bin/make -f

# Debian Makefile for OpenToken
# Copyright (c) 2004, 2006 Ludovic Brenta <lbrenta@debian.org>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program (see in /usr/share/common-licenses/GPL); if
# not, write to the Free Software Foundation, Inc., 51 Franklin St,
# Fifth Floor, Boston, MA 02110-1301 USA

export DH_COMPAT=4

# Parse the version number from the change log:
# major.minor-revision
regexp:=^Version: \([0-9]\+\)\.\([0-9a-z]\+\)-\(.\+\)$$
major:=$(shell dpkg-parsechangelog | grep ^Version: | sed 's/$(regexp)/\1/')
minor:=$(shell dpkg-parsechangelog | grep ^Version: | sed  's/$(regexp)/\2/')
revision:=$(shell dpkg-parsechangelog | grep ^Version: | sed  's/$(regexp)/\3/')

gcc_host:=$(shell gnatgcc -dumpmachine)
gcc_version:=$(shell gnatgcc -dumpversion)

SPECS := $(wildcard *.ads)
BODIES := $(wildcard *.adb)
OBJECTS := $(patsubst %.ads,obj/%.o,$(SPECS))

build: build-stamp
build-stamp:
	dh_testdir
	$(MAKE) -f debian/rules objects CFLAGS="-g"
	ar rc libopentoken.a obj/*.o
	ranlib libopentoken.a
	rm -rf obj
	$(MAKE) -f debian/rules objects CFLAGS="-fPIC"
	gnatgcc -shared -o libopentoken.so.$(major).$(minor) obj/*.o \
		-L/usr/lib/gcc-lib/$(gcc_host)/$(gcc_version)/adalib \
		-lgnat \
		-Wl,--soname,libopentoken.so.$(major).$(minor)
	-rm build_all.adb
	touch build-stamp

objects: build_all.adb
	-mkdir obj
	gnatmake -c -j2 -Pbuild_all $(CFLAGS)
	-rm obj/build_all.*

build_all.adb: $(SPECS) $(BODIES)
	@for i in $(SPECS); do \
		p=`echo $$i | sed -e "s/\.ads//" -e "s/-/./g"` ; \
		echo "with $$p;" >> $@; \
	done
	@echo "procedure build_all is" >> $@
	@echo "begin" >> $@
	@echo "	 null;" >> $@
	@echo "end build_all;" >> $@

clean:
	dh_testdir
	dh_testroot
	dh_clean -a
	rm -rf build-stamp obj libopentoken* build_all.adb

binary-indep:

binary-arch: build
	dh_testdir
	dh_testroot
	dh_clean -a
	: # The -dev package.
	dh_installdirs usr/share/ada/adainclude/opentoken \
		usr/lib/ada/adalib/opentoken \
		usr/share/doc/libopentoken-dev \
		usr/lib
	dh_install *.ad[bs] usr/share/ada/adainclude/opentoken
	dh_install obj/*.ali usr/lib/ada/adalib/opentoken
	dh_install debian/opentoken.gpr usr/share/ada/adainclude
	dh_install libopentoken.a usr/lib
	dh_link usr/lib/libopentoken.so.$(major).$(minor) \
		usr/lib/libopentoken.so
	dh_installdocs Docs/*
	dh_installexamples Examples/*
	dh_installchangelogs -a
	: # The library package.
	dh_install -plibopentoken$(major).$(minor) \
		libopentoken.so.$(major).$(minor) usr/lib
	dh_strip -plibopentoken$(major).$(minor)
	dh_compress -a -X.ads -X.adb
	dh_fixperms -a
	dh_makeshlibs -plibopentoken$(major).$(minor)
	dh_installdeb -a
	dh_shlibdeps -plibopentoken$(major).$(minor)
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary