mirror of
https://git.planet-casio.com/Lephenixnoir/OpenLibm.git
synced 2024-12-28 04:23:41 +01:00
Test shared library
Add make check target that builds and runs the tests.
This commit is contained in:
parent
a8c2f3a1bb
commit
bab41fc510
3 changed files with 21 additions and 6 deletions
|
@ -21,5 +21,4 @@ arm32)
|
|||
;;
|
||||
esac
|
||||
|
||||
$LOADER ./test/test-double
|
||||
$LOADER ./test/test-float
|
||||
$LOADER make check
|
||||
|
|
15
Makefile
15
Makefile
|
@ -24,10 +24,17 @@ OBJS = $(patsubst %.f,%.f.o,\
|
|||
$(patsubst %.S,%.S.o,\
|
||||
$(patsubst %.c,%.c.o,$(filter-out $(addprefix src/,$(DUPLICATE_SRCS)),$(SRCS)))))
|
||||
|
||||
.PHONY: all check test clean distclean install
|
||||
|
||||
all: libopenlibm.a libopenlibm.$(SHLIB_EXT)
|
||||
$(MAKE) -C test
|
||||
|
||||
check test: test/test-double test/test-float
|
||||
test/test-double
|
||||
test/test-float
|
||||
|
||||
libopenlibm.a: $(OBJS)
|
||||
$(AR) -rcs libopenlibm.a $(OBJS)
|
||||
|
||||
libopenlibm.$(SHLIB_EXT): $(OBJS)
|
||||
ifeq ($(OS),WINNT)
|
||||
$(CC) -shared $(OBJS) $(LDFLAGS) $(LDFLAGS_add) -Wl,$(SONAME_FLAG),libopenlibm.$(SHLIB_EXT) -o libopenlibm.$(SHLIB_EXT)
|
||||
|
@ -37,6 +44,12 @@ else
|
|||
@-ln -sf libopenlibm.$(SHLIB_EXT).$(SOMAJOR).$(SOMINOR) libopenlibm.$(SHLIB_EXT)
|
||||
endif
|
||||
|
||||
test/test-double: libopenlibm.$(SHLIB_EXT)
|
||||
$(MAKE) -C test test-double
|
||||
|
||||
test/test-float: libopenlibm.$(SHLIB_EXT)
|
||||
$(MAKE) -C test test-float
|
||||
|
||||
clean:
|
||||
@for dir in $(SUBDIRS) .; do \
|
||||
rm -fr $$dir/*.o $$dir/*.a $$dir/*.$(SHLIB_EXT)*; \
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
OPENLIBM_HOME=$(abspath ..)
|
||||
include ../Make.inc
|
||||
|
||||
# Set rpath of tests to builddir for loading shared library
|
||||
OPENLIBM_LIB = -L.. -lopenlibm -Wl,-rpath=$(OPENLIBM_HOME)
|
||||
|
||||
all: test-double test-float # test-double-system test-float-system
|
||||
|
||||
bench: bench-syslibm bench-openlibm
|
||||
|
||||
test-double: test-double.c libm-test.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) -g $@.c -D__BSD_VISIBLE -I ../include -I../src ../libopenlibm.a -o $@
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) -g $@.c -D__BSD_VISIBLE -I ../include -I../src $(OPENLIBM_LIB) -o $@
|
||||
|
||||
test-float: test-float.c libm-test.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) -g $@.c -D__BSD_VISIBLE -I ../include -I../src ../libopenlibm.a -o $@
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) -g $@.c -D__BSD_VISIBLE -I ../include -I../src $(OPENLIBM_LIB) -o $@
|
||||
|
||||
test-double-system: test-double.c libm-test.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) -g $< -DSYS_MATH_H -lm -o $@
|
||||
|
@ -18,7 +21,7 @@ test-float-system: test-float.c libm-test.c
|
|||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) -g $< -DSYS_MATH_H -lm -o $@
|
||||
|
||||
bench-openlibm: libm-bench.cpp
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) -O2 $< ../libopenlibm.a -o $@
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) -O2 $< $(OPENLIBM_LIB) -o $@
|
||||
|
||||
bench-syslibm: libm-bench.cpp
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) -O2 $< -lm -o $@
|
||||
|
|
Loading…
Reference in a new issue