~ubuntu-branches/ubuntu/trusty/libgmpada/trusty-proposed

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Package Import Robot
  • Author(s): Nicolas Boulenguez
  • Date: 2012-04-04 21:36:48 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120404213648-vrgixrp1b1751keo
Tags: 0.0.20120331-1
* New upstream release (neither ALI nor SO changes).
* watch: search for bz2 tarballs too.
* control: -dbg does not Pre-Depends: ${misc:Pre-Depends} for multiarch.
  -dev Depends: libmpfr-dev and libgmp-dev (Closes: #667481).
* ada_libraries, control, rules: use dh_ada_library.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
LIB_NAME := gmpada
22
22
 
23
 
SOVERSION := $(shell sed -n 's/.*Soversion *:= *"\([[:digit:].]\+\)";.*/\1/p' $(LIB_NAME).gpr)
 
23
SOVERSION := 2
24
24
 
25
25
################################
26
26
# Build and test configuration #
27
27
################################
28
28
 
29
 
# Default values if these variables are not set in the environment.
30
 
# These flags are used in this Makefile as usual, in particular in the
31
 
# implicit rule compiling generate_constants.c. Prefer overriding them
32
 
# instead of cargs or largs..
33
 
CFLAGS  ?= -g -O2
34
 
LDFLAGS ?= -Wl,--as-needed
35
 
# -g: produce debugging information
36
 
# -O2: default optimization
37
 
# -Wl,--as-needed: link only needed libraries
38
 
 
39
 
# Gprbuild allows setting specific flags for each step (Compiler,
40
 
# Binder, Linker, Gprbuild) and language.
41
 
cargs     := $(CFLAGS)
42
 
cargs_Ada := -gnatn -gnatw.e -gnatwH
43
 
largs     := $(LDFLAGS)
44
 
gargs     := -R -s -j$(shell getconf _NPROCESSORS_ONLN)
45
 
# -gnatn: allow subprogram inlining
46
 
# -gnatw.e: activate all optional warnings
47
 
# -gnatwH: except hiding
48
 
# -R: no run path option
49
 
# -s: recompile if compilation switches have changed
50
 
 
51
 
# Here is the exhaustive flag list.
52
 
gpr_flag_names := \
53
 
  cargs cargs_Ada cargs_C \
54
 
  bargs bargs_Ada bargs_C \
55
 
  largs largs_Ada largs_C \
56
 
  gargs
57
 
 
58
 
 
59
 
# Note that -gargs must come last, or else following flags will be
60
 
# interpreted as linker flags.
61
 
 
62
 
# Build the actual command line flags. For readability, only append
63
 
# the non-empty variables.
64
 
define append_gprbuild_flag
65
 
  ifneq (,$$($(1)))
66
 
    GPRBUILD_FLAGS += -$(subst _,:,$(1)) $$($(1))
67
 
  endif
68
 
endef
69
 
$(foreach var,$(gpr_flag_names),$(eval $(call append_gprbuild_flag,$(var))))
 
29
# Use environment variables if available, this is common practice for
 
30
# CFLAGS and LDFLAGS.
 
31
CFLAGS   ?= -O2
 
32
ADAFLAGS ?= -O2
 
33
LDFLAGS  ?=
 
34
 
 
35
.NOTPARALLEL:
 
36
GPRBUILD_OPTIONS := -j$(shell getconf _NPROCESSORS_ONLN)
 
37
 
 
38
ifdef ALL_CHECKS
 
39
  CFLAGS += -Wall -Wextra -Wformat -Wformat-security -g
 
40
  ADAFLAGS += -Wall -Wextra -g -gnatE -gnatQ -gnatVa -gnata -gnatf      \
 
41
  -gnato -gnatq -gnatySdouxy
 
42
  GPRBUILD_OPTIONS += -s -we
 
43
endif
 
44
 
 
45
# We want the same compiler for generate_constants.c and the library.
 
46
CC := gnatgcc
70
47
 
71
48
##############################
72
49
# Installation configuration #
75
52
# Each of the following path should be prefixed with
76
53
DESTDIR :=
77
54
 
78
 
# The sources files are installed into a $(LIB_NAME) subdirectory of
 
55
# The sources files are installed into a LIB_NAME subdirectory of
79
56
SRC_DIR := usr/share/ada/adainclude
80
57
 
81
 
# A $(LIB_NAME).gpr project convenient for library usage is installed into
 
58
# A LIB_NAME.gpr project convenient for library usage is installed into
82
59
GPR_DIR := usr/share/ada/adainclude
83
60
# The content of this file ignores DESTDIR.
84
61
 
85
 
# The GNAT ALI files are installed into a $(LIB_NAME) subdirectory of
 
62
# The GNAT ALI files are installed into a LIB_NAME subdirectory of
86
63
ALI_DIR := usr/lib/ada/adalib
87
64
 
88
65
# The static and dynamic library are installed into
92
69
# Rules #
93
70
#########
94
71
 
 
72
# Function exporting a variable on the command line.
 
73
to_X_options = $(foreach var,$(1),-X$(var)="$($(var))")
 
74
 
95
75
build: build-dynamic build-static
96
76
 
97
77
build-dynamic build-static: build-%: src/gmp-constants.ads
98
 
        gprbuild $(GPRBUILD_FLAGS) $(LIB_NAME).gpr -XKIND=$*
 
78
        gprbuild $(LIB_NAME).gpr $(GPRBUILD_OPTIONS) -XKIND=$* $(call to_X_options,\
 
79
          ADAFLAGS CFLAGS LDFLAGS SOVERSION)
 
80
 
99
81
clean::
100
82
        rm -f $(foreach dir,obj lib,$(foreach kind,dynamic static,build-$(dir)-$(kind)/*))
101
83
 
112
94
        find -name "*~" -delete
113
95
 
114
96
test: build-static
115
 
        gprbuild $(GPRBUILD_FLAGS) demo/demo.gpr -XKIND=static
 
97
        gprbuild demo/demo.gpr $(GPRBUILD_OPTIONS) -XKIND=static $(call to_X_options,\
 
98
          ADAFLAGS CFLAGS LDFLAGS)
116
99
        demo/demo
 
100
# Gmpada.gpr is found in the current directory when executing this
 
101
# recipe, and will be found in the default system location after
 
102
# installation.
117
103
clean::
118
 
        rm -f demo/demo demo/obj/*
 
104
        gprclean -q demo/demo.gpr -XKIND=static
119
105
 
120
106
install: build
121
107
        install --directory $(DESTDIR)/$(SRC_DIR)/$(LIB_NAME)
140
126
        rm -f $(DESTDIR)/$(LIB_DIR)/lib$(LIB_NAME).so.$(SOVERSION)
141
127
        rm -f $(DESTDIR)/$(LIB_DIR)/lib$(LIB_NAME).so
142
128
 
143
 
# Paranoid flags for developpers.
144
 
 
145
 
# -g: debugging information
146
 
# -Wall: optional warnings
147
 
# -Wextra: extra warnings
148
 
# -fstack-check: stack overflow checking
149
 
# -gnatf: full errors
150
 
# -gnatq: dont’quit
151
 
# -gnatQ: generate ALI files for cross-ref
152
 
# -gnata: Assert and Debug pragmas
153
 
# -gnatVa: all validity checks
154
 
# -gnaty: all style checks
155
 
# -gnatyM159: max line length
156
 
# -gnato: runtime overflow checking
157
 
# -gnatE: checks for access-before-elaboration
158
 
# -E: exception backtraces
159
 
devel:
160
 
        $(MAKE) test CFLAGS="-g -O2 -Wall -Wextra -fstack-check" \
161
 
             cargs_Ada="-gnatn -gnatw.e -gnatwH -gnatf -gnatq -gnatQ -gnata -gnatVa -gnaty -gnatyM159 -gnato -gnatE" \
162
 
             bargs_Ada=-E
163
 
 
164
 
.PHONY: build build-dynamic build-static clean devel install test uninstall
 
129
.PHONY: build build-dynamic build-static clean install test uninstall