| 1 |
# Makefile for libm2iso. |
| 2 |
# Copyright 2013-2022 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 |
SUFFIXES = .c .cc .mod .def .o .obj .lo .a .la |
| 19 |
|
| 20 |
ACLOCAL_AMFLAGS = -I .. -I ../config |
| 21 |
|
| 22 |
VPATH = . @srcdir@ @srcdir@/../../gcc/m2/gm2-libs-iso |
| 23 |
|
| 24 |
# Multilib support. |
| 25 |
MAKEOVERRIDES= |
| 26 |
|
| 27 |
gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER) |
| 28 |
|
| 29 |
# Directory in which the compiler finds libraries etc. |
| 30 |
libsubdir = $(libdir)/gcc/$(target_alias)/$(gcc_version) |
| 31 |
# Used to install the shared libgcc. |
| 32 |
# was slibdir = @slibdir@ |
| 33 |
slibdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR) |
| 34 |
|
| 35 |
toolexeclibdir=@toolexeclibdir@ |
| 36 |
toolexecdir=@toolexecdir@ |
| 37 |
GM2_FOR_TARGET=@GM2_FOR_TARGET@ |
| 38 |
|
| 39 |
MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory) |
| 40 |
MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory) |
| 41 |
|
| 42 |
MULTIOSSUBDIR := $(shell if test x$(MULTIOSDIR) != x.; then echo /$(MULTIOSDIR); fi) |
| 43 |
inst_libdir = $(libsubdir)$(MULTISUBDIR) |
| 44 |
inst_slibdir = $(slibdir)$(MULTIOSSUBDIR) |
| 45 |
|
| 46 |
# Work around what appears to be a GNU make bug handling MAKEFLAGS |
| 47 |
# values defined in terms of make variables, as is the case for CC and |
| 48 |
# friends when we are called from the top level Makefile. |
| 49 |
AM_MAKEFLAGS = \ |
| 50 |
"GCC_DIR=$(GCC_DIR)" \ |
| 51 |
"GM2_SRC=$(GM2_SRC)" \ |
| 52 |
"AR_FLAGS=$(AR_FLAGS)" \ |
| 53 |
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \ |
| 54 |
"CC_FOR_TARGET=$(CC_FOR_TARGET)" \ |
| 55 |
"GM2_FOR_TARGET=$(GM2_FOR_TARGET)" \ |
| 56 |
"CFLAGS=$(CFLAGS)" \ |
| 57 |
"CXXFLAGS=$(CXXFLAGS)" \ |
| 58 |
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ |
| 59 |
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \ |
| 60 |
"INSTALL=$(INSTALL)" \ |
| 61 |
"INSTALL_DATA=$(INSTALL_DATA)" \ |
| 62 |
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ |
| 63 |
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \ |
| 64 |
"LDFLAGS=$(LDFLAGS)" \ |
| 65 |
"LIBCFLAGS=$(LIBCFLAGS)" \ |
| 66 |
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \ |
| 67 |
"MAKE=$(MAKE)" \ |
| 68 |
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \ |
| 69 |
"MULTISUBDIR=$(MULTISUBDIR)" \ |
| 70 |
"MULTIOSDIR=$(MULTIOSDIR)" \ |
| 71 |
"MULTIBUILDTOP=$(MULTIBUILDTOP)" \ |
| 72 |
"MULTIFLAGS=$(MULTIFLAGS)" \ |
| 73 |
"PICFLAG=$(PICFLAG)" \ |
| 74 |
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \ |
| 75 |
"SHELL=$(SHELL)" \ |
| 76 |
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \ |
| 77 |
"exec_prefix=$(exec_prefix)" \ |
| 78 |
"infodir=$(infodir)" \ |
| 79 |
"libdir=$(libdir)" \ |
| 80 |
"includedir=$(includedir)" \ |
| 81 |
"prefix=$(prefix)" \ |
| 82 |
"tooldir=$(tooldir)" \ |
| 83 |
"gxx_include_dir=$(gxx_include_dir)" \ |
| 84 |
"AR=$(AR)" \ |
| 85 |
"AS=$(AS)" \ |
| 86 |
"LD=$(LD)" \ |
| 87 |
"RANLIB=$(RANLIB)" \ |
| 88 |
"NM=$(NM)" \ |
| 89 |
"NM_FOR_BUILD=$(NM_FOR_BUILD)" \ |
| 90 |
"NM_FOR_TARGET=$(NM_FOR_TARGET)" \ |
| 91 |
"DESTDIR=$(DESTDIR)" \ |
| 92 |
"WERROR=$(WERROR)" \ |
| 93 |
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" |
| 94 |
|
| 95 |
# Subdir rules rely on $(FLAGS_TO_PASS) |
| 96 |
FLAGS_TO_PASS = $(AM_MAKEFLAGS) |
| 97 |
|
| 98 |
|
| 99 |
if BUILD_ISOLIB |
| 100 |
M2DEFS = ChanConsts.def CharClass.def \ |
| 101 |
ClientSocket.def ComplexMath.def \ |
| 102 |
ConvStringLong.def ConvStringReal.def \ |
| 103 |
ConvStringShort.def \ |
| 104 |
ConvTypes.def COROUTINES.def \ |
| 105 |
ErrnoCategory.def EXCEPTIONS.def \ |
| 106 |
GeneralUserExceptions.def IOChan.def \ |
| 107 |
IOChanUtils.def \ |
| 108 |
IOConsts.def IOLink.def \ |
| 109 |
IOResult.def LongComplexMath.def \ |
| 110 |
LongConv.def LongIO.def \ |
| 111 |
LongMath.def LongStr.def \ |
| 112 |
LongWholeIO.def LowLong.def \ |
| 113 |
LowReal.def LowShort.def \ |
| 114 |
M2EXCEPTION.def M2RTS.def \ |
| 115 |
MemStream.def \ |
| 116 |
Preemptive.def \ |
| 117 |
Processes.def ProgramArgs.def \ |
| 118 |
RandomNumber.def \ |
| 119 |
RawIO.def RealConv.def \ |
| 120 |
RealIO.def RealMath.def \ |
| 121 |
RealStr.def RndFile.def \ |
| 122 |
RTco.def \ |
| 123 |
RTdata.def RTentity.def \ |
| 124 |
RTfio.def RTgen.def \ |
| 125 |
RTgenif.def RTio.def \ |
| 126 |
Semaphores.def SeqFile.def \ |
| 127 |
ShortComplexMath.def \ |
| 128 |
ShortConv.def \ |
| 129 |
ShortIO.def \ |
| 130 |
ShortMath.def ShortStr.def \ |
| 131 |
ShortWholeIO.def \ |
| 132 |
SimpleCipher.def SIOResult.def \ |
| 133 |
SLongIO.def SLongWholeIO.def \ |
| 134 |
SRawIO.def SRealIO.def \ |
| 135 |
SShortIO.def SShortWholeIO.def \ |
| 136 |
StdChans.def STextIO.def \ |
| 137 |
Storage.def StreamFile.def \ |
| 138 |
StringChan.def Strings.def \ |
| 139 |
SWholeIO.def SysClock.def \ |
| 140 |
SYSTEM.def TermFile.def \ |
| 141 |
TERMINATION.def TextIO.def \ |
| 142 |
TextUtil.def \ |
| 143 |
WholeConv.def WholeIO.def \ |
| 144 |
WholeStr.def wrapclock.def \ |
| 145 |
wrapsock.def wraptime.def |
| 146 |
|
| 147 |
M2MODS = ChanConsts.mod CharClass.mod \ |
| 148 |
ClientSocket.mod ComplexMath.mod \ |
| 149 |
ConvStringLong.mod ConvStringReal.mod \ |
| 150 |
ConvStringShort.mod \ |
| 151 |
ConvTypes.mod COROUTINES.mod \ |
| 152 |
EXCEPTIONS.mod GeneralUserExceptions.mod \ |
| 153 |
IOChan.mod IOChanUtils.mod \ |
| 154 |
IOConsts.mod \ |
| 155 |
IOLink.mod IOResult.mod \ |
| 156 |
LongComplexMath.mod LongConv.mod \ |
| 157 |
LongIO.mod LongMath.mod \ |
| 158 |
LongStr.mod LongWholeIO.mod \ |
| 159 |
LowLong.mod LowReal.mod \ |
| 160 |
LowShort.mod M2EXCEPTION.mod \ |
| 161 |
M2RTS.mod MemStream.mod \ |
| 162 |
Preemptive.mod \ |
| 163 |
Processes.mod \ |
| 164 |
ProgramArgs.mod RandomNumber.mod \ |
| 165 |
RawIO.mod RealConv.mod \ |
| 166 |
RealIO.mod RealMath.mod \ |
| 167 |
RealStr.mod RndFile.mod \ |
| 168 |
RTdata.mod RTentity.mod \ |
| 169 |
RTfio.mod RTgenif.mod \ |
| 170 |
RTgen.mod RTio.mod \ |
| 171 |
Semaphores.mod SeqFile.mod \ |
| 172 |
ShortComplexMath.mod \ |
| 173 |
ShortConv.mod \ |
| 174 |
ShortIO.mod \ |
| 175 |
ShortMath.mod ShortStr.mod \ |
| 176 |
ShortWholeIO.mod \ |
| 177 |
SimpleCipher.mod SIOResult.mod \ |
| 178 |
SLongIO.mod SLongWholeIO.mod \ |
| 179 |
SRawIO.mod SRealIO.mod \ |
| 180 |
SShortIO.mod SShortWholeIO.mod \ |
| 181 |
StdChans.mod STextIO.mod \ |
| 182 |
Storage.mod StreamFile.mod \ |
| 183 |
StringChan.mod Strings.mod \ |
| 184 |
SWholeIO.mod SysClock.mod \ |
| 185 |
SYSTEM.mod TermFile.mod \ |
| 186 |
TERMINATION.mod TextIO.mod \ |
| 187 |
TextUtil.mod \ |
| 188 |
WholeConv.mod WholeIO.mod \ |
| 189 |
WholeStr.mod |
| 190 |
|
| 191 |
toolexeclib_LTLIBRARIES = libm2iso.la |
| 192 |
libm2iso_la_SOURCES = $(M2MODS) \ |
| 193 |
ErrnoCategory.cc RTco.cc wrapclock.cc wraptime.cc wrapsock.c |
| 194 |
# wrapsock.cc |
| 195 |
|
| 196 |
C_INCLUDES = -I.. -I$(toplevel_srcdir)/libiberty -I$(toplevel_srcdir)/include |
| 197 |
|
| 198 |
libm2isodir = libm2iso |
| 199 |
libm2iso_la_DEPENDENCIES = SYSTEM.def $(addsuffix .lo, $(basename $(libm2iso_la_SOURCES))) |
| 200 |
libm2iso_la_CFLAGS = \ |
| 201 |
$(C_INCLUDES) -I. -I.. -I$(GM2_SRC)/gm2-libs-iso -I$(GM2_SRC)/gm2-libs \ |
| 202 |
-DBUILD_GM2_LIBS -I@srcdir@/../ -I../../../gcc -I$(GCC_DIR) -I$(GCC_DIR)/../include \ |
| 203 |
-I../../libgcc -I$(GCC_DIR)/../libgcc -I$(MULTIBUILDTOP)../../gcc/include |
| 204 |
|
| 205 |
libm2iso_la_M2FLAGS = \ |
| 206 |
-fm2-pathname=m2iso -I. -Ilibm2iso -I$(GM2_SRC)/gm2-libs-iso \ |
| 207 |
-fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs \ |
| 208 |
-fiso -fextended-opaque -fm2-g -g -Wcase-enum \ |
| 209 |
-Wreturn-type -fcase -fm2-prefix=m2iso |
| 210 |
|
| 211 |
if TARGET_DARWIN |
| 212 |
libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup |
| 213 |
else |
| 214 |
libm2iso_la_link_flags = |
| 215 |
endif |
| 216 |
if ENABLE_DARWIN_AT_RPATH |
| 217 |
libm2iso_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/ |
| 218 |
endif |
| 219 |
|
| 220 |
libm2iso_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2iso_la_link_flags) -lm |
| 221 |
CLEANFILES = SYSTEM.def |
| 222 |
BUILT_SOURCES = SYSTEM.def |
| 223 |
|
| 224 |
M2LIBDIR = /m2/m2iso/ |
| 225 |
|
| 226 |
M2HEADER_FILES = m2rts.h |
| 227 |
|
| 228 |
SYSTEM.def: Makefile |
| 229 |
bash $(GM2_SRC)/tools-src/makeSystem -fiso \ |
| 230 |
$(GM2_SRC)/gm2-libs-iso/SYSTEM.def \ |
| 231 |
$(GM2_SRC)/gm2-libs-iso/SYSTEM.mod \ |
| 232 |
-I$(GM2_SRC)/gm2-libs-iso -I$(GM2_SRC)/gm2-libs \ |
| 233 |
"$(GM2_FOR_TARGET)" $@ |
| 234 |
|
| 235 |
.mod.lo: |
| 236 |
$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \ |
| 237 |
$(GM2_FOR_TARGET) -c \ |
| 238 |
$(CFLAGS_FOR_TARGET) $(LIBCFLAGS) $(libm2iso_la_M2FLAGS) $< -o $@ |
| 239 |
|
| 240 |
.cc.lo: |
| 241 |
$(LIBTOOL) --tag=CXX --mode=compile $(CXX) -c -I$(srcdir) \ |
| 242 |
$(CXXFLAGS) $(LIBCFLAGS) $(libm2iso_la_CFLAGS) $< -o $@ |
| 243 |
|
| 244 |
.c.lo: |
| 245 |
$(LIBTOOL) --tag=CC --mode=compile $(CC) -c -I$(srcdir) \ |
| 246 |
$(CFLAGS) $(LIBCFLAGS) $(libm2iso_la_CFLAGS) $< -o $@ |
| 247 |
|
| 248 |
install-data-local: force |
| 249 |
mkdir -p $(DESTDIR)$(inst_libdir)/$(M2LIBDIR) |
| 250 |
for i in $(M2DEFS) $(M2MODS) ; do \ |
| 251 |
if [ -f $$i ] ; then \ |
| 252 |
$(INSTALL_DATA) $$i '$(DESTDIR)$(inst_libdir)/$(M2LIBDIR)'; \ |
| 253 |
elif [ -f @srcdir@/../../gcc/m2/gm2-libs-iso/$$i ] ; then \ |
| 254 |
$(INSTALL_DATA) @srcdir@/../../gcc/m2/gm2-libs-iso/$$i '$(DESTDIR)$(inst_libdir)/$(M2LIBDIR)'; \ |
| 255 |
else \ |
| 256 |
echo "cannot find $$i" ; exit 1 ; \ |
| 257 |
fi ; \ |
| 258 |
chmod 644 $(DESTDIR)$(inst_libdir)/$(M2LIBDIR)$$i ; \ |
| 259 |
done |
| 260 |
for i in $(M2HEADER_FILES) ; do \ |
| 261 |
if [ -f @srcdir@/$$i ] ; then \ |
| 262 |
$(INSTALL_DATA) @srcdir@/$$i '$(DESTDIR)$(inst_libdir)/$(M2LIBDIR)'; \ |
| 263 |
else \ |
| 264 |
echo "cannot find $$i" ; exit 1 ; \ |
| 265 |
fi ; \ |
| 266 |
chmod 644 $(DESTDIR)$(inst_libdir)/$(M2LIBDIR)$$i ; \ |
| 267 |
done |
| 268 |
|
| 269 |
force: |
| 270 |
|
| 271 |
endif |