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
|
|
|
|
ifneq ($(ARCH), arm)
|
|
|
|
SUBDIRS += ld80
|
|
|
|
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
|
|
|
|
2015-11-12 20:56:08 +01:00
|
|
|
.PHONY: all check test clean distclean install
|
|
|
|
|
2012-05-25 22:24:37 +02:00
|
|
|
all: libopenlibm.a libopenlibm.$(SHLIB_EXT)
|
2015-11-12 20:56:08 +01:00
|
|
|
|
|
|
|
check test: test/test-double test/test-float
|
|
|
|
test/test-double
|
|
|
|
test/test-float
|
|
|
|
|
2012-05-25 22:24:37 +02: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
|
|
|
|
2012-05-25 22:24:37 +02:00
|
|
|
libopenlibm.$(SHLIB_EXT): $(OBJS)
|
2014-04-08 17:49:38 +02:00
|
|
|
ifeq ($(OS),WINNT)
|
2015-02-27 19:48:11 +01:00
|
|
|
$(CC) -shared $(OBJS) $(LDFLAGS) $(LDFLAGS_add) -Wl,$(SONAME_FLAG),libopenlibm.$(SHLIB_EXT) -o libopenlibm.$(SHLIB_EXT)
|
2014-04-08 17:49:38 +02:00
|
|
|
else
|
2015-02-27 19:48:11 +01:00
|
|
|
$(CC) -shared $(OBJS) $(LDFLAGS) $(LDFLAGS_add) -Wl,$(SONAME_FLAG),libopenlibm.$(SHLIB_EXT).$(SOMAJOR) -o libopenlibm.$(SHLIB_EXT).$(SOMAJOR).$(SOMINOR)
|
2014-07-27 09:30:14 +02:00
|
|
|
@-ln -sf libopenlibm.$(SHLIB_EXT).$(SOMAJOR).$(SOMINOR) libopenlibm.$(SHLIB_EXT).$(SOMAJOR)
|
|
|
|
@-ln -sf libopenlibm.$(SHLIB_EXT).$(SOMAJOR).$(SOMINOR) libopenlibm.$(SHLIB_EXT)
|
2014-04-08 17:49:38 +02:00
|
|
|
endif
|
2011-12-31 08:18:43 +01:00
|
|
|
|
2015-11-12 20:56:08 +01:00
|
|
|
test/test-double: libopenlibm.$(SHLIB_EXT)
|
|
|
|
$(MAKE) -C test test-double
|
|
|
|
|
|
|
|
test/test-float: libopenlibm.$(SHLIB_EXT)
|
|
|
|
$(MAKE) -C test test-float
|
|
|
|
|
2013-12-23 18:30:42 +01:00
|
|
|
clean:
|
2014-01-04 21:37:17 +01:00
|
|
|
@for dir in $(SUBDIRS) .; do \
|
|
|
|
rm -fr $$dir/*.o $$dir/*.a $$dir/*.$(SHLIB_EXT)*; \
|
|
|
|
done
|
2014-12-18 17:08:20 +01:00
|
|
|
@rm -f test/test-double test/test-float
|
2013-12-23 18:30:42 +01:00
|
|
|
|
2012-10-27 06:47:38 +02:00
|
|
|
distclean:
|
2014-03-06 06:20:28 +01:00
|
|
|
-rm -f $(OBJS) *.a *.$(SHLIB_EXT) libopenlibm.*
|
|
|
|
-$(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
|
|
|
|
|
|
|
|
install: all openlibm.pc
|
2014-04-08 17:49:38 +02:00
|
|
|
mkdir -p $(DESTDIR)$(shlibdir)
|
2014-05-19 15:38:28 +02:00
|
|
|
mkdir -p $(DESTDIR)$(libdir)/pkgconfig
|
2014-02-09 03:37:33 +01:00
|
|
|
mkdir -p $(DESTDIR)$(includedir)/openlibm
|
2015-01-07 06:26:48 +01:00
|
|
|
cp -f -a libopenlibm.$(SHLIB_EXT)* $(DESTDIR)$(shlibdir)/
|
|
|
|
cp -f -a libopenlibm.a $(DESTDIR)$(libdir)/
|
2015-01-11 16:35:32 +01:00
|
|
|
cp -f -a include/openlibm*.h $(DESTDIR)$(includedir)/
|
2015-01-07 06:26:48 +01:00
|
|
|
cp -f -a openlibm.pc $(DESTDIR)$(libdir)/pkgconfig/
|