rust: Implement TARGET_RUST_OS_INFO for *-*-freebsd*
[official-gcc.git] / libgm2 / libm2pim / Makefile.am
blobf940dd29aa69b08832e315d1055ca12efba5fcd1
1 # Makefile for libm2pim.
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 .mod .def .o .obj .lo .a .la
20 ACLOCAL_AMFLAGS = -I .. -I ../config
22 VPATH = . @srcdir@ @srcdir@/../../gcc/m2/gm2-libs
24 # Multilib support.
25 MAKEOVERRIDES=
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 slibdir = @slibdir@
34 toolexeclibdir=@toolexeclibdir@
35 toolexecdir=@toolexecdir@
37 MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory)
38 MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory)
40 MULTIOSSUBDIR := $(shell if test x$(MULTIOSDIR) != x.; then echo /$(MULTIOSDIR); fi)
41 inst_libdir = $(libsubdir)$(MULTISUBDIR)
42 inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)
45 # Work around what appears to be a GNU make bug handling MAKEFLAGS
46 # values defined in terms of make variables, as is the case for CC and
47 # friends when we are called from the top level Makefile.
48 AM_MAKEFLAGS = \
49         "GCC_DIR=$(GCC_DIR)" \
50         "GM2_SRC=$(GM2_SRC)" \
51         "AR_FLAGS=$(AR_FLAGS)" \
52         "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
53         "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
54         "GM2_FOR_TARGET=$(GM2_FOR_TARGET)" \
55         "CFLAGS=$(CFLAGS)" \
56         "CXXFLAGS=$(CXXFLAGS)" \
57         "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
58         "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
59         "INSTALL=$(INSTALL)" \
60         "INSTALL_DATA=$(INSTALL_DATA)" \
61         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
62         "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
63         "LDFLAGS=$(LDFLAGS)" \
64         "LIBCFLAGS=$(LIBCFLAGS)" \
65         "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
66         "MAKE=$(MAKE)" \
67         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
68         "MULTISUBDIR=$(MULTISUBDIR)" \
69         "MULTIOSDIR=$(MULTIOSDIR)" \
70         "MULTIBUILDTOP=$(MULTIBUILDTOP)" \
71         "MULTIFLAGS=$(MULTIFLAGS)" \
72         "PICFLAG=$(PICFLAG)" \
73         "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
74         "SHELL=$(SHELL)" \
75         "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
76         "exec_prefix=$(exec_prefix)" \
77         "infodir=$(infodir)" \
78         "libdir=$(libdir)" \
79         "includedir=$(includedir)" \
80         "prefix=$(prefix)" \
81         "tooldir=$(tooldir)" \
82         "AR=$(AR)" \
83         "AS=$(AS)" \
84         "LD=$(LD)" \
85         "RANLIB=$(RANLIB)" \
86         "NM=$(NM)" \
87         "NM_FOR_BUILD=$(NM_FOR_BUILD)" \
88         "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
89         "DESTDIR=$(DESTDIR)" \
90         "WERROR=$(WERROR)" \
91         "TARGET_LONGDOUBLE_ABI=$(TARGET_LONGDOUBLE_ABI)" \
92         "TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)"
94 # Subdir rules rely on $(FLAGS_TO_PASS)
95 FLAGS_TO_PASS = $(AM_MAKEFLAGS)
97 if BUILD_PIMLIB
98 toolexeclib_LTLIBRARIES = libm2pim.la
100 M2MODS = ASCII.mod IO.mod \
101        Args.mod M2RTS.mod \
102        M2Dependent.mod \
103        Assertion.mod NumberIO.mod \
104        Break.mod SYSTEM.mod \
105        CmdArgs.mod Scan.mod \
106        StrCase.mod FIO.mod \
107        StrIO.mod StrLib.mod \
108        TimeString.mod Environment.mod \
109        FpuIO.mod Debug.mod \
110        SysStorage.mod Storage.mod \
111        StdIO.mod SEnvironment.mod \
112        DynamicStrings.mod SFIO.mod \
113        SArgs.mod SCmdArgs.mod \
114        PushBackInput.mod \
115        StringConvert.mod FormatStrings.mod \
116        Builtins.mod MathLib0.mod \
117        M2EXCEPTION.mod RTExceptions.mod \
118        SMathLib0.mod RTint.mod \
119        Indexing.mod \
120        LMathLib0.mod LegacyReal.mod \
121        MemUtils.mod gdbif.mod \
122        GetOpt.mod OptLib.mod
124 # COROUTINES.mod has been removed as it is implemented in ../libm2iso.
126 M2DEFS = Args.def   ASCII.def \
127          Assertion.def  Break.def \
128          Builtins.def  cbuiltin.def \
129          CmdArgs.def COROUTINES.def \
130          cxxabi.def  Debug.def \
131          dtoa.def  DynamicStrings.def \
132          Environment.def  errno.def \
133          FIO.def  FormatStrings.def \
134          FpuIO.def  gdbif.def \
135          Indexing.def \
136          IO.def  ldtoa.def \
137          LegacyReal.def  libc.def \
138          libm.def  LMathLib0.def \
139          M2Dependent.def \
140          M2EXCEPTION.def \
141          M2RTS.def \
142          MathLib0.def  MemUtils.def \
143          NumberIO.def  PushBackInput.def \
144          RTExceptions.def  RTint.def \
145          SArgs.def  SCmdArgs.def \
146          Scan.def \
147          sckt.def  Selective.def \
148          SEnvironment.def  SFIO.def \
149          SMathLib0.def  StdIO.def \
150          Storage.def  StrCase.def \
151          StringConvert.def  StrIO.def \
152          StrLib.def  SysExceptions.def \
153          SysStorage.def  SYSTEM.def \
154          termios.def  TimeString.def \
155          UnixArgs.def  wrapc.def  \
156          GetOpt.def OptLib.def \
157          cgetopt.def
159 libm2pim_la_SOURCES = $(M2MODS) \
160                       UnixArgs.cc \
161                       Selective.cc sckt.cc \
162                       errno.cc dtoa.cc \
163                       ldtoa.cc termios.cc \
164                       SysExceptions.cc target.c \
165                       wrapc.cc cgetopt.cc
167 libm2pimdir = libm2pim
168 libm2pim_la_DEPENDENCIES = SYSTEM.def $(addsuffix .lo, $(basename $(libm2pim_la_SOURCES)))
169 libm2pim_la_CFLAGS = \
170   -I. -I.. -I$(GM2_SRC)/gm2-libs -I$(GM2_SRC)/gm2-libs-iso \
171   -DBUILD_GM2_LIBS -I@srcdir@/../  -I@srcdir@/../libm2iso \
172   $(TARGET_LONGDOUBLE_ABI)
173 libm2pim_la_M2FLAGS = \
174   -fm2-pathname=m2pim -I. -I$(GM2_SRC)/gm2-libs \
175   -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
176   -fm2-g -g -Wcase-enum -Wreturn-type -fcase -fm2-prefix=m2pim \
177   $(TARGET_LONGDOUBLE_ABI)
178 if TARGET_DARWIN
179 libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup
180 else
181 libm2pim_la_link_flags =
182 endif
183 libm2pim_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2pim_la_link_flags)
184 BUILT_SOURCES = SYSTEM.def
185 CLEANFILES = SYSTEM.def
187 M2LIBDIR = /m2/m2pim/
189 SYSTEM.def: Makefile
190         bash $(GM2_SRC)/tools-src/makeSystem -fpim \
191              $(GM2_SRC)/gm2-libs/SYSTEM.def \
192              $(GM2_SRC)/gm2-libs/SYSTEM.mod \
193              -I$(GM2_SRC)/gm2-libs \
194              "$(GM2_FOR_TARGET)" $@
196 .mod.lo: SYSTEM.def
197         $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
198                    --mode=compile $(GM2_FOR_TARGET) \
199                    -c $(CFLAGS_FOR_TARGET) $(LIBCFLAGS) $(libm2pim_la_M2FLAGS) $< -o $@
201 .cc.lo:
202         $(LIBTOOL) --tag=CXX --mode=compile $(CXX) -c -I$(srcdir) \
203                    $(CXXFLAGS) $(LIBCFLAGS) $(libm2pim_la_CFLAGS) $< -o $@
205 install-data-local: force
206         mkdir -p $(DESTDIR)$(inst_libdir)/$(M2LIBDIR)
207         for i in $(M2DEFS) $(M2MODS) ; do \
208            if [ -f $$i ] ; then \
209               $(INSTALL_DATA) $$i '$(DESTDIR)$(inst_libdir)/$(M2LIBDIR)'; \
210            elif [ -f @srcdir@/../../gcc/m2/gm2-libs/$$i ] ; then \
211               $(INSTALL_DATA) @srcdir@/../../gcc/m2/gm2-libs/$$i '$(DESTDIR)$(inst_libdir)/$(M2LIBDIR)'; \
212            else \
213               echo "cannot find $$i" ; exit 1 ; \
214            fi ; \
215            chmod 644 $(DESTDIR)$(inst_libdir)/$(M2LIBDIR)$$i ; \
216         done
218 force:
220 endif