| 1 |
# Makefile for gnattools |
| 2 |
# Copyright 2003, 2004, 2009, 2010 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. |
| 19 |
all: gnattools |
| 20 |
|
| 21 |
# Standard autoconf-set variables. |
| 22 |
SHELL = @SHELL@ |
| 23 |
srcdir = @srcdir@ |
| 24 |
libdir = @libdir@ |
| 25 |
build = @build@ |
| 26 |
target = @target@ |
| 27 |
host = @host@ |
| 28 |
prefix = @prefix@ |
| 29 |
INSTALL = @INSTALL@ |
| 30 |
INSTALL_DATA = @INSTALL_DATA@ |
| 31 |
INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
| 32 |
|
| 33 |
# Nonstandard autoconf-set variables. |
| 34 |
LN_S=@LN_S@ |
| 35 |
target_noncanonical=@target_noncanonical@ |
| 36 |
host_noncanonical=@host_noncanonical@ |
| 37 |
|
| 38 |
# Variables for the user (or the top level) to override. |
| 39 |
exeext = @EXEEXT@ |
| 40 |
objext=.o |
| 41 |
TRACE=no |
| 42 |
ADA_FOR_BUILD= |
| 43 |
ADA_FOR_TARGET= |
| 44 |
LDFLAGS= |
| 45 |
PWD_COMMAND = $${PWDCMD-pwd} |
| 46 |
|
| 47 |
# The tedious process of getting CFLAGS right. |
| 48 |
CFLAGS=-g |
| 49 |
GCC_WARN_CFLAGS = -W -Wall |
| 50 |
WARN_CFLAGS = @warn_cflags@ |
| 51 |
|
| 52 |
ADA_CFLAGS=@ADA_CFLAGS@ |
| 53 |
|
| 54 |
PICFLAG = @PICFLAG@ |
| 55 |
LD_PICFLAG = @LD_PICFLAG@ |
| 56 |
|
| 57 |
# Variables for gnattools. |
| 58 |
ADAFLAGS= -gnatpg -gnata |
| 59 |
|
| 60 |
# For finding the GCC build dir, which is used far too much |
| 61 |
GCC_DIR=../gcc |
| 62 |
|
| 63 |
# Full path to top source directory |
| 64 |
ftop_srcdir := $(shell cd $(srcdir)/..;${PWD_COMMAND}) |
| 65 |
|
| 66 |
# Absolute srcdir for gcc (why do we want absolute? I dunno) |
| 67 |
fsrcdir := $(shell cd $(srcdir)/../gcc/; ${PWD_COMMAND}) |
| 68 |
|
| 69 |
# Useful "subroutines" for the excess includes |
| 70 |
INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \ |
| 71 |
-iquote $(fsrcdir)/ada -iquote $(fsrcdir)/config \ |
| 72 |
-iquote $(fsrcdir) -I$(ftop_srcdir)/include |
| 73 |
ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada |
| 74 |
|
| 75 |
CXX_LFLAGS = \ |
| 76 |
-B../../../$(target_noncanonical)/libstdc++-v3/src/.libs \ |
| 77 |
-B../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs \ |
| 78 |
-L../../../$(target_noncanonical)/libstdc++-v3/src/.libs \ |
| 79 |
-L../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs |
| 80 |
|
| 81 |
# Variables for gnattools, native |
| 82 |
TOOLS_FLAGS_TO_PASS_NATIVE= \ |
| 83 |
"CC=../../xgcc -B../../" \ |
| 84 |
"CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \ |
| 85 |
"CFLAGS=$(CFLAGS) $(WARN_CFLAGS) $(PICFLAG)" \ |
| 86 |
"LDFLAGS=$(LDFLAGS) $(LD_PICFLAG)" \ |
| 87 |
"ADAFLAGS=$(ADAFLAGS)" \ |
| 88 |
"ADA_CFLAGS=$(ADA_CFLAGS)" \ |
| 89 |
"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ |
| 90 |
"ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\ |
| 91 |
"exeext=$(exeext)" \ |
| 92 |
"fsrcdir=$(fsrcdir)" \ |
| 93 |
"srcdir=$(fsrcdir)" \ |
| 94 |
"GNATMAKE=../../gnatmake" \ |
| 95 |
"GNATLINK=../../gnatlink" \ |
| 96 |
"GNATBIND=../../gnatbind" \ |
| 97 |
"TOOLSCASE=native" |
| 98 |
|
| 99 |
# Variables for regnattools |
| 100 |
TOOLS_FLAGS_TO_PASS_RE= \ |
| 101 |
"CC=../../xgcc -B../../" \ |
| 102 |
"CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \ |
| 103 |
"CFLAGS=$(CFLAGS) $(WARN_CFLAGS) $(PICFLAG)" \ |
| 104 |
"LDFLAGS=$(LDFLAGS) $(LD_PICFLAG)" \ |
| 105 |
"ADAFLAGS=$(ADAFLAGS)" \ |
| 106 |
"ADA_CFLAGS=$(ADA_CFLAGS)" \ |
| 107 |
"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ |
| 108 |
"ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\ |
| 109 |
"exeext=$(exeext)" \ |
| 110 |
"fsrcdir=$(fsrcdir)" \ |
| 111 |
"srcdir=$(fsrcdir)" \ |
| 112 |
"GNATMAKE=../../gnatmake" \ |
| 113 |
"GNATLINK=../../gnatlink" \ |
| 114 |
"GNATBIND=../../gnatbind" \ |
| 115 |
"TOOLSCASE=cross" |
| 116 |
|
| 117 |
# Variables for gnattools, cross |
| 118 |
ifeq ($(build), $(host)) |
| 119 |
GNATMAKE_FOR_HOST=gnatmake |
| 120 |
GNATLINK_FOR_HOST=gnatlink |
| 121 |
GNATBIND_FOR_HOST=gnatbind |
| 122 |
GNATLS_FOR_HOST=gnatls |
| 123 |
else |
| 124 |
GNATMAKE_FOR_HOST=$(host_noncanonical)-gnatmake |
| 125 |
GNATLINK_FOR_HOST=$(host_noncanonical)-gnatlink |
| 126 |
GNATBIND_FOR_HOST=$(host_noncanonical)-gnatbind |
| 127 |
GNATLS_FOR_HOST=$(host_noncanonical)-gnatls |
| 128 |
endif |
| 129 |
|
| 130 |
# Put the host RTS dir first in the PATH to hide the default runtime |
| 131 |
# files that are among the sources |
| 132 |
RTS_DIR:=$(strip $(subst \,/,$(shell $(GNATLS_FOR_HOST) -v | grep adalib ))) |
| 133 |
|
| 134 |
TOOLS_FLAGS_TO_PASS_CROSS= \ |
| 135 |
"CC=$(CC)" \ |
| 136 |
"CXX=$(CXX)" \ |
| 137 |
"CFLAGS=$(CFLAGS) $(WARN_CFLAGS) $(PICFLAG)" \ |
| 138 |
"LDFLAGS=$(LDFLAGS) $(LD_PICFLAG)" \ |
| 139 |
"ADAFLAGS=$(ADAFLAGS)" \ |
| 140 |
"ADA_CFLAGS=$(ADA_CFLAGS)" \ |
| 141 |
"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ |
| 142 |
"ADA_INCLUDES=-I$(RTS_DIR)/../adainclude -I$(RTS_DIR) $(ADA_INCLUDES_FOR_SUBDIR)" \ |
| 143 |
"exeext=$(exeext)" \ |
| 144 |
"fsrcdir=$(fsrcdir)" \ |
| 145 |
"srcdir=$(fsrcdir)" \ |
| 146 |
"GNATMAKE=$(GNATMAKE_FOR_HOST)" \ |
| 147 |
"GNATLINK=$(GNATLINK_FOR_HOST)" \ |
| 148 |
"GNATBIND=$(GNATBIND_FOR_HOST)" \ |
| 149 |
"TOOLSCASE=cross" \ |
| 150 |
"LIBGNAT=" |
| 151 |
|
| 152 |
# File lists |
| 153 |
# ---------- |
| 154 |
|
| 155 |
# File associations set by configure |
| 156 |
EXTRA_GNATTOOLS = @EXTRA_GNATTOOLS@ |
| 157 |
TOOLS_TARGET_PAIRS = @TOOLS_TARGET_PAIRS@ |
| 158 |
|
| 159 |
# Makefile targets |
| 160 |
# ---------------- |
| 161 |
|
| 162 |
.PHONY: gnattools gnattools-native gnattools-cross regnattools |
| 163 |
gnattools: @default_gnattools_target@ |
| 164 |
|
| 165 |
# Sanity check |
| 166 |
$(GCC_DIR)/stamp-gnatlib-rts: |
| 167 |
@if [ ! -f $(GCC_DIR)/stamp-gnatlib-rts ] ; \ |
| 168 |
then \ |
| 169 |
echo "Cannot build gnattools while gnatlib is out of date or unbuilt" ; \ |
| 170 |
false; \ |
| 171 |
else \ |
| 172 |
true; \ |
| 173 |
fi |
| 174 |
|
| 175 |
|
| 176 |
# Build directory for the tools. We first need to copy the generated files, |
| 177 |
# then the target-dependent sources using the same mechanism as for gnatlib. |
| 178 |
|
| 179 |
GENERATED_FILES_FOR_TOOLS = \ |
| 180 |
einfo-entities.ads einfo-entities.adb sdefault.adb seinfo.ads \ |
| 181 |
sinfo-nodes.ads sinfo-nodes.adb snames.ads snames.adb |
| 182 |
|
| 183 |
$(GCC_DIR)/stamp-tools: |
| 184 |
-rm -rf $(GCC_DIR)/ada/tools |
| 185 |
-mkdir -p $(GCC_DIR)/ada/tools |
| 186 |
-(cd $(GCC_DIR)/ada/tools; $(foreach FILE,$(GENERATED_FILES_FOR_TOOLS), \ |
| 187 |
$(LN_S) ../$(FILE) $(FILE);)) |
| 188 |
-$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \ |
| 189 |
rm -f $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));\ |
| 190 |
$(LN_S) $(fsrcdir)/ada/$(word 2,$(subst <, ,$(PAIR))) \ |
| 191 |
$(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));) |
| 192 |
touch $(GCC_DIR)/stamp-tools |
| 193 |
|
| 194 |
# gnatmake/link tools cannot always be built with gnatmake/link for bootstrap |
| 195 |
# reasons: gnatmake should be built with a recent compiler, a recent compiler |
| 196 |
# may not generate ALI files compatible with an old gnatmake so it is important |
| 197 |
# to be able to build gnatmake without a version of gnatmake around. Once |
| 198 |
# everything has been compiled once, gnatmake can be recompiled with itself |
| 199 |
# (see target regnattools) |
| 200 |
gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib-rts |
| 201 |
# gnattools1 |
| 202 |
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ |
| 203 |
$(TOOLS_FLAGS_TO_PASS_NATIVE) \ |
| 204 |
../../gnatmake$(exeext) ../../gnatlink$(exeext) |
| 205 |
# gnattools2 |
| 206 |
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ |
| 207 |
$(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools |
| 208 |
|
| 209 |
# gnatmake/link can be built with recent gnatmake/link if they are available. |
| 210 |
# This is especially convenient for building cross tools or for rebuilding |
| 211 |
# the tools when the original bootstrap has already be done. |
| 212 |
regnattools: $(GCC_DIR)/stamp-gnatlib-rts |
| 213 |
# gnattools1-re |
| 214 |
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ |
| 215 |
$(TOOLS_FLAGS_TO_PASS_RE) INCLUDES="" \ |
| 216 |
gnatmake-re gnatlink-re |
| 217 |
# gnattools2 |
| 218 |
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ |
| 219 |
$(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools |
| 220 |
|
| 221 |
gnattools-cross: $(GCC_DIR)/stamp-tools |
| 222 |
# gnattools1-re |
| 223 |
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ |
| 224 |
$(TOOLS_FLAGS_TO_PASS_CROSS) INCLUDES="" \ |
| 225 |
gnatmake-re gnatlink-re |
| 226 |
# gnattools2 |
| 227 |
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ |
| 228 |
$(TOOLS_FLAGS_TO_PASS_CROSS) common-tools |
| 229 |
$(MAKE) -C $(GCC_DIR) gnattools-cross-mv |
| 230 |
|
| 231 |
# Other |
| 232 |
# ----- |
| 233 |
|
| 234 |
# Check uninstalled version. |
| 235 |
check: |
| 236 |
|
| 237 |
# Check installed version. |
| 238 |
installcheck: |
| 239 |
|
| 240 |
# Build info (none here). |
| 241 |
info: |
| 242 |
|
| 243 |
# Build DVI (none here). |
| 244 |
dvi: |
| 245 |
|
| 246 |
# Build PDF (none here). |
| 247 |
pdf: |
| 248 |
|
| 249 |
# Build HTML (none here). |
| 250 |
html: |
| 251 |
|
| 252 |
.PHONY: check installcheck info dvi pdf html |
| 253 |
|
| 254 |
# Build TAGS (none here). |
| 255 |
TAGS: |
| 256 |
|
| 257 |
# Installation rules. |
| 258 |
install: |
| 259 |
|
| 260 |
install-strip: install |
| 261 |
|
| 262 |
install-info: |
| 263 |
|
| 264 |
install-pdf: |
| 265 |
|
| 266 |
install-dvi: |
| 267 |
|
| 268 |
install-html: |
| 269 |
|
| 270 |
.PHONY: install install-strip install-info install-pdf install-dvi install-html |
| 271 |
|
| 272 |
# Cleaning rules. |
| 273 |
mostlyclean: |
| 274 |
|
| 275 |
clean: |
| 276 |
|
| 277 |
distclean: |
| 278 |
$(RM) Makefile config.status config.log config.cache |
| 279 |
|
| 280 |
maintainer-clean: |
| 281 |
|
| 282 |
.PHONY: mostlyclean clean distclean maintainer-clean |
| 283 |
|
| 284 |
# Rules for rebuilding this Makefile. |
| 285 |
Makefile: $(srcdir)/Makefile.in config.status |
| 286 |
CONFIG_FILES=$@ ; \ |
| 287 |
CONFIG_HEADERS= ; \ |
| 288 |
$(SHELL) ./config.status |
| 289 |
|
| 290 |
config.status: $(srcdir)/configure |
| 291 |
$(SHELL) ./config.status --recheck |
| 292 |
|
| 293 |
AUTOCONF = autoconf |
| 294 |
configure_deps = \ |
| 295 |
$(srcdir)/configure.ac \ |
| 296 |
$(srcdir)/../config/acx.m4 \ |
| 297 |
$(srcdir)/../config/override.m4 |
| 298 |
|
| 299 |
$(srcdir)/configure: @MAINT@ $(configure_deps) |
| 300 |
cd $(srcdir) && $(AUTOCONF) |
| 301 |
|
| 302 |
# Don't export variables to the environment, in order to not confuse |
| 303 |
# configure. |
| 304 |
.NOEXPORT: |
| 305 |
|