Makefile.in 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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_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
  66. # Not implemented [yet?], see comment in float_wrappers.c:
  67. # fdimf.o fmaf.o fmaxf.o fminf.o
  68. # nearbyintf.o remquof.o scalblnf.o tgammaf.o
  69. FL_MOBJ := \
  70. acosf.o \
  71. acoshf.o \
  72. asinf.o \
  73. asinhf.o \
  74. atan2f.o \
  75. atanf.o \
  76. atanhf.o \
  77. cargf.o \
  78. cbrtf.o \
  79. ceilf.o \
  80. copysignf.o \
  81. cosf.o \
  82. coshf.o \
  83. erfcf.o \
  84. erff.o \
  85. exp2f.o \
  86. expf.o \
  87. expm1f.o \
  88. fabsf.o \
  89. floorf.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. powf.o \
  108. remainderf.o \
  109. rintf.o \
  110. roundf.o \
  111. scalbf.o \
  112. scalbnf.o \
  113. significandf.o \
  114. sinf.o \
  115. sinhf.o \
  116. sqrtf.o \
  117. tanf.o \
  118. tanhf.o \
  119. truncf.o \
  120. # Not implemented [yet?]: nexttowardl.o
  121. LD_MOBJ := \
  122. __finitel.o \
  123. __fpclassifyl.o \
  124. __isinfl.o \
  125. __isnanl.o \
  126. __signbitl.o \
  127. acoshl.o \
  128. acosl.o \
  129. asinhl.o \
  130. asinl.o \
  131. atan2l.o \
  132. atanhl.o \
  133. atanl.o \
  134. cargl.o \
  135. cbrtl.o \
  136. ceill.o \
  137. copysignl.o \
  138. coshl.o \
  139. cosl.o \
  140. erfcl.o \
  141. erfl.o \
  142. exp2l.o \
  143. expl.o \
  144. expm1l.o \
  145. fabsl.o \
  146. fdiml.o \
  147. floorl.o \
  148. fmal.o \
  149. fmaxl.o \
  150. fminl.o \
  151. fmodl.o \
  152. frexpl.o \
  153. gammal.o \
  154. hypotl.o \
  155. ilogbl.o \
  156. ldexpl.o \
  157. lgammal.o \
  158. llrintl.o \
  159. llroundl.o \
  160. log10l.o \
  161. log1pl.o \
  162. log2l.o \
  163. logbl.o \
  164. logl.o \
  165. lrintl.o \
  166. lroundl.o \
  167. modfl.o \
  168. nearbyintl.o \
  169. nextafterl.o \
  170. powl.o \
  171. remainderl.o \
  172. remquol.o \
  173. rintl.o \
  174. roundl.o \
  175. scalblnl.o \
  176. scalbnl.o \
  177. significandl.o \
  178. sinhl.o \
  179. sinl.o \
  180. sqrtl.o \
  181. tanhl.o \
  182. tanl.o \
  183. tgammal.o \
  184. truncl.o \
  185. else
  186. # This list of math functions was taken from POSIX/IEEE 1003.1b-1993
  187. libm_CSRC := \
  188. s_atan.c s_ceil.c s_cos.c \
  189. s_fabs.c s_floor.c s_frexp.c \
  190. s_ldexp.c s_modf.c s_sin.c \
  191. s_tan.c s_tanh.c \
  192. s_expm1.c s_scalbn.c s_copysign.c e_acos.c e_asin.c e_atan2.c \
  193. k_cos.c e_cosh.c e_exp.c e_fmod.c e_log.c e_log10.c e_pow.c \
  194. k_sin.c e_sinh.c e_sqrt.c k_tan.c e_rem_pio2.c k_rem_pio2.c \
  195. s_finite.c
  196. # We'll add sqrtf to avoid problems with libstdc++
  197. FL_MOBJ := sqrtf.o
  198. endif
  199. ifeq ($(DO_XSI_MATH),y)
  200. libm_CSRC += e_j0.c e_j1.c e_jn.c
  201. endif
  202. # assume that arch specific versions are provided as single sources/objects
  203. ifeq ($(UCLIBC_HAS_FPU),y)
  204. ifeq ($(DO_C99_MATH),y)
  205. ifneq ($(strip $(libm_ARCH_OBJS)),)
  206. CFLAGS-libm/$(TARGET_ARCH)/ := $(CFLAGS-libm)
  207. CFLAGS-libm/$(TARGET_ARCH)/$(TARGET_SUBARCH)/ := $(CFLAGS-libm)
  208. # remove generic sources, if arch specific version is present
  209. ifneq ($(strip $(libm_ARCH_SRC)),)
  210. libm_CSRC := $(filter-out $(notdir $(libm_ARCH_SRC)),$(libm_CSRC))
  211. endif
  212. # remove generic objects built from multi-sources, if arch specific version is present
  213. FL_MOBJ := $(filter-out $(notdir $(libm_ARCH_OBJS)),$(FL_MOBJ))
  214. LD_MOBJ := $(filter-out $(notdir $(libm_ARCH_OBJS)),$(LD_MOBJ))
  215. # we also try to remove % if s_% is in arch specific subdir
  216. FL_MOBJ := $(filter-out $(patsubst s_%.o,%.o,$(notdir $(libm_ARCH_OBJS))),$(FL_MOBJ))
  217. LD_MOBJ := $(filter-out $(patsubst s_%.o,%.o,$(notdir $(libm_ARCH_OBJS))),$(LD_MOBJ))
  218. endif
  219. endif
  220. endif
  221. libm_SRC := $(patsubst %.c,$(libm_DIR)/%.c,$(libm_CSRC))
  222. libm_OBJ := $(patsubst $(libm_DIR)/%.c,$(libm_OUT)/%.o,$(libm_SRC))
  223. ifeq ($(strip $(UCLIBC_HAS_LONG_DOUBLE_MATH)),y)
  224. libm_MSRC_LD := $(libm_DIR)/$(LD_MSRC)
  225. libm_MOBJ_LD := $(patsubst %.o,$(libm_OUT)/%.o,$(LD_MOBJ))
  226. endif
  227. libm_MSRC_FL := $(libm_DIR)/$(FL_MSRC)
  228. libm_MOBJ_FL := $(patsubst %.o,$(libm_OUT)/%.o,$(FL_MOBJ))
  229. ifneq ($(DOMULTI),n)
  230. CFLAGS-libm += $(patsubst %,-DL_%,$(subst .o,,$(notdir $(libm_MOBJ_FL))))
  231. ifeq ($(strip $(UCLIBC_HAS_LONG_DOUBLE_MATH)),y)
  232. CFLAGS-libm += $(patsubst %,-DL_%,$(subst .o,,$(notdir $(libm_MOBJ_LD))))
  233. endif
  234. endif
  235. libm_OBJS := $(libm_OBJ) $(libm_MOBJ_FL) $(libm_MOBJ_LD)
  236. ifeq ($(DOPIC),y)
  237. libm-a-y += $(libm_OBJS:.o=.os)
  238. else
  239. libm-a-y += $(libm_OBJS)
  240. endif
  241. libm-so-y += $(libm_OBJS:.o=.os)
  242. lib-a-$(UCLIBC_HAS_FLOATS) += $(top_builddir)lib/libm.a
  243. lib-so-$(UCLIBC_HAS_FLOATS) += $(top_builddir)lib/libm.so
  244. objclean-y += CLEAN_libm
  245. ifeq ($(DOMULTI),n)
  246. ifeq ($(DOPIC),y)
  247. $(top_builddir)lib/libm.so: $(top_builddir)lib/libm.a $(libc.depend)
  248. else
  249. $(top_builddir)lib/libm.so: $(libm_OUT)/libm_so.a $(libc.depend)
  250. endif
  251. $(call link.so,$(libm_FULL_NAME),$(ABI_VERSION))
  252. else
  253. $(top_builddir)lib/libm.so: $(libm_OUT)/libm.oS | $(libc.depend)
  254. $(call linkm.so,$(libm_FULL_NAME),$(ABI_VERSION))
  255. endif
  256. $(libm_OUT)/libm_so.a: $(libm-so-y)
  257. $(Q)$(RM) $@
  258. $(do_ar)
  259. $(libm_OUT)/libm.oS: $(libm_SRC) $(libm_MSRC_FL) $(libm_MSRC_LD) $(libm_ARCH_SRC)
  260. $(Q)$(RM) $@
  261. $(compile-m)
  262. $(top_builddir)lib/libm.a: $(libm-a-y)
  263. $(Q)$(INSTALL) -d $(dir $@)
  264. $(Q)$(RM) $@
  265. $(do_ar)
  266. $(libm_MOBJ_FL): $(libm_MSRC_FL)
  267. $(compile.m)
  268. $(libm_MOBJ_LD): $(libm_MSRC_LD)
  269. $(compile.m)
  270. $(libm_MOBJ_FL:.o=.os): $(libm_MSRC_FL)
  271. $(compile.m)
  272. $(libm_MOBJ_LD:.o=.os): $(libm_MSRC_LD)
  273. $(compile.m)
  274. # spare us from adding a gazillion dummy two-liner files
  275. $(libm_MOBJ_FL:.o=.i): $(libm_MSRC_FL)
  276. $(compile.mi)
  277. $(libm_MOBJ_LD:.o=.i): $(libm_MSRC_LD)
  278. $(compile.mi)
  279. CLEAN_libm:
  280. $(do_rm) $(addprefix $(libm_OUT)/,$(foreach e, o os oS a,$(foreach d, *. */*. */*/*.,$(d)$(e))))