Makefile.in 7.6 KB

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