File: rules

package info (click to toggle)
libtemplates-parser 10.0%2B20060522-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,880 kB
  • ctags: 52
  • sloc: ada: 9,842; makefile: 360; sh: 26
file content (137 lines) | stat: -rwxr-xr-x 4,379 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
#!/usr/bin/make -f
# Build script for XML/Ada in Debian.
# Copyright (c) 2003-2006 Ludovic Brenta <lbrenta@debian.org>

# This build script 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; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA

# On Debian systems, the full text of the GPL is in the file
# /usr/share/common-licenses/GPL.


# gnatmake can do parallel builds; we don't want make to interfere.
.NOTPARALLEL:

export DH_COMPAT=4
export SHELL=/bin/bash

MAJOR := $(shell dpkg-parsechangelog | grep "^Version: " | sed 's/^Version: \(.*\)\.\(.*\)-\(.*\)/\1/')
MINOR := $(shell dpkg-parsechangelog | grep "^Version: " | sed 's/^Version: \(.*\)\.\(.*\)-\(.*\)/\2/')
REVISION := $(shell dpkg-parsechangelog | grep "^Version: " | sed 's/^Version: \(.*\)\.\(.*\)-\(.*\)/\3/')
CPUS := $(shell getconf _NPROCESSORS_ONLN)

file_to_spec := -e 's!.*/(.+)\.ads!\1!' -e 's!-!.!g'

build: patch libtemplates_parser.a libtemplates_parser.so doc

patch:
	-quilt push -a

SOURCES := $(wildcard src/*.ad[bs]) $(wildcard includes/*.ad[bs])

libtemplates_parser.a: $(SOURCES) build.adb debian/build.gpr debian/rules | obj-static
	: # Build the static library
	gnatmake -c -g -j$(CPUS) -Pdebian/build.gpr -Xobj=obj-static
	mv obj-static/build.* .
	ar rc $@ obj-static/*.o
	mv build.ali build.o obj-static
	ranlib $@

libtemplates_parser.so: $(SOURCES) build.adb debian/build.gpr debian/rules | obj-shared
	: # Build the shared library
	gnatmake -c -fPIC -j$(CPUS) -Pdebian/build.gpr -Xobj=obj-shared
	mv obj-shared/build.* .
	gnatgcc -shared -o $@.$(MAJOR).$(MINOR) obj-shared/*.o \
	   -Wl,--soname,$@.$(MAJOR) -lgnat
	mv build.ali build.o obj-shared

SPECS := $(foreach dir,include src,\
           $(filter-out $(wildcard $(dir)/*__*),$(wildcard $(dir)/*.ads)))

build.adb: debian/rules $(SPECS)
	-rm $@
	for file in $(SPECS); do \
	   grep -q -E "^private +(package|procedure|function)" $$file; \
	   if [ $$? -ne 0 ] ; then \
	      spec=$$(echo $$file | sed -r $(file_to_spec)); \
	      echo "with $$spec;" >> $@ ; \
	   fi; \
	done
	echo "procedure Build is begin null; end Build;" >> $@

obj-static obj-shared:
	-mkdir $@

doc: doc-stamp

doc-stamp:
	chmod u+x docs/gentexifile
	$(MAKE) -C docs GNATMAKE=gnatmake
	touch $@

clean:
	dh_testdir
	dh_testroot
	-quilt pop -a
	rm -f doc-stamp libtemplates_parser* build.adb
	rm -rf obj-static obj-shared debian/files
	$(MAKE) -C docs clean
	dh_clean -k

lib := libtemplates_parser
libpkg := libtemplates-parser$(MAJOR)
devpkg := libtemplates-parser-dev
adainclude := usr/share/ada/adainclude/templates_parser
adalib := usr/lib/ada/adalib/templates_parser

# Build architecture-dependent files here.
binary-arch: build
	dh_testdir
	dh_testroot
	dh_installchangelogs -a
	dh_installdocs -a
	: # The library package
	dh_installdirs -p$(libpkg) usr/lib
	dh_install -p$(libpkg) $(lib).so.$(MAJOR).$(MINOR) usr/lib
	dh_strip -p$(libpkg)
	dh_link -p$(libpkg) \
		usr/lib/$(lib).so.$(MAJOR).$(MINOR) \
		usr/lib/$(lib).so.$(MAJOR)
	dh_makeshlibs -p$(libpkg)
	: # The -dev package
	dh_installdirs -p$(devpkg) usr/lib $(adainclude) $(adalib) \
		usr/share/doc/$(devpkg)
	dh_install -p$(devpkg) $(lib).a usr/lib
	dh_link -p$(devpkg) \
		usr/lib/$(lib).so.$(MAJOR).$(MINOR) usr/lib/$(lib).so
	dh_install -p$(devpkg) obj-shared/*.ali $(adalib)
	chmod a=r debian/$(devpkg)/$(adalib)/*.ali
	dh_install -p$(devpkg) include/*.ad[bs] src/*.ad[bs] $(adainclude)
	dh_install -p$(devpkg) \
		debian/templates_parser.gpr usr/share/ada/adainclude
	dh_installdocs -p$(devpkg) docs/*.html docs/*.css docs/*.txt docs/*.pdf
	dh_installinfo -p$(devpkg) docs/*.info
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-indep:

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