File: rules

package info (click to toggle)
asis 2005-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 6,424 kB
  • ctags: 27
  • sloc: ada: 73,883; makefile: 201
file content (128 lines) | stat: -rwxr-xr-x 3,971 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#! /usr/bin/make -rf
# Debian build script for asis - Copyright (c) 2003, 2004, 2005, 2006
# Ludovic Brenta

# This build script is free software; you can redistribute it and/or
# modify it under terms of the GNU General Public License as published
# by the Free Software Foundation; either version 2, or (at your
# option) any later version. This build script 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
# distributed with this build script; see file
# /usr/share/common-licenses/GPL. If not, write to the Free Software
# Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

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

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

# This has to be exported to make some magic below work.
export DH_OPTIONS

ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
OS = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

VERSION := $(shell dpkg-parsechangelog | grep "^Version: " | sed 's/^Version: \(.*\)-\(.*\)/\1/')
REVISION := $(shell dpkg-parsechangelog | grep "^Version: " | sed 's/^Version: \(.*\)-\(.*\)/\2/')

TOOLS := asistant display_source gnatelim gnatmetric gnatpp gnatstub
LIBASIS := libasis.so.$(VERSION)
CPUS := $(shell getconf _NPROCESSORS_ONLN)

patch:
	-quilt push -a

clean:
	dh_testdir
	-quilt pop -a
	-rm -f *-stamp
	-rm -f obj/libasis*.so* obj/libasis*.a obj/*.ali obj/*.o obj/GNAT*
	-rm -rf debian/obj $(TOOLS)
	dh_clean

build: patch obj/libasis.a obj/libasis.so tools

obj/libasis.a: asis/*
	: # Build the static library
	gnatmake -g -j$(CPUS) -c -Pdebian/install_asis
	rm -f obj/install_asis.ali obj/install_asis.o
	cd obj && ar rc libasis.a *.o
	cd obj && ranlib libasis.a
	rm obj/*.ali obj/*.o

obj/libasis.so: asis/*
	: # Build the shared library
	gnatmake -fPIC -j$(CPUS) -c -Pdebian/install_asis
	rm -f obj/install_asis.ali obj/install_asis.o
	cd obj \
	    && gnatgcc -shared -o $(LIBASIS) *.o \
		-Wl,--soname,$(LIBASIS) -lgnatvsn
	ln -s $(LIBASIS) obj/libasis.so
	chmod a-w obj/*.ali
	rm obj/*.o

$(TOOLS): tools
tools:
	: # Build the tools, link dynamically against libasis.so
	-mkdir debian/obj
	gnatmake -j$(CPUS) -Pdebian/tools.gpr -largs -Lobj -lasis

binary: checks binary-arch binary-indep

binary-arch: libasis$(VERSION) libasis-dev asis-programs
	dh_strip -a -X.a
	dh_compress -a -X.ali -X.ads -X.adb
	dh_fixperms -a
	dh_installdeb -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

checks:
	dh_testdir
	dh_clean -k
	dh_testroot

libasis-dev: obj/libasis.a
	-find debian -name '*.vms' -exec rm -f {} \;
	dh_installchangelogs -p$@
	dh_installdocs -p$@ README tutorial
	dh_installexamples -p$@ examples/ds templates
	dh_link -p$@ usr/lib/$(LIBASIS) usr/lib/libasis.so
	dh_install -p$@ asis/*.ad[bs] usr/share/ada/adainclude/asis
	dh_install -p$@ obj/*.ali usr/lib/ada/adalib/asis
	dh_install -p$@ obj/libasis.a usr/lib
	dh_install -p$@ debian/asis.gpr usr/share/ada/adainclude

libasis$(VERSION): obj/libasis.so
	dh_installdocs -p$@
	dh_installchangelogs -p$@
	dh_install -p$@ obj/$(LIBASIS) usr/lib
	dh_makeshlibs -p$@
	dh_shlibdeps -p$@

asis-programs: $(TOOLS)
	dh_installdirs -p$@ usr/share/doc/$@
	dh_installdocs -p$@ README
	dh_installchangelogs -p$@
	dh_install -p$@ $(TOOLS) usr/bin
	dh_shlibdeps -p$@ \
		-L libasis$(VERSION) \
		-l debian/libasis$(VERSION)/usr/lib \
		usr/bin/*
	cp tools/gnatmetric/README \
		debian/$@/usr/share/doc/$@/README.gnatmetric
	cp tools/gnatpp/README \
		debian/$@/usr/share/doc/$@/README.gnatpp
	cp examples/ds/README \
		debian/$@/usr/share/doc/$@/README.display_source
	dh_installman -p$@ debian/*.1

binary-indep:

.PHONY: build clean binary-indep binary-arch binary install checks
.PHONY: libasis$(VERSION) libasis-dev asis-programs tools