1# Makefile for libada.
2#   Copyright (C) 2003-2015 Free Software Foundation, Inc.
3#
4# This file is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3 of the License, or
7# (at your option) any later version.
8# 
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13# 
14# You should have received a copy of the GNU General Public License
15# along with this program; see the file COPYING3.  If not see
16# <http://www.gnu.org/licenses/>.
17
18# Default target; must be first.
19all: gnatlib
20	$(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
21
22.PHONY: all
23
24## Multilib support variables.
25MULTISRCTOP =
26MULTIBUILDTOP =
27MULTIDIRS =
28MULTISUBDIR =
29MULTIDO = true
30MULTICLEAN = true
31
32# Standard autoconf-set variables.
33SHELL = @SHELL@
34srcdir = @srcdir@
35libdir = @libdir@
36build = @build@
37target = @target@
38prefix = @prefix@
39
40# Nonstandard autoconf-set variables.
41enable_shared = @enable_shared@
42
43LN_S=@LN_S@
44AWK=@AWK@
45
46ifeq (cp -p,$(LN_S))
47LN_S_RECURSIVE = cp -pR
48else
49LN_S_RECURSIVE = $(LN_S)
50endif
51
52# Variables for the user (or the top level) to override.
53objext=.o
54THREAD_KIND=native
55TRACE=no
56LDFLAGS=
57
58# The tedious process of getting CFLAGS right.
59CFLAGS=-g
60PICFLAG = @PICFLAG@
61GNATLIBFLAGS= -W -Wall -gnatpg -nostdinc
62GNATLIBCFLAGS= -g -O2
63GNATLIBCFLAGS_FOR_C = -W -Wall $(GNATLIBCFLAGS) $(CFLAGS_FOR_TARGET) \
64	-fexceptions -DIN_RTS @have_getipinfo@
65
66host_subdir = @host_subdir@
67GCC_DIR=$(MULTIBUILDTOP)../../$(host_subdir)/gcc
68
69target_noncanonical:=@target_noncanonical@
70version := $(shell cat $(srcdir)/../gcc/BASE-VER)
71libsubdir := $(libdir)/gcc/$(target_noncanonical)/$(version)$(MULTISUBDIR)
72ADA_RTS_DIR=$(GCC_DIR)/ada/rts$(subst /,_,$(MULTISUBDIR))
73ADA_RTS_SUBDIR=./rts$(subst /,_,$(MULTISUBDIR))
74
75# exeext should not be used because it's the *host* exeext.  We're building
76# a *target* library, aren't we?!?  Likewise for CC.  Still, provide bogus
77# definitions just in case something slips through the safety net provided
78# by recursive make invocations in gcc/ada/Makefile.in
79LIBADA_FLAGS_TO_PASS = \
80        "MAKEOVERRIDES=" \
81        "LDFLAGS=$(LDFLAGS)" \
82        "LN_S=$(LN_S)" \
83        "SHELL=$(SHELL)" \
84        "GNATLIBFLAGS=$(GNATLIBFLAGS) $(MULTIFLAGS)" \
85        "GNATLIBCFLAGS=$(GNATLIBCFLAGS) $(MULTIFLAGS)" \
86        "GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(MULTIFLAGS)" \
87        "PICFLAG_FOR_TARGET=$(PICFLAG)" \
88        "THREAD_KIND=$(THREAD_KIND)" \
89        "TRACE=$(TRACE)" \
90        "MULTISUBDIR=$(MULTISUBDIR)" \
91        "libsubdir=$(libsubdir)" \
92        "objext=$(objext)" \
93        "prefix=$(prefix)" \
94        "exeext=.exeext.should.not.be.used " \
95	'CC=the.host.compiler.should.not.be.needed' \
96	"GCC_FOR_TARGET=$(CC)" \
97        "CFLAGS=$(CFLAGS)"
98
99# Rules to build gnatlib.
100.PHONY: gnatlib gnatlib-plain gnatlib-sjlj gnatlib-zcx gnatlib-shared osconstool
101gnatlib: @default_gnatlib_target@
102
103gnatlib-plain: osconstool $(GCC_DIR)/ada/Makefile
104	test -f stamp-libada || \
105	$(MAKE) -C $(GCC_DIR)/ada $(LIBADA_FLAGS_TO_PASS) gnatlib \
106	&& touch stamp-libada
107	-rm -rf adainclude
108	-rm -rf adalib
109	$(LN_S_RECURSIVE) $(ADA_RTS_DIR) adainclude
110	$(LN_S_RECURSIVE) $(ADA_RTS_DIR) adalib
111
112gnatlib-sjlj gnatlib-zcx gnatlib-shared: osconstool $(GCC_DIR)/ada/Makefile
113	test -f stamp-libada || \
114	$(MAKE) -C $(GCC_DIR)/ada $(LIBADA_FLAGS_TO_PASS) $@ \
115	&& touch stamp-libada
116	-rm -rf adainclude
117	-rm -rf adalib
118	$(LN_S_RECURSIVE) $(ADA_RTS_DIR) adainclude
119	$(LN_S_RECURSIVE) $(ADA_RTS_DIR) adalib
120
121osconstool:
122	$(MAKE) -C $(GCC_DIR)/ada $(LIBADA_FLAGS_TO_PASS) ./bldtools/oscons/xoscons
123
124install-gnatlib: $(GCC_DIR)/ada/Makefile
125	$(MAKE) -C $(GCC_DIR)/ada $(LIBADA_FLAGS_TO_PASS) install-gnatlib
126
127# Check uninstalled version.
128check:
129
130# Check installed version.
131installcheck:
132
133# Build info (none here).
134info:
135
136# Build DVI (none here).
137dvi:
138
139# Build PDF (none here).
140pdf:
141
142# Build html (none here).
143html:
144
145# Build TAGS (none here).
146TAGS:
147
148.PHONY: check installcheck info dvi pdf html
149
150# Installation rules.
151install: install-gnatlib
152	$(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE)
153
154install-strip: install
155
156install-info:
157
158install-pdf:
159
160install-html:
161
162.PHONY: install install-strip install-info install-pdf install-html
163
164# Cleaning rules.
165mostlyclean:
166	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE)
167
168clean:
169	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean # $(MAKE)
170
171distclean:
172	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
173	$(RM) Makefile config.status config.log
174
175maintainer-clean:
176
177.PHONY: mostlyclean clean distclean maintainer-clean
178
179# Rules for rebuilding this Makefile.
180Makefile: $(srcdir)/Makefile.in config.status
181	CONFIG_FILES=$@ ; \
182	CONFIG_HEADERS= ; \
183	$(SHELL) ./config.status
184
185config.status: $(srcdir)/configure
186	$(SHELL) ./config.status --recheck
187
188AUTOCONF = autoconf
189configure_deps = \
190	$(srcdir)/configure.ac \
191	$(srcdir)/../config/acx.m4 \
192	$(srcdir)/../config/override.m4 \
193	$(srcdir)/../config/multi.m4
194
195$(srcdir)/configure: @MAINT@ $(configure_deps)
196	cd $(srcdir) && $(AUTOCONF)
197
198# Don't export variables to the environment, in order to not confuse
199# configure.
200.NOEXPORT:
201