]>
Commit | Line | Data |
---|---|---|
7401123f | 1 | # Makefile for libm2pim. |
a6dce348 | 2 | # Copyright 2013-2022 Free Software Foundation, Inc. |
7401123f GM |
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 .mod .def .o .obj .lo .a .la | |
19 | ||
20 | ACLOCAL_AMFLAGS = -I . -I .. -I ../config | |
21 | ||
22 | VPATH = . @srcdir@ @srcdir@/../../gcc/m2/gm2-libs | |
23 | ||
24 | # Multilib support. | |
25 | MAKEOVERRIDES= | |
26 | ||
27 | version := $(shell $(CC) -dumpversion) | |
28 | ||
29 | # Directory in which the compiler finds libraries etc. | |
30 | libsubdir = $(libdir)/gcc/$(target_alias)/$(version) | |
31 | # Used to install the shared libgcc. | |
32 | slibdir = @slibdir@ | |
33 | ||
34 | toolexeclibdir=@toolexeclibdir@ | |
35 | toolexecdir=@toolexecdir@ | |
36 | ||
37 | MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory) | |
38 | MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory) | |
39 | ||
40 | MULTIOSSUBDIR := $(shell if test x$(MULTIOSDIR) != x.; then echo /$(MULTIOSDIR); fi) | |
41 | inst_libdir = $(libsubdir)$(MULTISUBDIR) | |
42 | inst_slibdir = $(slibdir)$(MULTIOSSUBDIR) | |
43 | ||
44 | ||
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 | "toolexeclibdir=$(toolexeclibdir)" \ | |
83 | "toolexecdir=$(toolexecdir)" \ | |
84 | "gxx_include_dir=$(gxx_include_dir)" \ | |
85 | "AR=$(AR)" \ | |
86 | "AS=$(AS)" \ | |
87 | "LD=$(LD)" \ | |
88 | "RANLIB=$(RANLIB)" \ | |
89 | "NM=$(NM)" \ | |
90 | "NM_FOR_BUILD=$(NM_FOR_BUILD)" \ | |
91 | "NM_FOR_TARGET=$(NM_FOR_TARGET)" \ | |
92 | "DESTDIR=$(DESTDIR)" \ | |
93 | "WERROR=$(WERROR)" \ | |
94 | "TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" | |
95 | ||
96 | # Subdir rules rely on $(FLAGS_TO_PASS) | |
97 | FLAGS_TO_PASS = $(AM_MAKEFLAGS) | |
98 | ||
99 | if BUILD_PIMLIB | |
100 | toolexeclib_LTLIBRARIES = libm2pim.la | |
101 | ||
102 | M2MODS = ASCII.mod IO.mod \ | |
103 | Args.mod M2RTS.mod \ | |
6bafc4d5 | 104 | M2Dependent.mod \ |
7401123f GM |
105 | Assertion.mod NumberIO.mod \ |
106 | Break.mod SYSTEM.mod \ | |
107 | CmdArgs.mod Scan.mod \ | |
108 | StrCase.mod FIO.mod \ | |
109 | StrIO.mod StrLib.mod \ | |
110 | TimeString.mod Environment.mod \ | |
111 | FpuIO.mod Debug.mod \ | |
112 | SysStorage.mod Storage.mod \ | |
113 | StdIO.mod SEnvironment.mod \ | |
114 | DynamicStrings.mod SFIO.mod \ | |
115 | SArgs.mod SCmdArgs.mod \ | |
116 | PushBackInput.mod \ | |
117 | StringConvert.mod FormatStrings.mod \ | |
118 | Builtins.mod MathLib0.mod \ | |
119 | M2EXCEPTION.mod RTExceptions.mod \ | |
120 | SMathLib0.mod RTint.mod \ | |
121 | COROUTINES.mod Indexing.mod \ | |
122 | LMathLib0.mod LegacyReal.mod \ | |
123 | MemUtils.mod gdbif.mod \ | |
124 | GetOpt.mod OptLib.mod | |
125 | ||
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 \ | |
6bafc4d5 | 139 | M2Dependent.def \ |
c196fa13 GM |
140 | M2EXCEPTION.def M2LINK.def \ |
141 | M2RTS.def \ | |
7401123f GM |
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 | |
158 | ||
159 | libm2pim_la_SOURCES = $(M2MODS) \ | |
160 | UnixArgs.c \ | |
161 | Selective.c sckt.c \ | |
162 | errno.c dtoa.c \ | |
163 | ldtoa.c termios.c \ | |
164 | SysExceptions.c target.c \ | |
165 | wrapc.c cgetopt.c | |
166 | ||
167 | libm2pimdir = libm2pim | |
867acc2e | 168 | libm2pim_la_DEPENDENCIES = SYSTEM.def $(addsuffix .lo, $(basename $(libm2pim_la_SOURCES))) |
7401123f GM |
169 | libm2pim_la_CFLAGS = -I. -I$(GM2_SRC)/gm2-libs -I$(GM2_SRC)/gm2-libs-iso -DBUILD_GM2_LIBS -I@srcdir@/../ |
170 | libm2pim_la_M2FLAGS = -I. -I$(GM2_SRC)/gm2-libs -I$(GM2_SRC)/gm2-libs-iso -fm2-g -g | |
171 | libm2pim_la_LINK = $(LINK) -version-info $(libtool_VERSION) | |
172 | BUILT_SOURCES = SYSTEM.def | |
173 | CLEANFILES = SYSTEM.def | |
174 | ||
175 | M2LIBDIR = /m2/m2pim/ | |
176 | ||
177 | SYSTEM.def: Makefile | |
178 | bash $(GM2_SRC)/tools-src/makeSystem -fpim \ | |
179 | $(GM2_SRC)/gm2-libs/SYSTEM.def \ | |
180 | $(GM2_SRC)/gm2-libs/SYSTEM.mod \ | |
181 | -I$(GM2_SRC)/gm2-libs \ | |
182 | "$(GM2_FOR_TARGET)" $@ | |
183 | ||
184 | .mod.lo: SYSTEM.def | |
185 | $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(GM2_FOR_TARGET) -c $(CFLAGS_FOR_TARGET) $(LIBCFLAGS) $(libm2pim_la_M2FLAGS) $< -o $@ | |
186 | ||
187 | install-data-local: force | |
188 | mkdir -p $(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR) | |
189 | $(INSTALL_DATA) .libs/libm2pim.la $(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR) | |
190 | chmod 644 $(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR)libm2pim.la | |
191 | $(INSTALL_DATA) .libs/libm2pim.a $(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR) | |
192 | $(RANLIB) $(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR)libm2pim.a | |
193 | for i in $(M2DEFS) $(M2MODS) ; do \ | |
194 | if [ -f $$i ] ; then \ | |
195 | $(INSTALL_DATA) $$i '$(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR)'; \ | |
196 | elif [ -f @srcdir@/../../gcc/m2/gm2-libs/$$i ] ; then \ | |
197 | $(INSTALL_DATA) @srcdir@/../../gcc/m2/gm2-libs/$$i '$(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR)'; \ | |
198 | else \ | |
199 | echo "cannot find $$i" ; exit 1 ; \ | |
200 | fi ; \ | |
201 | chmod 644 $(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR)$$i ; \ | |
202 | done | |
203 | ||
204 | force: | |
205 | ||
206 | endif |