#
# $Id: libm.gmk,v 1.3 2007-01-06 10:09:48 obarthel Exp $
#
# :ts=8
#
# -*- mode: makefile; -*-

##############################################################################

LIBS += \
	lib/libm.a \
	lib/soft-float/libm.a \
	lib/small-data/libm.a \
	lib/baserel/libm.a \
	lib.threadsafe/libm.a \
	lib.threadsafe/soft-float/libm.a \
	lib.threadsafe/small-data/libm.a \
	lib.threadsafe/baserel/libm.a

##############################################################################

MATH_LIB := \
	complex_carg.o \
	complex_cargf.o \
	complex_cargl.o \
	complex_cimag.o \
	complex_cimagf.o \
	complex_cimagl.o \
	complex_conj.o \
	complex_conjf.o \
	complex_conjl.o \
	complex_creal.o \
	complex_crealf.o \
	complex_creall.o \
	fenv_feclearexcept.o \
	fenv_fegetenv.o \
	fenv_fegetexceptflag.o \
	fenv_fegetround.o \
	fenv_feholdexcept.o \
	fenv_feraiseexcept.o \
	fenv_fesetenv.o \
	fenv_fesetexceptflag.o \
	fenv_fetestexcept.o \
	fenv_fetestround.o \
	fenv_feupdateenv.o \
	math_acos.o \
	math_acosf.o \
	math_acosh.o \
	math_acoshf.o \
	math_asin.o \
	math_asinf.o \
	math_asinh.o \
	math_asinhf.o \
	math_atan.o \
	math_atan2.o \
	math_atan2f.o \
	math_atanf.o \
	math_atanh.o \
	math_atanhf.o \
	math_cbrt.o \
	math_cbrtf.o \
	math_ceil.o \
	math_ceilf.o \
	math_copysign.o \
	math_copysignf.o \
	math_cos.o \
	math_cosf.o \
	math_cosh.o \
	math_coshf.o \
	math_erf.o \
	math_erfc.o \
	math_erfcf.o \
	math_erff.o \
	math_exp.o \
	math_exp2.o \
	math_exp2f.o \
	math_expf.o \
	math_expm1.o \
	math_expm1f.o \
	math_fabs.o \
	math_fabsf.o \
	math_fdim.o \
	math_fdimf.o \
	math_floor.o \
	math_floorf.o \
	math_fma.o \
	math_fmaf.o \
	math_fmax.o \
	math_fmaxf.o \
	math_fmin.o \
	math_fminf.o \
	math_fmod.o \
	math_fmodf.o \
	math_fpclassify.o \
	math_frexp.o \
	math_frexpf.o \
	math_huge_val.o \
	math_huge_valf.o \
	math_hypot.o \
	math_hypotf.o \
	math_ilogb.o \
	math_ilogbf.o \
	math_inf.o \
	math_inff.o \
	math_init_exit.o \
	math_isfinite.o \
	math_isunordered.o \
	math_kernel_cos.o \
	math_kernel_cosf.o \
	math_kernel_expm1.o \
	math_kernel_rem_pio2.o \
	math_kernel_sin.o \
	math_kernel_sinf.o \
	math_kernel_tan.o \
	math_kernel_tanf.o \
	math_ldexp.o \
	math_ldexpf.o \
	math_lgamma.o \
	math_lgammaf.o \
	math_llrint.o \
	math_log.o \
	math_log10.o \
	math_log10f.o \
	math_log1p.o \
	math_log1pf.o \
	math_log2.o \
	math_log2f.o \
	math_logb.o \
	math_logbf.o \
	math_logf.o \
	math_lrint.o \
	math_lrintf.o \
	math_lround.o \
	math_lroundf.o \
	math_modf.o \
	math_modff.o \
	math_nan.o \
	math_nanf.o \
	math_nearbyint.o \
	math_nearbyintf.o \
	math_nextafter.o \
	math_nextafterf.o \
	math_pow.o \
	math_powf.o \
	math_remainder.o \
	math_remainderf.o \
	math_remquo.o \
	math_remquof.o \
	math_rem_pio2f.o \
	math_rint.o \
	math_rintf.o \
	math_round.o \
	math_roundf.o \
	math_scalbn.o \
	math_scalbnf.o \
	math_signbit.o \
	math_sin.o \
	math_sinf.o \
	math_sinh.o \
	math_sinhf.o \
	math_sqrt.o \
	math_sqrtf.o \
	math_tan.o \
	math_tanf.o \
	math_tanh.o \
	math_tanhf.o \
	math_tgamma.o \
	math_tgammaf.o \
	math_trunc.o \
	math_truncf.o \
	stdio_asprintf.o \
	stdio_flush.o \
	stdio_flush_all_files.o \
	stdio_fprintf.o \
	stdio_fscanf.o \
	stdio_printf.o \
	stdio_scanf.o \
	stdio_snprintf.o \
	stdio_sprintf.o \
	stdio_sscanf.o \
	stdio_vasprintf.o \
	stdio_vfprintf.o \
	stdio_vfscanf.o \
	stdio_vsscanf.o \
	stdio_vscanf.o \
	stdio_vprintf.o \
	stdio_vsnprintf.o \
	stdio_vsprintf.o \
	stdlib_atof.o \
	stdlib_strtod.o \
	stdlib_strtof.o \
	time_difftime.o

##############################################################################

# Dependencies to rebuild if the library version changes

obj/libm/m.lib_rev.o : m.lib_rev.c m.lib_rev.h
obj/soft-float/libm/m.lib_rev.o : m.lib_rev.c m.lib_rev.h
obj/small-data/libm/m.lib_rev.o : m.lib_rev.c m.lib_rev.h
obj/baserel/libm/m.lib_rev.o : m.lib_rev.c m.lib_rev.h
obj.threadsafe/libm/m.lib_rev.o : m.lib_rev.c m.lib_rev.h
obj.threadsafe/soft-float/libm/m.lib_rev.o : m.lib_rev.c m.lib_rev.h
obj.threadsafe/small-data/libm/m.lib_rev.o : m.lib_rev.c m.lib_rev.h
obj.threadsafe/baserel/libm/m.lib_rev.o : m.lib_rev.c m.lib_rev.h

##############################################################################

obj/libm/%.o : CFLAGS += $(LARGEDATA) -DPPC_FLOATING_POINT_SUPPORT
obj/libm/%.o : %.c
	@$(COMPILE)

obj/soft-float/libm/%.o : CFLAGS += $(SOFTFLOAT)
obj/soft-float/libm/%.o : %.c
	@$(COMPILE)

obj/small-data/libm/%.o : CFLAGS += $(SMALLDATA) -DPPC_FLOATING_POINT_SUPPORT
obj/small-data/libm/%.o : %.c
	@$(COMPILE)

obj/baserel/libm/%.o : CFLAGS += $(BASEREL) -DPPC_FLOATING_POINT_SUPPORT
obj/baserel/libm/%.o : %.c
	@$(COMPILE)

obj.threadsafe/libm/%.o : CFLAGS += $(THREADSAFE) $(LARGEDATA) -DPPC_FLOATING_POINT_SUPPORT
obj.threadsafe/libm/%.o : %.c
	@$(COMPILE)

obj.threadsafe/soft-float/libm/%.o : CFLAGS += $(THREADSAFE) $(SOFTFLOAT)
obj.threadsafe/soft-float/libm/%.o : %.c
	@$(COMPILE)

obj.threadsafe/small-data/libm/%.o : CFLAGS += $(THREADSAFE) $(SMALLDATA) -DPPC_FLOATING_POINT_SUPPORT
obj.threadsafe/small-data/libm/%.o : %.c
	@$(COMPILE)

obj.threadsafe/baserel/libm/%.o : CFLAGS += $(THREADSAFE) $(BASEREL) -DPPC_FLOATING_POINT_SUPPORT
obj.threadsafe/baserel/libm/%.o : %.c
	@$(COMPILE)

##############################################################################

lib/libm.a : $(addprefix obj/libm/,$(MATH_LIB))
	@$(MAKELIB)

lib/soft-float/libm.a : $(addprefix obj/soft-float/libm/,$(MATH_LIB))
	@$(MAKELIB)

lib/small-data/libm.a : $(addprefix obj/small-data/libm/,$(MATH_LIB))
	@$(MAKELIB)

lib/baserel/libm.a : $(addprefix obj/baserel/libm/,$(MATH_LIB))
	@$(MAKELIB)

lib.threadsafe/libm.a : $(addprefix obj.threadsafe/libm/,$(MATH_LIB))
	@$(MAKELIB)

lib.threadsafe/soft-float/libm.a : $(addprefix obj.threadsafe/soft-float/libm/,$(MATH_LIB))
	@$(MAKELIB)

lib.threadsafe/small-data/libm.a : $(addprefix obj.threadsafe/small-data/libm/,$(MATH_LIB))
	@$(MAKELIB)

lib.threadsafe/baserel/libm.a : $(addprefix obj.threadsafe/baserel/libm/,$(MATH_LIB))
	@$(MAKELIB)
