2012-05-25 22:24:37 +02:00
|
|
|
OPENLIBM_HOME=$(abspath .)
|
2011-12-31 08:18:43 +01:00
|
|
|
include ./Make.inc
|
|
|
|
|
2012-12-31 22:37:05 +01:00
|
|
|
SUBDIRS = src ld80 $(ARCH) bsdsrc
|
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
|
|
|
|
2012-05-25 22:24:37 +02:00
|
|
|
all: libopenlibm.a libopenlibm.$(SHLIB_EXT)
|
2012-07-03 13:19:19 +02:00
|
|
|
$(MAKE) -C test
|
2012-05-25 22:24:37 +02:00
|
|
|
libopenlibm.a: $(OBJS)
|
2012-12-29 08:58:07 +01:00
|
|
|
$(AR) -rcs libopenlibm.a $(OBJS)
|
2012-05-25 22:24:37 +02:00
|
|
|
libopenlibm.$(SHLIB_EXT): $(OBJS)
|
2014-01-07 21:38:10 +01:00
|
|
|
$(FC) -shared $(OBJS) $(LDFLAGS) -Wl,$(SONAME_FLAG),libopenlibm.$(SHLIB_EXT).$(VERSION) -o libopenlibm.$(SHLIB_EXT).$(VERSION)
|
2014-01-04 21:37:17 +01:00
|
|
|
ln -s libopenlibm.$(SHLIB_EXT).$(VERSION) libopenlibm.$(SHLIB_EXT).$(word 1,$(VERSION_SPLIT)).$(word 2,$(VERSION_SPLIT))
|
|
|
|
ln -s libopenlibm.$(SHLIB_EXT).$(VERSION) libopenlibm.$(SHLIB_EXT).$(word 1,$(VERSION_SPLIT))
|
|
|
|
ln -s libopenlibm.$(SHLIB_EXT).$(VERSION) libopenlibm.$(SHLIB_EXT)
|
|
|
|
|
2011-12-31 08:18:43 +01:00
|
|
|
|
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
|
2013-12-23 18:30:42 +01:00
|
|
|
|
2012-10-27 06:47:38 +02:00
|
|
|
distclean:
|
2012-05-25 22:24:37 +02:00
|
|
|
rm -f $(OBJS) *.a *.$(SHLIB_EXT)
|
2012-07-03 13:19:19 +02:00
|
|
|
$(MAKE) -C test clean
|
2014-01-04 21:37:17 +01:00
|
|
|
|
|
|
|
install: all
|
|
|
|
mkdir -p $(DESTDIR)$(libdir)
|
2014-01-07 21:54:15 +01:00
|
|
|
mkdir -p $(DESTDIR)$(prefix)/include
|
2014-01-04 21:37:17 +01:00
|
|
|
cp -a libopenlibm.$(SHLIB_EXT)* libopenlibm.a $(DESTDIR)$(libdir)/
|
2014-01-07 21:54:15 +01:00
|
|
|
cp -a src/openlibm.h $(DESTDIR)$(prefix)/include/
|