File: rules

package info (click to toggle)
asis 2018-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 13,528 kB
  • sloc: ada: 155,205; makefile: 297; sh: 67; xml: 48; csh: 10
file content (111 lines) | stat: -rwxr-xr-x 4,527 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
#! /usr/bin/make -rf
# Debian build script for asis
# Copyright (c) 2003-2014 Ludovic Brenta <lbrenta@debian.org>
# Copyright (c) 2013-2018 Nicolas Boulenguez <nicolas@debian.org>

# 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 3, 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, see <http://www.gnu.org/licenses/>.

$(foreach line,$(shell sed -n '\
  s/^ gnat, gnat-\([0-9.]\+\),$$/ \
    GNAT_VERSION:=\1 \
  /p;\
  s/^Package: lib[a-z-]\+\([0-9.]\+\)$$/ \
    soversion:=\1 \
  /p;\
  ' debian/control),$(eval $(line)))

DEB_BUILD_MAINT_OPTIONS := hardening=+all
include /usr/share/dpkg/default.mk
include /usr/share/ada/debian_packaging-$(GNAT_VERSION).mk

ADAFLAGS += -gnatfno -gnatwa -gnatVa

BUILDER_OPTIONS := $(subst -j,-XPROCESSORS=,$(BUILDER_OPTIONS))

######################################################################
%:
	dh $@ --with ada-library

# Ignore upstream Makefile/configure.
.PHONY: $(addprefix override_dh_auto_,configure build-arch build-indep test install clean)

######################################################################
# Build dynamic and static versions of the library.
# Import the dynamic version of the library and build each tool.
# Upstream Makefile does not allow to select tool, skip a static assistant,
# or select gnat2xml mains.
ALL_TOOLS := \
  asistant gnat2xml gnatcheck gnatelim gnatmetric gnatpp gnatstub gnattest
# Only this selection will be built and installed.
TOOLS := $(ALL_TOOLS)

# Building a tool will force the build of the shared libasis.
# build-factory will force the build of the static libasis.
# The aggregate project increases performance, as gprbuild only parses
# all projects once.
override_dh_auto_build-arch: dynamic_aggregate.gpr build-factory
	gprbuild $< -p $(BUILDER_OPTIONS) \
	  $(foreach v,ADAFLAGS LDFLAGS soversion,"-X$(v)=$($(v))")
override_dh_auto_clean:: dynamic_aggregate.gpr
	gprclean $< -Xsoversion=$(soversion)
	rm -f $<
dynamic_aggregate.gpr:
	echo 'aggregate project dynamic_aggregate is for project_files use ($(foreach t,$(TOOLS),"tools/$(t)/$(t).gpr",) "asis.gpr");end dynamic_aggregate;' > $@

######################################################################
# The factory generated sources are required for both -arch (for
# gnat2xml gnatpp) and -indep (for the schemas via gnat2xsd).
# The static ASIS library is built here as a dependency.
factory_dir := tools/tool_utils
factory_gpr := $(factory_dir)/generate_factory.gpr
factory_exe := $(factory_dir)/ada_trees-generate_factory
factory_out := ada_trees-factory

.PHONY: build-factory
build-factory:
	gprbuild $(factory_gpr) -p $(BUILDER_OPTIONS) \
	  $(foreach v,ADAFLAGS LDFLAGS,"-X$(v)=$($(v))")
	$(factory_exe)
	mv -f $(factory_out).nb $(factory_dir)/$(factory_out).adb
	mv -f $(factory_out).ns $(factory_dir)/$(factory_out).ads
override_dh_auto_clean::
	gprclean asis.gpr
	gprclean $(factory_gpr)
	rm -f $(factory_dir)/$(factory_out).ad[bs] $(factory_out).n[bs]

######################################################################
xsd_dir  := tools/gnat2xml
xsd_gpr  := $(xsd_dir)/gnat2xml.gpr
xsd_main := gnat2xml-gnat2xsd
xsd_exe  := LD_LIBRARY_PATH=lib-dynamic $(xsd_dir)/gnat2xsd

ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
override_dh_auto_build-indep: build-factory
	gprbuild $(xsd_gpr) $(xsd_main) -p $(BUILDER_OPTIONS) \
	  $(foreach v,ADAFLAGS LDFLAGS,"-X$(v)=$($(v))")
	$(xsd_exe)           > $(xsd_dir)/ada-schema.xsd
	$(xsd_exe) --compact > $(xsd_dir)/ada-schema.compact.xsd
endif
override_dh_auto_clean::
	gprclean $(xsd_gpr)
	rm -f $(xsd_dir)/ada-schema.xsd $(xsd_dir)/ada-schema.compact.xsd

######################################################################
.PHONY: override_dh_install
override_dh_install:
	dh_install --package=asis-programs $(foreach t,$(TOOLS),tools/$(t)/$(t)) usr/bin
	dh_install --remaining-packages

.PHONY: override_dh_installman
override_dh_installman:
	dh_installman --package=asis-programs $(foreach t,$(TOOLS),debian/man/$(t).1)
	dh_installman --remaining-packages