diff --git a/base/math.jl b/base/math.jl index 194c620f0af31..0e28d194932d4 100644 --- a/base/math.jl +++ b/base/math.jl @@ -177,7 +177,6 @@ log(b::Number, x::Number) = log(promote(b,x)...) # type specific math functions const libm = Base.libm_name -const openspecfun = "libopenspecfun" # functions with no domain error """ @@ -701,7 +700,7 @@ function ieee754_rem_pio2(x::Float64) # https://github.com/JuliaLang/openspecfun/blob/master/rem_pio2/e_rem_pio2.c y = [0.0,0.0] - n = ccall((:__ieee754_rem_pio2, openspecfun), Cint, (Float64,Ptr{Float64}), x, y) + n = ccall(:__ieee754_rem_pio2, Cint, (Float64,Ptr{Float64}), x, y) return (n,y) end diff --git a/src/Makefile b/src/Makefile index a6bc4b4f5a5f7..b2a61f2a9369a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -94,8 +94,8 @@ FLAGS += -DLLVM_SHLIB endif # USE_LLVM_SHLIB == 1 COMMON_LIBS := -L$(build_shlibdir) -L$(build_libdir) $(LIBUV) $(LIBUTF8PROC) $(NO_WHOLE_ARCHIVE) $(LLVMLINK) $(OSLIBS) -DEBUG_LIBS := $(WHOLE_ARCHIVE) $(BUILDDIR)/flisp/libflisp-debug.a $(WHOLE_ARCHIVE) $(BUILDDIR)/support/libsupport-debug.a $(COMMON_LIBS) -RELEASE_LIBS := $(WHOLE_ARCHIVE) $(BUILDDIR)/flisp/libflisp.a $(WHOLE_ARCHIVE) $(BUILDDIR)/support/libsupport.a $(COMMON_LIBS) +DEBUG_LIBS := $(WHOLE_ARCHIVE) $(BUILDDIR)/flisp/libflisp-debug.a $(WHOLE_ARCHIVE) $(BUILDDIR)/support/libsupport-debug.a $(WHOLE_ARCHIVE) $(BUILDDIR)/specfun/libspecfun-debug.a $(COMMON_LIBS) +RELEASE_LIBS := $(WHOLE_ARCHIVE) $(BUILDDIR)/flisp/libflisp.a $(WHOLE_ARCHIVE) $(BUILDDIR)/support/libsupport.a $(WHOLE_ARCHIVE) $(BUILDDIR)/specfun/libspecfun.a $(COMMON_LIBS) OBJS := $(SRCS:%=$(BUILDDIR)/%.o) DOBJS := $(SRCS:%=$(BUILDDIR)/%.dbg.obj) @@ -203,12 +203,18 @@ $(BUILDDIR)/support/libsupport.a: $(SRCDIR)/support/*.h $(SRCDIR)/support/*.c $(BUILDDIR)/support/libsupport-debug.a: $(SRCDIR)/support/*.h $(SRCDIR)/support/*.c $(MAKE) -C $(SRCDIR)/support debug BUILDDIR='$(abspath $(BUILDDIR)/support)' +$(BUILDDIR)/specfun/libspecfun.a: $(SRCDIR)/specfun/*.h $(SRCDIR)/specfun/*.c $(BUILDDIR)/support/libsupport.a + $(MAKE) -C $(SRCDIR)/specfun BUILDDIR='$(abspath $(BUILDDIR)/specfun)' + +$(BUILDDIR)/specfun/libspecfun-debug.a: $(SRCDIR)/specfun/*.h $(SRCDIR)/specfun/*.c $(BUILDDIR)/support/libsupport-debug.a + $(MAKE) -C $(SRCDIR)/specfun debug BUILDDIR='$(abspath $(BUILDDIR)/specfun)' + $(FLISP_EXECUTABLE_release): $(BUILDDIR)/flisp/libflisp.a -$(BUILDDIR)/flisp/libflisp.a: $(addprefix $(SRCDIR)/,flisp/*.h flisp/*.c) $(BUILDDIR)/support/libsupport.a +$(BUILDDIR)/flisp/libflisp.a: $(addprefix $(SRCDIR)/,flisp/*.h flisp/*.c) $(BUILDDIR)/specfun/libspecfun.a $(MAKE) -C $(SRCDIR)/flisp BUILDDIR='$(abspath $(BUILDDIR)/flisp)' $(FLISP_EXECUTABLE_debug): $(BUILDDIR)/flisp/libflisp-debug.a -$(BUILDDIR)/flisp/libflisp-debug.a: $(addprefix $(SRCDIR)/,flisp/*.h flisp/*.c) $(BUILDDIR)/support/libsupport-debug.a +$(BUILDDIR)/flisp/libflisp-debug.a: $(addprefix $(SRCDIR)/,flisp/*.h flisp/*.c) $(BUILDDIR)/specfun/libspecfun-debug.a $(MAKE) -C $(SRCDIR)/flisp debug BUILDDIR='$(abspath $(BUILDDIR)/flisp)' $(BUILDDIR)/julia_version.h: $(JULIAHOME)/VERSION @@ -255,7 +261,7 @@ else SONAME_DEBUG := endif -$(build_shlibdir)/libjulia-debug.$(JL_MAJOR_MINOR_SHLIB_EXT): $(SRCDIR)/julia.expmap $(DOBJS) $(BUILDDIR)/flisp/libflisp-debug.a $(BUILDDIR)/support/libsupport-debug.a $(LIBUV) +$(build_shlibdir)/libjulia-debug.$(JL_MAJOR_MINOR_SHLIB_EXT): $(SRCDIR)/julia.expmap $(DOBJS) $(BUILDDIR)/flisp/libflisp-debug.a $(BUILDDIR)/support/libsupport-debug.a $(BUILDDIR)/specfun/libspecfun-debug.a $(LIBUV) @$(call PRINT_LINK, $(CXXLD) $(CXXFLAGS) $(CXXLDFLAGS) $(DEBUGFLAGS) $(DOBJS) $(RPATH_LIB) -o $@ $(LDFLAGS) $(JLIBLDFLAGS) $(DEBUG_LIBS) $(SONAME_DEBUG)) $(INSTALL_NAME_CMD)libjulia-debug.$(SHLIB_EXT) $@ ifneq ($(OS), WINNT) @@ -264,13 +270,13 @@ ifneq ($(OS), WINNT) endif $(DSYMUTIL) $@ -$(BUILDDIR)/libjulia-debug.a: $(SRCDIR)/julia.expmap $(DOBJS) $(BUILDDIR)/flisp/libflisp-debug.a $(BUILDDIR)/support/libsupport-debug.a +$(BUILDDIR)/libjulia-debug.a: $(SRCDIR)/julia.expmap $(DOBJS) $(BUILDDIR)/flisp/libflisp-debug.a $(BUILDDIR)/support/libsupport-debug.a $(BUILDDIR)/specfun/libspecfun-debug.a rm -f $@ @$(call PRINT_LINK, ar -rcs $@ $(DOBJS)) libjulia-debug: $(build_shlibdir)/libjulia-debug.$(JL_MAJOR_MINOR_SHLIB_EXT) $(PUBLIC_HEADER_TARGETS) -$(build_shlibdir)/libjulia.$(JL_MAJOR_MINOR_SHLIB_EXT): $(SRCDIR)/julia.expmap $(OBJS) $(BUILDDIR)/flisp/libflisp.a $(BUILDDIR)/support/libsupport.a $(LIBUV) +$(build_shlibdir)/libjulia.$(JL_MAJOR_MINOR_SHLIB_EXT): $(SRCDIR)/julia.expmap $(OBJS) $(BUILDDIR)/flisp/libflisp.a $(BUILDDIR)/support/libsupport.a $(BUILDDIR)/specfun/libspecfun.a $(LIBUV) @$(call PRINT_LINK, $(CXXLD) $(CXXFLAGS) $(CXXLDFLAGS) $(SHIPFLAGS) $(OBJS) $(RPATH_LIB) -o $@ $(LDFLAGS) $(JLIBLDFLAGS) $(RELEASE_LIBS) $(SONAME)) $(INSTALL_NAME_CMD)libjulia.$(SHLIB_EXT) $@ ifneq ($(OS), WINNT) @@ -279,7 +285,7 @@ ifneq ($(OS), WINNT) endif $(DSYMUTIL) $@ -$(BUILDDIR)/libjulia.a: julia.expmap $(OBJS) $(BUILDDIR)/flisp/libflisp.a $(BUILDDIR)/support/libsupport.a +$(BUILDDIR)/libjulia.a: julia.expmap $(OBJS) $(BUILDDIR)/flisp/libflisp.a $(BUILDDIR)/support/libsupport.a $(BUILDDIR)/specfun/libspecfun.a rm -f $@ @$(call PRINT_LINK, ar -rcs $@ $(OBJS)) libjulia-release: $(build_shlibdir)/libjulia.$(JL_MAJOR_MINOR_SHLIB_EXT) $(PUBLIC_HEADER_TARGETS) @@ -296,7 +302,10 @@ clean-flisp: clean-support: -$(MAKE) -C $(SRCDIR)/support clean BUILDDIR='$(abspath $(BUILDDIR)/support)' +clean-specfun: + -$(MAKE) -C $(SRCDIR)/specfun clean BUILDDIR='$(abspath $(BUILDDIR)/specfun)' + -cleanall: clean clean-flisp clean-support +cleanall: clean clean-flisp clean-support clean-specfun .PHONY: default all debug release clean cleanall clean-* libccalltest julia_flisp.boot.inc.phony diff --git a/src/specfun/Makefile b/src/specfun/Makefile new file mode 100644 index 0000000000000..56e69ddeae508 --- /dev/null +++ b/src/specfun/Makefile @@ -0,0 +1,50 @@ +JULIAHOME := $(abspath ../..) +BUILDDIR := . +include $(JULIAHOME)/Make.inc + +override CFLAGS_add = +override CPPFLAGS_add = + +ifeq ($(USECLANG),1) + override CFLAGS_add += -fno-builtin +endif + +ifeq ($(USEGCC),1) + override CFLAGS_add += -fno-gnu89-inline -std=c99 +endif + +ifeq ($(USE_SYSTEM_LIBM),0) + override CPPFLAGS_add += -DUSE_OPENLIBM -I$(build_includedir) -I$(build_includedir)/openlibm +endif + +override CFLAGS += $(JCFLAGS) -O3 -std=c99 +ifeq ($(USEICC),1) + override CFLAGS += -fp-model precise +endif + +ifeq ($(OS),WINNT) + override CFLAGS_add += -nodefaultlibs +else + override CFLAGS_add += -fPIC +endif + +SRCS := e_rem_pio2.c e_rem_pio2f.c k_rem_pio2.c +OBJS := $(addprefix $(BUILDDIR)/,$(patsubst %.c,%.o,$(SRCS))) + +default: $(JULIA_BUILD_MODE) + +all: release debug +release: $(BUILDDIR)/libspecfun.a +debug: $(BUILDDIR)/libspecfun-debug.a + +$(BUILDDIR)/%.o: $(BUILDDIR)/%.c + $(CC) $(CPPFLAGS) $(CPPFLAGS_add) $(CFLAGS_add) $(CFLAGS) -c $< -o $@ + +$(BUILDDIR)/libspecfun.a: $(OBJS) + $(AR) -rcs libspecfun.a $(OBJS) + +$(BUILDDIR)/libspecfun-debug.a: $(OBJS) + $(AR) -rcs libspecfun-debug.a $(OBJS) + +clean: + cd $(BUILDDIR) && rm $(OBJS) *.a diff --git a/src/specfun/libspecfun.a b/src/specfun/libspecfun.a new file mode 100644 index 0000000000000..39a9ca8929ec7 Binary files /dev/null and b/src/specfun/libspecfun.a differ