| 1 |
# Makefile for libm2log. |
| 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 .mod .def .o .obj .lo .a .la |
| 19 |
|
| 20 |
ACLOCAL_AMFLAGS = -I .. -I ../config |
| 21 |
|
| 22 |
VPATH = . @srcdir@ @srcdir@/../../gcc/m2/gm2-libs-log |
| 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 |
slibdir = @slibdir@ |
| 33 |
|
| 34 |
toolexeclibdir=@toolexeclibdir@ |
| 35 |
toolexecdir=@toolexecdir@ |
| 36 |
GM2_FOR_TARGET=@GM2_FOR_TARGET@ |
| 37 |
|
| 38 |
MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory) |
| 39 |
MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory) |
| 40 |
|
| 41 |
MULTIOSSUBDIR := $(shell if test x$(MULTIOSDIR) != x.; then echo /$(MULTIOSDIR); fi) |
| 42 |
inst_libdir = $(libsubdir)$(MULTISUBDIR) |
| 43 |
inst_slibdir = $(slibdir)$(MULTIOSSUBDIR) |
| 44 |
|
| 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_LOGLIB |
| 100 |
M2DEFS = BitBlockOps.def BitByteOps.def \ |
| 101 |
BitWordOps.def BlockOps.def \ |
| 102 |
Break.def CardinalIO.def \ |
| 103 |
Conversions.def DebugPMD.def \ |
| 104 |
DebugTrace.def Delay.def \ |
| 105 |
Display.def ErrorCode.def \ |
| 106 |
FileSystem.def FloatingUtilities.def \ |
| 107 |
InOut.def Keyboard.def \ |
| 108 |
LongIO.def NumberConversion.def \ |
| 109 |
Random.def RealConversions.def \ |
| 110 |
RealInOut.def Strings.def \ |
| 111 |
Termbase.def Terminal.def \ |
| 112 |
TimeDate.def |
| 113 |
|
| 114 |
M2MODS = BitBlockOps.mod BitByteOps.mod \ |
| 115 |
BitWordOps.mod BlockOps.mod \ |
| 116 |
CardinalIO.mod Conversions.mod \ |
| 117 |
DebugPMD.mod DebugTrace.mod \ |
| 118 |
Delay.mod Display.mod \ |
| 119 |
ErrorCode.mod FileSystem.mod \ |
| 120 |
FloatingUtilities.mod InOut.mod \ |
| 121 |
Keyboard.mod LongIO.mod \ |
| 122 |
NumberConversion.mod Random.mod \ |
| 123 |
RealConversions.mod RealInOut.mod \ |
| 124 |
Strings.mod Termbase.mod \ |
| 125 |
Terminal.mod TimeDate.mod |
| 126 |
|
| 127 |
|
| 128 |
libm2logdir = libm2log |
| 129 |
toolexeclib_LTLIBRARIES = libm2log.la |
| 130 |
libm2log_la_SOURCES = $(M2MODS) Break.c |
| 131 |
|
| 132 |
libm2log_la_DEPENDENCIES = ../libm2pim/SYSTEM.def $(addsuffix .lo, $(basename $(libm2log_la_SOURCES))) |
| 133 |
libm2log_la_CFLAGS = -I. -DBUILD_GM2_LIBS -I@srcdir@/../ |
| 134 |
libm2log_la_M2FLAGS = \ |
| 135 |
-fm2-pathname=m2pim -I../libm2pim \ |
| 136 |
-fm2-pathname=m2log -I$(GM2_SRC)/gm2-libs-log \ |
| 137 |
-fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs \ |
| 138 |
-fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \ |
| 139 |
-Wcase-enum -Wreturn-type \ |
| 140 |
-fcase -fm2-prefix=m2log |
| 141 |
|
| 142 |
if TARGET_DARWIN |
| 143 |
libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup |
| 144 |
else |
| 145 |
libm2log_la_link_flags = |
| 146 |
endif |
| 147 |
if ENABLE_DARWIN_AT_RPATH |
| 148 |
libm2log_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/ |
| 149 |
endif |
| 150 |
libm2log_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2log_la_link_flags) -lm |
| 151 |
BUILT_SOURCES = ../libm2pim/SYSTEM.def |
| 152 |
|
| 153 |
M2LIBDIR = /m2/m2log/ |
| 154 |
|
| 155 |
../libm2pim/SYSTEM.def: ../libm2pim/Makefile |
| 156 |
cd ../libm2pim ; $(MAKE) $(AM_MAKEFLAGS) SYSTEM.def |
| 157 |
|
| 158 |
.mod.lo: |
| 159 |
$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \ |
| 160 |
$(GM2_FOR_TARGET) -c \ |
| 161 |
$(CFLAGS_FOR_TARGET) $(LIBCFLAGS) $(libm2log_la_M2FLAGS) $< -o $@ |
| 162 |
|
| 163 |
install-data-local: force |
| 164 |
mkdir -p $(DESTDIR)$(inst_libdir)/$(M2LIBDIR) |
| 165 |
for i in $(M2DEFS) $(M2MODS) ; do \ |
| 166 |
if [ -f $$i ] ; then \ |
| 167 |
$(INSTALL_DATA) $$i '$(DESTDIR)$(inst_libdir)/$(M2LIBDIR)'; \ |
| 168 |
elif [ -f @srcdir@/../../gcc/m2/gm2-libs-log/$$i ] ; then \ |
| 169 |
$(INSTALL_DATA) @srcdir@/../../gcc/m2/gm2-libs-log/$$i '$(DESTDIR)$(inst_libdir)/$(M2LIBDIR)'; \ |
| 170 |
else \ |
| 171 |
echo "cannot find $$i" ; exit 1 ; \ |
| 172 |
fi ; \ |
| 173 |
chmod 644 $(DESTDIR)$(inst_libdir)/$(M2LIBDIR)$$i ; \ |
| 174 |
done |
| 175 |
|
| 176 |
force: |
| 177 |
|
| 178 |
endif |