Makefile.in 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
  4. #
  5. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. #
  7. # The routines included in this math library are derived from the
  8. # math library for Apple's MacOS X/Darwin math library, which was
  9. # itself swiped from FreeBSD. The original copyright information
  10. # is as follows:
  11. #
  12. # Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  13. #
  14. # Developed at SunPro, a Sun Microsystems, Inc. business.
  15. # Permission to use, copy, modify, and distribute this
  16. # software is freely granted, provided that this notice
  17. # is preserved.
  18. #
  19. # It has been ported to work with uClibc and generally behave
  20. # by Erik Andersen <andersen@codepoet.org>
  21. #
  22. subdirs += libm libm/$(TARGET_ARCH)
  23. CFLAGS-libm := -DNOT_IN_libc -DIS_IN_libm $(SSP_ALL_CFLAGS)
  24. LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libm.so := -Wl,--dsbt-index=5
  25. LDFLAGS-libm.so := $(LDFLAGS)
  26. LIBS-libm.so := $(LIBS)
  27. libm_FULL_NAME := libm-$(VERSION).so
  28. libm_DIR:=$(top_srcdir)libm
  29. libm_OUT:=$(top_builddir)libm
  30. libm_ARCH_DIR:=$(libm_DIR)/$(TARGET_ARCH)
  31. libm_ARCH_OUT:=$(libm_OUT)/$(TARGET_ARCH)
  32. ifneq ($(TARGET_SUBARCH),)
  33. libm_SUBARCH_DIR:=$(libm_DIR)/$(TARGET_ARCH)/$(TARGET_SUBARCH)
  34. libm_SUBARCH_OUT:=$(libm_OUT)/$(TARGET_ARCH)/$(TARGET_SUBARCH)
  35. endif
  36. ifeq ($(UCLIBC_HAS_FPU),y)
  37. ifeq ($(DO_C99_MATH),y)
  38. -include $(libm_ARCH_DIR)/Makefile.arch
  39. -include $(libm_SUBARCH_DIR)/Makefile.arch
  40. endif
  41. endif
  42. FL_MSRC := float_wrappers.c
  43. LD_MSRC := ldouble_wrappers.c
  44. ifeq ($(DO_C99_MATH),y)
  45. libm_CSRC := \
  46. e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c \
  47. e_exp.c e_exp10.c e_fmod.c e_hypot.c \
  48. e_lgamma_r.c e_log.c e_log2.c e_log10.c \
  49. e_pow.c e_remainder.c e_rem_pio2.c e_scalb.c e_sinh.c \
  50. e_sqrt.c k_cos.c k_rem_pio2.c k_sin.c k_tan.c \
  51. s_asinh.c s_atan.c s_cbrt.c s_ceil.c s_copysign.c s_cos.c \
  52. s_erf.c s_expm1.c s_fabs.c s_finite.c s_floor.c s_frexp.c \
  53. s_ilogb.c s_ldexp.c s_lib_version.c s_lrint.c s_lround.c s_llround.c \
  54. s_log1p.c s_logb.c s_modf.c s_nextafter.c \
  55. s_nextafterf.c s_round.c \
  56. s_rint.c s_scalbn.c s_signgam.c s_significand.c s_sin.c s_tan.c \
  57. s_tanh.c s_trunc.c \
  58. w_cabs.c \
  59. nan.c carg.c s_llrint.c \
  60. s_fpclassify.c s_fpclassifyf.c s_signbit.c s_signbitf.c \
  61. s_isnan.c s_isnanf.c s_isinf.c s_isinff.c s_finitef.c \
  62. s_fdim.c s_fma.c s_fmax.c s_fmin.c \
  63. s_remquo.c w_exp2.c \
  64. cexp.c sincos.c
  65. FL_MOBJ := \
  66. acosf.o \
  67. acoshf.o \
  68. asinf.o \
  69. asinhf.o \
  70. atan2f.o \
  71. atanf.o \
  72. atanhf.o \
  73. cargf.o \
  74. cbrtf.o \
  75. ceilf.o \
  76. copysignf.o \
  77. cosf.o \
  78. coshf.o \
  79. erfcf.o \
  80. erff.o \
  81. exp2f.o \
  82. expf.o \
  83. expm1f.o \
  84. fabsf.o \
  85. fdimf.o \
  86. floorf.o \
  87. fmaf.o \
  88. fmaxf.o \
  89. fminf.o \
  90. fmodf.o \
  91. frexpf.o \
  92. gammaf.o \
  93. hypotf.o \
  94. ilogbf.o \
  95. ldexpf.o \
  96. lgammaf.o \
  97. llrintf.o \
  98. llroundf.o \
  99. log10f.o \
  100. log1pf.o \
  101. log2f.o \
  102. logbf.o \
  103. logf.o \
  104. lrintf.o \
  105. lroundf.o \
  106. modff.o \
  107. nearbyintf.o \
  108. nexttowardf.o \
  109. powf.o \
  110. remainderf.o \
  111. remquof.o \
  112. rintf.o \
  113. roundf.o \
  114. scalblnf.o \
  115. scalbnf.o \
  116. significandf.o \
  117. sinf.o \
  118. sinhf.o \
  119. sqrtf.o \
  120. tanf.o \
  121. tanhf.o \
  122. tgammaf.o \
  123. truncf.o \
  124. ifeq ($(UCLIBC_SUSV3_LEGACY),y)
  125. FL_MOBJ += scalbf.o
  126. endif
  127. # Do not (yet?) implement the float variants of bessel functions
  128. ifeq (not-yet-implemented-$(DO_XSI_MATH),y)
  129. FL_MOBJ += \
  130. j0f.o \
  131. j1f.o \
  132. jnf.o \
  133. y0f.o \
  134. y1f.o \
  135. ynf.o
  136. endif
  137. LD_MOBJ := \
  138. __finitel.o \
  139. __fpclassifyl.o \
  140. __isinfl.o \
  141. __isnanl.o \
  142. __signbitl.o \
  143. acoshl.o \
  144. acosl.o \
  145. asinhl.o \
  146. asinl.o \
  147. atan2l.o \
  148. atanhl.o \
  149. atanl.o \
  150. cargl.o \
  151. cbrtl.o \
  152. ceill.o \
  153. copysignl.o \
  154. coshl.o \
  155. cosl.o \
  156. erfcl.o \
  157. erfl.o \
  158. exp2l.o \
  159. expl.o \
  160. expm1l.o \
  161. fabsl.o \
  162. fdiml.o \
  163. floorl.o \
  164. fmal.o \
  165. fmaxl.o \
  166. fminl.o \
  167. fmodl.o \
  168. frexpl.o \
  169. gammal.o \
  170. hypotl.o \
  171. ilogbl.o \
  172. ldexpl.o \
  173. lgammal.o \
  174. llrintl.o \
  175. llroundl.o \
  176. log10l.o \
  177. log1pl.o \
  178. log2l.o \
  179. logbl.o \
  180. logl.o \
  181. lrintl.o \
  182. lroundl.o \
  183. modfl.o \
  184. nearbyintl.o \
  185. nextafterl.o \
  186. nexttowardl.o \
  187. powl.o \
  188. remainderl.o \
  189. remquol.o \
  190. rintl.o \
  191. roundl.o \
  192. scalblnl.o \
  193. scalbnl.o \
  194. significandl.o \
  195. sinhl.o \
  196. sinl.o \
  197. sqrtl.o \
  198. tanhl.o \
  199. tanl.o \
  200. tgammal.o \
  201. truncl.o \
  202. # Do not (yet?) implement the long double variants of bessel functions
  203. ifeq (not-yet-implemented-$(DO_XSI_MATH),y)
  204. LD_MOBJ += \
  205. j0l.o \
  206. j1l.o \
  207. jnl.o \
  208. y0l.o \
  209. y1l.o \
  210. ynl.o
  211. endif
  212. else
  213. # This list of math functions was taken from POSIX/IEEE 1003.1b-1993
  214. libm_CSRC := \
  215. s_atan.c s_ceil.c s_cos.c \
  216. s_fabs.c s_floor.c s_frexp.c \
  217. s_ldexp.c s_modf.c s_sin.c \
  218. s_tan.c s_tanh.c \
  219. s_expm1.c s_scalbn.c s_copysign.c e_acos.c e_asin.c e_atan2.c \
  220. k_cos.c e_cosh.c e_exp.c e_fmod.c e_log.c e_log10.c e_pow.c \
  221. k_sin.c e_sinh.c e_sqrt.c k_tan.c e_rem_pio2.c k_rem_pio2.c \
  222. s_finite.c e_exp10.c
  223. # We'll add sqrtf to avoid problems with libstdc++
  224. FL_MOBJ := sqrtf.o
  225. endif
  226. ifeq ($(DO_XSI_MATH),y)
  227. libm_CSRC += e_j0.c e_j1.c e_jn.c
  228. endif
  229. # assume that arch specific versions are provided as single sources/objects
  230. ifeq ($(UCLIBC_HAS_FPU),y)
  231. ifeq ($(DO_C99_MATH),y)
  232. ifneq ($(strip $(libm_ARCH_OBJS)),)
  233. # remove generic sources, if arch specific version is present
  234. ifneq ($(strip $(libm_ARCH_SRC)),)
  235. libm_CSRC := $(filter-out $(notdir $(libm_ARCH_SRC)),$(libm_CSRC))
  236. endif
  237. # remove generic objects built from multi-sources, if arch specific version is present
  238. FL_MOBJ := $(filter-out $(notdir $(libm_ARCH_OBJS)),$(FL_MOBJ))
  239. LD_MOBJ := $(filter-out $(notdir $(libm_ARCH_OBJS)),$(LD_MOBJ))
  240. # we also try to remove % if s_% is in arch specific subdir
  241. FL_MOBJ := $(filter-out $(patsubst s_%.o,%.o,$(notdir $(libm_ARCH_OBJS))),$(FL_MOBJ))
  242. LD_MOBJ := $(filter-out $(patsubst s_%.o,%.o,$(notdir $(libm_ARCH_OBJS))),$(LD_MOBJ))
  243. endif
  244. endif
  245. endif
  246. libm_SRC := $(patsubst %.c,$(libm_DIR)/%.c,$(libm_CSRC))
  247. libm_OBJ := $(patsubst $(libm_DIR)/%.c,$(libm_OUT)/%.o,$(libm_SRC))
  248. ifeq ($(strip $(UCLIBC_HAS_LONG_DOUBLE_MATH)),y)
  249. libm_MSRC_LD := $(libm_DIR)/$(LD_MSRC)
  250. libm_MOBJ_LD := $(patsubst %.o,$(libm_OUT)/%.o,$(LD_MOBJ))
  251. endif
  252. libm_MSRC_FL := $(libm_DIR)/$(FL_MSRC)
  253. libm_MOBJ_FL := $(patsubst %.o,$(libm_OUT)/%.o,$(FL_MOBJ))
  254. ifneq ($(DOMULTI),n)
  255. CFLAGS-libm += $(patsubst %,-DL_%,$(subst .o,,$(notdir $(libm_MOBJ_FL))))
  256. ifeq ($(strip $(UCLIBC_HAS_LONG_DOUBLE_MATH)),y)
  257. CFLAGS-libm += $(patsubst %,-DL_%,$(subst .o,,$(notdir $(libm_MOBJ_LD))))
  258. endif
  259. endif
  260. libm_OBJS := $(libm_OBJ) $(libm_MOBJ_FL) $(libm_MOBJ_LD)
  261. ifeq ($(DOPIC),y)
  262. libm-a-y += $(libm_OBJS:.o=.os)
  263. else
  264. libm-a-y += $(libm_OBJS)
  265. endif
  266. libm-so-y += $(libm_OBJS:.o=.os)
  267. lib-a-$(UCLIBC_HAS_FLOATS) += $(top_builddir)lib/libm.a
  268. lib-so-$(UCLIBC_HAS_FLOATS) += $(top_builddir)lib/libm.so
  269. objclean-y += CLEAN_libm
  270. ifeq ($(DOMULTI),n)
  271. ifeq ($(DOPIC),y)
  272. $(top_builddir)lib/libm.so: $(top_builddir)lib/libm.a $(libc.depend)
  273. else
  274. $(top_builddir)lib/libm.so: $(libm_OUT)/libm_so.a $(libc.depend)
  275. endif
  276. $(call link.so,$(libm_FULL_NAME),$(ABI_VERSION))
  277. # link for backward compatibility
  278. $(call link.so,$(libm_FULL_NAME),0)
  279. else
  280. $(top_builddir)lib/libm.so: $(libm_OUT)/libm.oS | $(libc.depend)
  281. $(call linkm.so,$(libm_FULL_NAME),$(ABI_VERSION))
  282. # link for backward compatibility
  283. $(call linkm.so,$(libm_FULL_NAME),0)
  284. endif
  285. $(libm_OUT)/libm_so.a: $(libm-so-y)
  286. $(Q)$(RM) $@
  287. $(do_ar)
  288. $(libm_OUT)/libm.oS: $(libm_SRC) $(libm_MSRC_FL) $(libm_MSRC_LD) $(libm_ARCH_SRC)
  289. $(Q)$(RM) $@
  290. $(compile-m)
  291. $(top_builddir)lib/libm.a: $(libm-a-y)
  292. $(Q)$(INSTALL) -d $(dir $@)
  293. $(Q)$(RM) $@
  294. $(do_ar)
  295. $(libm_MOBJ_FL): $(libm_MSRC_FL)
  296. $(compile.m)
  297. $(libm_MOBJ_LD): $(libm_MSRC_LD)
  298. $(compile.m)
  299. $(libm_MOBJ_FL:.o=.os): $(libm_MSRC_FL)
  300. $(compile.m)
  301. $(libm_MOBJ_LD:.o=.os): $(libm_MSRC_LD)
  302. $(compile.m)
  303. # spare us from adding a gazillion dummy two-liner files
  304. $(libm_MOBJ_FL:.o=.i): $(libm_MSRC_FL)
  305. $(compile.mi)
  306. $(libm_MOBJ_LD:.o=.i): $(libm_MSRC_LD)
  307. $(compile.mi)
  308. CLEAN_libm:
  309. $(do_rm) $(addprefix $(libm_OUT)/,$(foreach e, o os oS a,$(foreach d, *. */*. */*/*.,$(d)$(e))))