1 # Makefile for libm2iso.
2 # Copyright 2013-2022 Free Software Foundation, Inc.
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.
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.
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/>.
18 SUFFIXES = .c .cc .mod .def .o .obj .lo .a .la
20 ACLOCAL_AMFLAGS = -I .. -I ../config
22 VPATH = . @srcdir@ @srcdir@/../../gcc/m2/gm2-libs-iso
27 gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
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)
35 toolexeclibdir=@toolexeclibdir@
36 toolexecdir=@toolexecdir@
37 GM2_FOR_TARGET=@GM2_FOR_TARGET@
39 MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory)
40 MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory)
42 MULTIOSSUBDIR := $(shell if test x$(MULTIOSDIR) != x.; then echo /$(MULTIOSDIR); fi)
43 inst_libdir = $(libsubdir)$(MULTISUBDIR)
44 inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)
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.
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)" \
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)" \
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)" \
76 "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
77 "exec_prefix=$(exec_prefix)" \
78 "infodir=$(infodir)" \
80 "includedir=$(includedir)" \
82 "tooldir=$(tooldir)" \
83 "gxx_include_dir=$(gxx_include_dir)" \
89 "NM_FOR_BUILD=$(NM_FOR_BUILD)" \
90 "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
91 "DESTDIR=$(DESTDIR)" \
93 "TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)"
95 # Subdir rules rely on $(FLAGS_TO_PASS)
96 FLAGS_TO_PASS = $(AM_MAKEFLAGS)
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 IOConsts.def IOLink.def \
108 IOResult.def LongComplexMath.def \
109 LongConv.def LongIO.def \
110 LongMath.def LongStr.def \
111 LongWholeIO.def LowLong.def \
112 LowReal.def LowShort.def \
113 M2EXCEPTION.def M2RTS.def \
116 Processes.def ProgramArgs.def \
118 RawIO.def RealConv.def \
119 RealIO.def RealMath.def \
120 RealStr.def RndFile.def \
122 RTdata.def RTentity.def \
123 RTfio.def RTgen.def \
124 RTgenif.def RTio.def \
125 Semaphores.def SeqFile.def \
126 ShortComplexMath.def \
129 ShortMath.def ShortStr.def \
131 SimpleCipher.def SIOResult.def \
132 SLongIO.def SLongWholeIO.def \
133 SRawIO.def SRealIO.def \
134 SShortIO.def SShortWholeIO.def \
135 StdChans.def STextIO.def \
136 Storage.def StreamFile.def \
137 StringChan.def Strings.def \
138 SWholeIO.def SysClock.def \
139 SYSTEM.def TermFile.def \
140 TERMINATION.def TextIO.def \
142 WholeConv.def WholeIO.def \
143 WholeStr.def wrapclock.def \
144 wrapsock.def wraptime.def
146 M2MODS = ChanConsts.mod CharClass.mod \
147 ClientSocket.mod ComplexMath.mod \
148 ConvStringLong.mod ConvStringReal.mod \
149 ConvStringShort.mod \
150 ConvTypes.mod COROUTINES.mod \
151 EXCEPTIONS.mod GeneralUserExceptions.mod \
152 IOChan.mod IOConsts.mod \
153 IOLink.mod IOResult.mod \
154 LongComplexMath.mod LongConv.mod \
155 LongIO.mod LongMath.mod \
156 LongStr.mod LongWholeIO.mod \
157 LowLong.mod LowReal.mod \
158 LowShort.mod M2EXCEPTION.mod \
159 M2RTS.mod MemStream.mod \
162 ProgramArgs.mod RandomNumber.mod \
163 RawIO.mod RealConv.mod \
164 RealIO.mod RealMath.mod \
165 RealStr.mod RndFile.mod \
166 RTdata.mod RTentity.mod \
167 RTfio.mod RTgenif.mod \
169 Semaphores.mod SeqFile.mod \
170 ShortComplexMath.mod \
173 ShortMath.mod ShortStr.mod \
175 SimpleCipher.mod SIOResult.mod \
176 SLongIO.mod SLongWholeIO.mod \
177 SRawIO.mod SRealIO.mod \
178 SShortIO.mod SShortWholeIO.mod \
179 StdChans.mod STextIO.mod \
180 Storage.mod StreamFile.mod \
181 StringChan.mod Strings.mod \
182 SWholeIO.mod SysClock.mod \
183 SYSTEM.mod TermFile.mod \
184 TERMINATION.mod TextIO.mod \
186 WholeConv.mod WholeIO.mod \
189 toolexeclib_LTLIBRARIES = libm2iso.la
190 libm2iso_la_SOURCES = $(M2MODS) \
191 ErrnoCategory.cc RTco.cc wrapclock.cc wraptime.cc wrapsock.c
194 C_INCLUDES = -I.. -I$(toplevel_srcdir)/libiberty -I$(toplevel_srcdir)/include
196 libm2isodir = libm2iso
197 libm2iso_la_DEPENDENCIES = SYSTEM.def $(addsuffix .lo, $(basename $(libm2iso_la_SOURCES)))
198 libm2iso_la_CFLAGS = \
199 $(C_INCLUDES) -I. -I.. -I$(GM2_SRC)/gm2-libs-iso -I$(GM2_SRC)/gm2-libs \
200 -DBUILD_GM2_LIBS -I@srcdir@/../ -I../../../gcc -I$(GCC_DIR) -I$(GCC_DIR)/../include \
201 -I../../libgcc -I$(GCC_DIR)/../libgcc -I$(MULTIBUILDTOP)../../gcc/include
203 libm2iso_la_M2FLAGS = \
204 -fm2-pathname=m2iso -I. -Ilibm2iso -I$(GM2_SRC)/gm2-libs-iso \
205 -fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs \
206 -fiso -fextended-opaque -fm2-g -g -Wcase-enum \
207 -Wreturn-type -fcase -fm2-prefix=m2iso
210 libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup
212 libm2iso_la_link_flags =
214 if ENABLE_DARWIN_AT_RPATH
215 libm2iso_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
218 libm2iso_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2iso_la_link_flags)
219 CLEANFILES = SYSTEM.def
220 BUILT_SOURCES = SYSTEM.def
222 M2LIBDIR = /m2/m2iso/
224 M2HEADER_FILES = m2rts.h
227 bash $(GM2_SRC)/tools-src/makeSystem -fiso \
228 $(GM2_SRC)/gm2-libs-iso/SYSTEM.def \
229 $(GM2_SRC)/gm2-libs-iso/SYSTEM.mod \
230 -I$(GM2_SRC)/gm2-libs-iso -I$(GM2_SRC)/gm2-libs \
231 "$(GM2_FOR_TARGET)" $@
234 $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
235 $(GM2_FOR_TARGET) -c \
236 $(CFLAGS_FOR_TARGET) $(LIBCFLAGS) $(libm2iso_la_M2FLAGS) $< -o $@
239 $(LIBTOOL) --tag=CXX --mode=compile $(CXX) -c -I$(srcdir) \
240 $(CXXFLAGS) $(LIBCFLAGS) $(libm2iso_la_CFLAGS) $< -o $@
243 $(LIBTOOL) --tag=CC --mode=compile $(CC) -c -I$(srcdir) \
244 $(CFLAGS) $(LIBCFLAGS) $(libm2iso_la_CFLAGS) $< -o $@
246 install-data-local: force
247 mkdir -p $(DESTDIR)$(inst_libdir)/$(M2LIBDIR)
248 for i in $(M2DEFS) $(M2MODS) ; do \
249 if [ -f $$i ] ; then \
250 $(INSTALL_DATA) $$i '$(DESTDIR)$(inst_libdir)/$(M2LIBDIR)'; \
251 elif [ -f @srcdir@/../../gcc/m2/gm2-libs-iso/$$i ] ; then \
252 $(INSTALL_DATA) @srcdir@/../../gcc/m2/gm2-libs-iso/$$i '$(DESTDIR)$(inst_libdir)/$(M2LIBDIR)'; \
254 echo "cannot find $$i" ; exit 1 ; \
256 chmod 644 $(DESTDIR)$(inst_libdir)/$(M2LIBDIR)$$i ; \
258 for i in $(M2HEADER_FILES) ; do \
259 if [ -f @srcdir@/$$i ] ; then \
260 $(INSTALL_DATA) @srcdir@/$$i '$(DESTDIR)$(inst_libdir)/$(M2LIBDIR)'; \
262 echo "cannot find $$i" ; exit 1 ; \
264 chmod 644 $(DESTDIR)$(inst_libdir)/$(M2LIBDIR)$$i ; \