1SubDir HAIKU_TOP src system libroot posix musl math x86 ;
2
3SubDirSysHdrs [ FDirName $(SUBDIR) .. .. include ] ;
4UseHeaders [ FDirName $(SUBDIR) .. .. internal ] ;
5UseHeaders [ FDirName $(SUBDIR) .. .. arch generic ] [ FDirName $(SUBDIR) .. ]  ;
6
7local generics =
8	acosh.c acoshf.c acoshl.c
9	asinh.c asinhf.c asinhl.c
10	atanh.c atanhf.c atanhl.c
11	cbrt.c cbrtf.c cbrtl.c
12	copysign.c copysignf.c copysignl.c
13	__cos.c cos.c __cosdf.c cosf.c cosh.c coshf.c coshl.c __cosl.c cosl.c
14	erf.c erff.c erfl.c
15	exp10.c exp10f.c exp10l.c __expo2.c __expo2f.c
16	exp_data.c exp2f_data.c
17	fdim.c fdimf.c fdiml.c
18	finite.c finitef.c
19	fma.c fmaf.c fmal.c
20	fmax.c fmaxf.c fmaxl.c
21	fmin.c fminf.c fminl.c
22	__fpclassify.c __fpclassifyf.c __fpclassifyl.c
23	frexp.c frexpf.c frexpl.c
24	hypotl.c
25	ilogb.c ilogbf.c ilogbl.c
26	j0.c j0f.c j1.c j1f.c jn.c jnf.c
27	lgamma.c lgammaf.c lgammaf_r.c lgammal.c lgamma_r.c
28	llround.c llroundf.c llroundl.c
29	log10.c log10f.c
30	logb.c logbf.c logbl.c
31	lround.c lroundf.c lroundl.c
32	__math_divzero.c __math_divzerof.c __math_invalid.c __math_invalidf.c
33	__math_oflow.c __math_oflowf.c __math_uflow.c __math_uflowf.c
34	__math_xflow.c __math_xflowf.c modf.c modff.c modfl.c
35	nan.c nanf.c nanl.c
36	nearbyint.c nearbyintf.c nearbyintl.c
37	nextafter.c nextafterf.c nextafterl.c
38	nexttoward.c nexttowardf.c nexttowardl.c
39	__polevll.c
40	pow.c pow_data.c powf.c powf_data.c powl.c
41	__rem_pio2.c __rem_pio2f.c __rem_pio2_large.c __rem_pio2l.c
42	round.c roundf.c roundl.c
43	scalb.c scalbf.c
44	__signbit.c __signbitf.c __signbitl.c
45	signgam.c
46	significand.c significandf.c
47	__sin.c sin.c sincos.c sincosf.c sincosl.c __sinl.c sinl.c
48	__sindf.c sinf.c sinh.c sinhf.c sinhl.c
49	__tan.c tan.c __tandf.c tanf.c __tanl.c tanl.c
50	tanh.c tanhf.c tanhl.c
51	tgamma.c tgammaf.c tgammal.c
52	;
53
54local architectureObject ;
55for architectureObject in [ MultiArchSubDirSetup x86 x86_gcc2 ] {
56	on $(architectureObject) {
57		local architecture = $(TARGET_PACKAGING_ARCH) ;
58
59		UseHeaders [ FDirName $(SUBDIR) .. .. arch $(architecture) ] ;
60
61		if $(architecture) = x86_gcc2 {
62			# GCC 2 miscompiles some of the files in here, so we use GCC 8.
63			original_TARGET_CC_x86_gcc2 = $(TARGET_CC_x86_gcc2) ;
64			TARGET_CC_x86_gcc2 = $(TARGET_CC_x86) -Wa,-mrelax-relocations=no -Wno-unused-but-set-variable ;
65		}
66
67		MergeObject <$(architecture)>posix_musl_math.o :
68			__invtrigl.s
69			acos.s acosl.s acosf.s asin.s asinf.s asinl.s atan.s atan2.s atan2f.s
70			atan2l.s atanf.s atanl.s
71			ceil.s ceilf.s ceill.s
72			exp.s exp2.s exp2f.s exp2l.s expl.s expf.s expm1.s expm1f.s expm1l.s
73			fabs.s fabsf.s fabsl.s floor.s floorf.s floorl.s
74			fmod.s fmodf.s fmodl.s
75			hypot.s hypotf.s
76			ldexp.s ldexpf.s ldexpl.s llrintf.s llrintl.s llrint.s
77			log.s log1p.s log1pf.s log2.s log2f.s log2l.s
78			log10l.s log1pl.s logf.s logl.s lrintf.s lrintl.s lrint.s
79			remainder.s remainderf.s remainderl.s
80			remquo.s remquof.s remquol.s rint.s rintf.s rintl.s
81			scalbln.s scalblnf.s scalblnl.s
82			scalbn.s scalbnf.s scalbnl.s
83			sqrtf.s sqrtl.s sqrt.s
84			truncl.s trunc.s truncf.s
85
86			gamma.c
87
88			$(generics)
89			;
90
91		if $(architecture) = x86_gcc2 {
92			TARGET_CC_x86_gcc2 = $(original_TARGET_CC_x86_gcc2) ;
93		}
94
95
96		SEARCH on [ FGristFiles $(generics) ] = [ FDirName $(SUBDIR) .. ] ;
97	}
98}
99