File: rules

package info (click to toggle)
asis 2014-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 14,064 kB
  • ctags: 37
  • sloc: ada: 146,541; makefile: 364; sh: 50; xml: 48; csh: 10
file content (82 lines) | stat: -rwxr-xr-x 3,351 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
#! /usr/bin/make -rf
# Debian build script for asis
# Copyright (c) 2003-2014 Ludovic Brenta <lbrenta@debian.org>
# Copyright (c) 2013-2014 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/>.

include /usr/share/dpkg/default.mk
include /usr/share/ada/debian_packaging.mk
ADAFLAGS += -gnatfno -gnatwa -gnatVa

soversion := $(shell sed -n -e "s/^Package: libasis\([[:digit:]]\+\)$$/\1/p" debian/control)
ifndef soversion
  $(warning Could not guess soversion from debian/control)
endif

BUILDER_OPTIONS := \
  $(subst -j,-XPROCESSORS=,$(BUILDER_OPTIONS)) \
  $(foreach v,ADAFLAGS LDFLAGS soversion,"-X$(v)=$($(v))")

######################################################################
POLICY_TARGETS := binary binary-arch binary-indep build build-arch \
  build-indep clean
.PHONY: $(POLICY_TARGETS)
$(POLICY_TARGETS):
	dh $@ --with ada-library

# Ignore upstream Makefile.
override_dh_auto_configure:
override_dh_auto_build-arch:
override_dh_auto_build-indep:
override_dh_auto_test:
override_dh_auto_install:
override_dh_auto_clean::

######################################################################
# Build dynamic and static versions of the library.
# Import the dynamic version of the library and build each tool.
TOOLS := asistant gnat2xml gnatcheck gnatelim gnatmetric gnatpp gnatstub gnattest

# Gnatmake/clean fails on non existing object directories.
OBJ_DIRS := lib-dynamic obj-dynamic tools/gnat2xml/obj

BUILD_TOOLS := $(addprefix build-,$(TOOLS))
override_dh_auto_build-arch: build-asis $(BUILD_TOOLS)
 # Static ASIS build.
	gnatmake -XLIBRARY_KIND=static -Pasis.gpr $(BUILDER_OPTIONS)
 # Dynamic ASIS build is a separate target so that build-TOOL can be tested efficiently.
build-asis:
	mkdir -p $(OBJ_DIRS)
	gnatmake -XLIBRARY_KIND=dynamic -Pasis.gpr $(BUILDER_OPTIONS)
$(BUILD_TOOLS): build-%: build-asis
	gnatmake -XLIBRARY_KIND=dynamic -Ptools/$*/$*.gpr $(EXECUTABLE) $(BUILDER_OPTIONS)

# For now, restrict gnat2xml.gpr to one executable. See asis-doc.TODO.
build-gnat2xml: EXECUTABLE := gnat2xml-driver.adb

# Restrict gnatcheck to one executable. -docgen seems unusable in this
# archive, it relies on a texinfo source per rule.
build-gnatcheck: EXECUTABLE := gnatcheck-driver.adb

override_dh_auto_clean::
	mkdir -p $(OBJ_DIRS)
	gnatclean -XLIBRARY_KIND=static -Pasis.gpr
  # Parts of tool_utils are compiled because some tools import it.
	for subdir in tool_utils $(TOOLS); do \
	  gnatclean -XLIBRARY_KIND=dynamic -Ptools/$$subdir/$$subdir.gpr; \
	done
  # Gnatclean would not remove the directories nor the .so file.
	rm -fr lib-dynamic obj-dynamic

override_dh_install-arch:
	dh_install --package=asis-programs $(foreach t,$(TOOLS),tools/$(t)/$(t)) usr/bin