mirror of
https://git.planet-casio.com/Lephenixnoir/OpenLibm.git
synced 2024-12-26 19:43:40 +01:00
65aaba96e1
This is because all of these headers are included in direct style with no subfolder so we need them to be in a quite public `include/` folder. The Makefile installs in `include/openlibm/` but this only works with extra `-I` flags that are quite annoying to enforce. With this change, the only OpenLibm headers that are installed are named `openlibm_*.h`, which is sufficient in terms of namespacing. Also add a symlink libm.a -> libopenlibm.a.
123 lines
3.5 KiB
Makefile
123 lines
3.5 KiB
Makefile
OPENLIBM_HOME=$(abspath .)
|
|
include ./Make.inc
|
|
|
|
SUBDIRS = src $(ARCH) bsdsrc
|
|
ifeq ($(LONG_DOUBLE_NOT_DOUBLE),1)
|
|
# Add ld80 directory on x86 and x64
|
|
ifneq ($(filter $(ARCH),i387 amd64),)
|
|
SUBDIRS += ld80
|
|
else
|
|
ifneq ($(filter $(ARCH),aarch64),)
|
|
SUBDIRS += ld128
|
|
else
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
define INC_template
|
|
TEST=test
|
|
override CUR_SRCS = $(1)_SRCS
|
|
include $(1)/Make.files
|
|
SRCS += $$(addprefix $(1)/,$$($(1)_SRCS))
|
|
endef
|
|
|
|
DIR=test
|
|
|
|
$(foreach dir,$(SUBDIRS),$(eval $(call INC_template,$(dir))))
|
|
|
|
DUPLICATE_NAMES = $(filter $(patsubst %.S,%,$($(ARCH)_SRCS)),$(patsubst %.c,%,$(src_SRCS)))
|
|
DUPLICATE_SRCS = $(addsuffix .c,$(DUPLICATE_NAMES))
|
|
|
|
OBJS = $(patsubst %.f,%.f.o,\
|
|
$(patsubst %.S,%.S.o,\
|
|
$(patsubst %.c,%.c.o,$(filter-out $(addprefix src/,$(DUPLICATE_SRCS)),$(SRCS)))))
|
|
|
|
# If we're on windows, don't do versioned shared libraries. Also, generate an import library
|
|
# for the DLL. If we're on OSX, put the version number before the .dylib. Otherwise,
|
|
# put it after.
|
|
ifeq ($(OS), WINNT)
|
|
OLM_MAJOR_MINOR_SHLIB_EXT := $(SHLIB_EXT)
|
|
LDFLAGS_add += -Wl,--out-implib,libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT).a
|
|
else
|
|
ifeq ($(OS), Darwin)
|
|
OLM_MAJOR_MINOR_SHLIB_EXT := $(SOMAJOR).$(SOMINOR).$(SHLIB_EXT)
|
|
OLM_MAJOR_SHLIB_EXT := $(SOMAJOR).$(SHLIB_EXT)
|
|
else
|
|
OLM_MAJOR_MINOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR).$(SOMINOR)
|
|
OLM_MAJOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR)
|
|
endif
|
|
endif
|
|
|
|
.PHONY: all check test clean distclean \
|
|
install install-static install-shared install-pkgconfig install-headers
|
|
|
|
|
|
OLM_LIBS := libopenlibm.a
|
|
ifeq ($(filter wasm32 sh3eb,$(ARCH)),)
|
|
OLM_LIBS += libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
|
|
endif
|
|
|
|
all : $(OLM_LIBS)
|
|
|
|
check test: test/test-double test/test-float
|
|
test/test-double
|
|
test/test-float
|
|
|
|
libopenlibm.a: $(OBJS)
|
|
$(AR) -rcs libopenlibm.a $(OBJS)
|
|
|
|
libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT): $(OBJS)
|
|
$(CC) -shared $(OBJS) $(LDFLAGS) $(LDFLAGS_add) -Wl,$(SONAME_FLAG),libopenlibm.$(OLM_MAJOR_SHLIB_EXT) -o $@
|
|
ifneq ($(OS),WINNT)
|
|
ln -sf $@ libopenlibm.$(OLM_MAJOR_SHLIB_EXT)
|
|
ln -sf $@ libopenlibm.$(SHLIB_EXT)
|
|
endif
|
|
|
|
test/test-double: libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
|
|
$(MAKE) -C test test-double
|
|
|
|
test/test-float: libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
|
|
$(MAKE) -C test test-float
|
|
|
|
clean:
|
|
rm -f aarch64/*.o amd64/*.o arm/*.o bsdsrc/*.o i387/*.o ld80/*.o ld128/*.o src/*.o powerpc/*.o mips/*.o s390/*.o sh3eb/*.o
|
|
rm -f libopenlibm.a libopenlibm.*$(SHLIB_EXT)*
|
|
$(MAKE) -C test clean
|
|
|
|
openlibm.pc: openlibm.pc.in Make.inc Makefile
|
|
echo "prefix=${prefix}" > openlibm.pc
|
|
echo "version=${VERSION}" >> openlibm.pc
|
|
cat openlibm.pc.in >> openlibm.pc
|
|
|
|
install-static: libopenlibm.a
|
|
mkdir -p $(DESTDIR)$(libdir)
|
|
cp -RpP -f libopenlibm.a $(DESTDIR)$(libdir)/
|
|
|
|
install-static-superh: install-static
|
|
ln -sf libopenlibm.a $(DESTDIR)$(libdir)/libm.a
|
|
|
|
install-shared: libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
|
|
mkdir -p $(DESTDIR)$(shlibdir)
|
|
cp -RpP -f libopenlibm.*$(SHLIB_EXT)* $(DESTDIR)$(shlibdir)/
|
|
|
|
install-pkgconfig: openlibm.pc
|
|
mkdir -p $(DESTDIR)$(pkgconfigdir)
|
|
cp -RpP -f openlibm.pc $(DESTDIR)$(pkgconfigdir)/
|
|
|
|
install-headers:
|
|
mkdir -p $(DESTDIR)$(includedir)/openlibm
|
|
cp -RpP -f include/*.h $(DESTDIR)$(includedir)/openlibm
|
|
cp -RpP -f src/*.h $(DESTDIR)$(includedir)/openlibm
|
|
|
|
install-headers-superh:
|
|
mkdir -p $(DESTDIR)$(includedir)
|
|
cp -RpP -f \
|
|
include/openlibm.h \
|
|
include/openlibm_complex.h \
|
|
include/openlibm_defs.h \
|
|
include/openlibm_fenv.h \
|
|
include/openlibm_fenv_sh3eb.h \
|
|
include/openlibm_math.h \
|
|
$(DESTDIR)$(includedir)
|
|
|
|
install: install-static install-shared install-pkgconfig
|