2012-05-25 22:24:37 +02:00
|
|
|
OPENLIBM_HOME=$(abspath .)
|
2011-12-31 08:18:43 +01:00
|
|
|
include ./Make.inc
|
|
|
|
|
2014-05-26 11:23:33 +02:00
|
|
|
SUBDIRS = src $(ARCH) bsdsrc
|
2020-09-04 00:27:17 +02:00
|
|
|
ifeq ($(LONG_DOUBLE_NOT_DOUBLE),1)
|
2017-01-15 22:21:46 +01:00
|
|
|
# Add ld80 directory on x86 and x64
|
|
|
|
ifneq ($(filter $(ARCH),i387 amd64),)
|
2014-05-26 11:23:33 +02:00
|
|
|
SUBDIRS += ld80
|
2017-10-21 15:50:50 +02:00
|
|
|
else
|
|
|
|
ifneq ($(filter $(ARCH),aarch64),)
|
|
|
|
SUBDIRS += ld128
|
|
|
|
else
|
|
|
|
endif
|
2014-05-26 11:23:33 +02:00
|
|
|
endif
|
2020-09-04 00:27:17 +02:00
|
|
|
endif
|
2012-05-25 22:24:37 +02:00
|
|
|
|
|
|
|
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))
|
|
|
|
|
2012-10-29 10:30:54 +01:00
|
|
|
OBJS = $(patsubst %.f,%.f.o,\
|
|
|
|
$(patsubst %.S,%.S.o,\
|
|
|
|
$(patsubst %.c,%.c.o,$(filter-out $(addprefix src/,$(DUPLICATE_SRCS)),$(SRCS)))))
|
2012-07-03 13:19:19 +02:00
|
|
|
|
2016-08-27 21:00:09 +02:00
|
|
|
# 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.
|
2016-05-17 08:42:16 +02:00
|
|
|
ifeq ($(OS), WINNT)
|
|
|
|
OLM_MAJOR_MINOR_SHLIB_EXT := $(SHLIB_EXT)
|
2016-08-27 21:00:09 +02:00
|
|
|
LDFLAGS_add += -Wl,--out-implib,libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT).a
|
2016-05-17 08:42:16 +02:00
|
|
|
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
|
|
|
|
|
2016-07-19 02:09:07 +02:00
|
|
|
.PHONY: all check test clean distclean \
|
|
|
|
install install-static install-shared install-pkgconfig install-headers
|
2015-11-12 20:56:08 +01:00
|
|
|
|
2019-04-15 00:11:03 +02:00
|
|
|
|
|
|
|
OLM_LIBS := libopenlibm.a
|
2020-10-24 12:44:48 +02:00
|
|
|
ifeq ($(filter wasm32 sh3eb,$(ARCH)),)
|
2019-04-15 00:11:03 +02:00
|
|
|
OLM_LIBS += libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
|
|
|
|
endif
|
|
|
|
|
|
|
|
all : $(OLM_LIBS)
|
2015-11-12 20:56:08 +01:00
|
|
|
|
|
|
|
check test: test/test-double test/test-float
|
|
|
|
test/test-double
|
|
|
|
test/test-float
|
|
|
|
|
2016-02-24 05:40:35 +01:00
|
|
|
libopenlibm.a: $(OBJS)
|
2012-12-29 08:58:07 +01:00
|
|
|
$(AR) -rcs libopenlibm.a $(OBJS)
|
2015-11-12 20:56:08 +01:00
|
|
|
|
2016-05-17 08:42:16 +02:00
|
|
|
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)
|
2014-04-08 17:49:38 +02:00
|
|
|
endif
|
2011-12-31 08:18:43 +01:00
|
|
|
|
2016-05-17 08:42:16 +02:00
|
|
|
test/test-double: libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
|
2015-11-12 20:56:08 +01:00
|
|
|
$(MAKE) -C test test-double
|
|
|
|
|
2016-05-17 08:42:16 +02:00
|
|
|
test/test-float: libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
|
2015-11-12 20:56:08 +01:00
|
|
|
$(MAKE) -C test test-float
|
|
|
|
|
2013-12-23 18:30:42 +01:00
|
|
|
clean:
|
2021-05-21 14:07:39 +02:00
|
|
|
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
|
2016-05-17 08:42:16 +02:00
|
|
|
rm -f libopenlibm.a libopenlibm.*$(SHLIB_EXT)*
|
2015-11-13 19:43:44 +01:00
|
|
|
$(MAKE) -C test clean
|
2014-01-04 21:37:17 +01:00
|
|
|
|
2014-05-19 15:38:28 +02:00
|
|
|
openlibm.pc: openlibm.pc.in Make.inc Makefile
|
|
|
|
echo "prefix=${prefix}" > openlibm.pc
|
|
|
|
echo "version=${VERSION}" >> openlibm.pc
|
|
|
|
cat openlibm.pc.in >> openlibm.pc
|
|
|
|
|
2016-07-19 02:09:07 +02:00
|
|
|
install-static: libopenlibm.a
|
|
|
|
mkdir -p $(DESTDIR)$(libdir)
|
2018-04-06 23:06:14 +02:00
|
|
|
cp -RpP -f libopenlibm.a $(DESTDIR)$(libdir)/
|
2016-07-19 02:09:07 +02:00
|
|
|
|
|
|
|
install-shared: libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
|
2014-04-08 17:49:38 +02:00
|
|
|
mkdir -p $(DESTDIR)$(shlibdir)
|
2018-04-06 23:06:14 +02:00
|
|
|
cp -RpP -f libopenlibm.*$(SHLIB_EXT)* $(DESTDIR)$(shlibdir)/
|
2016-07-19 02:09:07 +02:00
|
|
|
|
|
|
|
install-pkgconfig: openlibm.pc
|
2016-01-19 13:45:54 +01:00
|
|
|
mkdir -p $(DESTDIR)$(pkgconfigdir)
|
2018-04-06 23:06:14 +02:00
|
|
|
cp -RpP -f openlibm.pc $(DESTDIR)$(pkgconfigdir)/
|
2016-07-19 02:09:07 +02:00
|
|
|
|
|
|
|
install-headers:
|
2014-02-09 03:37:33 +01:00
|
|
|
mkdir -p $(DESTDIR)$(includedir)/openlibm
|
2018-04-06 23:06:14 +02:00
|
|
|
cp -RpP -f include/*.h $(DESTDIR)$(includedir)/openlibm
|
|
|
|
cp -RpP -f src/*.h $(DESTDIR)$(includedir)/openlibm
|
2016-07-19 02:09:07 +02:00
|
|
|
|
|
|
|
install: install-static install-shared install-pkgconfig install-headers
|