File: rules

package info (click to toggle)
asis 2008-5
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 9,724 kB
  • ctags: 615
  • sloc: ada: 95,867; makefile: 259; xml: 19
file content (151 lines) | stat: -rwxr-xr-x 5,074 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#! /usr/bin/make -rf
# Debian build script for asis - Copyright (c) 2003-2009 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

aliversion := 2008
soversion := 2008

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

TOOLS := asistant gnatcheck gnatelim gnatmetric gnatpp gnatstub gnatsync
LIBASIS := libasis.so.$(soversion)
CPUS := $(shell getconf _NPROCESSORS_ONLN)

include /usr/share/quilt/quilt.make

clean: unpatch
	dh_testdir
	-rm -f *-stamp
	-rm -rf obj-shared obj-static obj-tools $(TOOLS)
	dh_clean

build: patch obj-static/libasis.a obj-shared/libasis.so $(TOOLS)

obj-static/libasis.a: obj=$(dir $@)
obj-static/libasis.a: library_kind=static
obj-static/libasis.a: asis/*
obj-shared/libasis.so: obj=$(dir $@)
obj-shared/libasis.so: library_kind=dynamic
obj-shared/libasis.so: asis/*

obj-static/libasis.a obj-shared/libasis.so:
	: # Build the $(library_kind) library
	gnatmake -p -j$(CPUS) -Pdebian/install_asis \
	   -Xobject_dir=../$(obj) -XLibrary_Kind=$(library_kind) -Xsoversion=$(soversion)
	chmod a-w $(obj)/*.ali

obj-tools:
	-mkdir $@

# 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 ../obj-tools to make it visible.
# See also tools.gpr.
TEMPLATES := tools/tool_utils/templates
NEEDED_FILES := asis_ul-environment-tool_specific_initialization_2.adb
NEEDED_FILES += asis_ul-source_table-processing-finalize.adb
NEEDED_FILES += asis_ul-source_table-processing-initialize.adb

$(addprefix obj-tools/,$(NEEDED_FILES)): | obj-tools
	ln -s ../$(TEMPLATES)/$(notdir $@) $@

$(TOOLS): $(addprefix obj-tools/,$(NEEDED_FILES))
	: # Build the tools, link dynamically against libasis.so
	gnatmake -j$(CPUS) -Pdebian/tools.gpr -Xobject_dir=../obj-shared \
	   -XLibrary_Kind=$(library_kind) -Xsoversion=$(soversion) \
	   -XExternally_Built=true

binary: checks binary-arch binary-indep

binary-arch: libasis$(soversion) libasis$(aliversion)-dev asis-programs
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

checks:
	dh_testdir
	dh_testroot
	dh_prep

libasis$(aliversion)-dev: obj-static/libasis.a
	-find debian -name '*.vms' -exec rm -f {} \;
	dh_installchangelogs -p$@
	dh_installdocs -p$@ README tutorial *.txt features*
	dh_installexamples -p$@ 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-shared/*.ali usr/lib/ada/adalib/asis
	dh_install -p$@ obj-static/libasis.a usr/lib
	dh_install -p$@ debian/asis.gpr usr/share/ada/adainclude

libasis$(soversion): obj-shared/libasis.so
	dh_installdocs -p$@
	dh_installchangelogs -p$@
	dh_install -p$@ obj-shared/$(LIBASIS) usr/lib
	dh_makeshlibs -p$@
	dh_shlibdeps -p$@
	dh_strip -p$@ --dbg-package=$@-dbg
	dh_installdocs -p$@-dbg
	dh_installchangelogs -p$@-dbg

asis-programs: $(TOOLS)
	dh_installdirs -p$@ usr/share/doc/$@
	dh_installdocs -p$@ README
	dh_installchangelogs -p$@
	dh_install -p$@ $(TOOLS) usr/bin
	dh_strip -p$@
	dh_shlibdeps -p$@ \
		-L libasis$(soversion) \
		-l debian/libasis$(soversion)/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
	cp tools/gnatsync/README \
		debian/$@/usr/share/doc/$@/README.gnatsync
	dh_installman -p$@ $(foreach t,$(TOOLS),debian/$(t).1)

binary-indep: asis-doc
	dh_installchangelogs -i
	dh_fixperms -i
	dh_compress -i -X.pdf
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

extensions := html txt pdf
asis-doc:
	dh_installdocs -p$@ $(foreach e,$(extensions),documentation/*.$(e))
	dh_installdocs -p$@ asis-2005-transition.txt features-asis*
	dh_installinfo -p$@ documentation/*.info

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