File: rules

package info (click to toggle)
asis 2007-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 7,832 kB
  • ctags: 34
  • sloc: ada: 93,665; makefile: 225
file content (135 lines) | stat: -rwxr-xr-x 4,476 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
129
130
131
132
133
134
135
#! /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 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 gnatcheck 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

# A directory that contains additional source files, some of which
# conflict with source files for the tools.  But it also contains one
# file which we need to build gnatcheck.  In the tools target below,
# we symlink the needed file to debian/obj to make it visible.  See
# also tools.gpr.
TEMPLATES := ../../tools/tool_utils/templates
NEEDED_FILE := asis_ul-environment-tool_specific_initialization_2.adb

$(TOOLS): tools
tools:
	: # Build the tools, link dynamically against libasis.so
	-mkdir debian/obj
	-ln -sf $(TEMPLATES)/$(NEEDED_FILE) debian/obj/$(NEEDED_FILE)
	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 *.txt features*
	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 tutorial/using_asistant/README \
		debian/$@/usr/share/doc/$@/README.asistant
	cp tutorial/using_templates/style_checker/README \
		debian/$@/usr/share/doc/$@/README.gnatcheck
	cp tools/gnatmetric/README \
		debian/$@/usr/share/doc/$@/README.gnatmetric
	cp tools/gnatpp/README \
		debian/$@/usr/share/doc/$@/README.gnatpp
	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