etc/services - sync with NetBSD-8
[minix.git] / external / lgpl3 / gmp / lib / libgmp / Makefile
blob91a221274708caf95ab044b10512f936bda18521
1 # $NetBSD: Makefile,v 1.24 2013/12/19 01:07:03 gdt Exp $
3 .include <bsd.init.mk>
5 # We don't install gmp, just provide it for GCC.
6 LIBISPRIVATE?= yes
8 GMP_MACHINE_ARCH?= ${MACHINE_ARCH:S/earmv4/arm/:C/armv[5-7]/arm/}
10 .if ${LIBISPRIVATE} != "yes"
11 INCS= gmp.h
12 INCSDIR= /usr/include
13 .endif
15 DIST=${.CURDIR}/../../dist
17 LIB= gmp
19 MPF_SRCS = \
20 init.c init2.c inits.c set.c \
21 set_ui.c set_si.c set_str.c set_d.c \
22 set_z.c iset.c iset_ui.c iset_si.c \
23 iset_str.c iset_d.c clear.c clears.c \
24 get_str.c dump.c size.c eq.c reldiff.c \
25 sqrt.c random2.c inp_str.c out_str.c \
26 add.c add_ui.c sub.c sub_ui.c ui_sub.c \
27 mul.c mul_ui.c div.c div_ui.c \
28 cmp.c cmp_d.c cmp_ui.c cmp_si.c \
29 mul_2exp.c div_2exp.c abs.c neg.c \
30 set_q.c get_d.c get_d_2exp.c set_dfl_prec.c \
31 set_prc.c set_prc_raw.c get_dfl_prec.c \
32 get_prc.c ui_div.c sqrt_ui.c \
33 ceilfloor.c trunc.c pow_ui.c \
34 urandomb.c swap.c \
35 fits_sint.c fits_slong.c fits_sshort.c \
36 fits_uint.c fits_ulong.c fits_ushort.c \
37 get_si.c get_ui.c \
38 int_p.c
40 MPZ_SRCS = \
41 abs.c add.c add_ui.c \
42 aorsmul.c aorsmul_i.c and.c array_init.c \
43 bin_ui.c bin_uiui.c \
44 cdiv_q.c cdiv_q_ui.c \
45 cdiv_qr.c cdiv_qr_ui.c \
46 cdiv_r.c cdiv_r_ui.c cdiv_ui.c \
47 cfdiv_q_2exp.c cfdiv_r_2exp.c \
48 clear.c clears.c clrbit.c \
49 cmp.c cmp_d.c cmp_si.c cmp_ui.c \
50 cmpabs.c cmpabs_d.c cmpabs_ui.c \
51 com.c combit.c \
52 cong.c cong_2exp.c cong_ui.c \
53 divexact.c divegcd.c dive_ui.c \
54 divis.c divis_ui.c divis_2exp.c dump.c \
55 export.c fac_ui.c fdiv_q.c \
56 fdiv_q_ui.c fdiv_qr.c fdiv_qr_ui.c \
57 fdiv_r.c fdiv_r_ui.c \
58 fdiv_ui.c fib_ui.c fib2_ui.c fits_sint.c \
59 fits_slong.c fits_sshort.c fits_uint.c \
60 fits_ulong.c fits_ushort.c gcd.c \
61 gcd_ui.c gcdext.c get_d.c get_d_2exp.c \
62 get_si.c get_str.c get_ui.c getlimbn.c \
63 hamdist.c \
64 import.c init.c init2.c inits.c \
65 inp_raw.c inp_str.c invert.c \
66 ior.c iset.c iset_d.c iset_si.c \
67 iset_str.c iset_ui.c jacobi.c kronsz.c \
68 kronuz.c kronzs.c kronzu.c \
69 lcm.c lcm_ui.c lucnum_ui.c lucnum2_ui.c \
70 millerrabin.c mod.c mul.c mul_2exp.c \
71 mul_si.c mul_ui.c \
72 n_pow_ui.c neg.c nextprime.c \
73 out_raw.c out_str.c perfpow.c perfsqr.c \
74 popcount.c pow_ui.c powm.c powm_sec.c \
75 powm_ui.c pprime_p.c random.c random2.c \
76 realloc.c realloc2.c remove.c \
77 root.c rootrem.c rrandomb.c scan0.c \
78 scan1.c set.c set_d.c set_f.c \
79 set_q.c set_si.c set_str.c set_ui.c \
80 setbit.c \
81 size.c sizeinbase.c sqrt.c \
82 sqrtrem.c sub.c sub_ui.c swap.c \
83 tdiv_ui.c tdiv_q.c tdiv_q_2exp.c \
84 tdiv_q_ui.c tdiv_qr.c tdiv_qr_ui.c \
85 tdiv_r.c tdiv_r_2exp.c tdiv_r_ui.c \
86 tstbit.c ui_pow_ui.c ui_sub.c urandomb.c \
87 urandomm.c xor.c
89 MPQ_SRCS = \
90 abs.c aors.c \
91 canonicalize.c clear.c clears.c \
92 cmp.c cmp_si.c cmp_ui.c div.c \
93 get_d.c get_den.c get_num.c get_str.c \
94 init.c inits.c inp_str.c inv.c \
95 md_2exp.c mul.c neg.c out_str.c \
96 set.c set_den.c set_num.c \
97 set_si.c set_str.c set_ui.c \
98 equal.c set_z.c set_d.c \
99 set_f.c swap.c
101 MPN_GENERIC_SRCS = \
102 popcount.c \
103 hamdist.c
105 PRINTF_SRCS = \
106 asprintf.c asprntffuns.c \
107 doprnt.c doprntf.c doprnti.c \
108 fprintf.c \
109 obprintf.c obvprintf.c obprntffuns.c \
110 printf.c printffuns.c \
111 snprintf.c snprntffuns.c \
112 sprintf.c sprintffuns.c \
113 vasprintf.c vfprintf.c vprintf.c \
114 vsnprintf.c vsprintf.c \
115 repl-vsnprintf.c
117 SCANF_SRCS = \
118 doscan.c fscanf.c fscanffuns.c \
119 scanf.c sscanf.c sscanffuns.c \
120 vfscanf.c vscanf.c vsscanf.c
122 SRCS+= \
123 assert.c compat.c errno.c extract-dbl.c invalid.c memory.c \
124 mp_bpl.c mp_clz_tab.c mp_dv_tab.c mp_minv_tab.c mp_get_fns.c \
125 mp_set_fns.c randclr.c randdef.c randiset.c randlc2s.c \
126 randlc2x.c randmt.c randmts.c rands.c randsd.c randsdui.c \
127 randbui.c randmui.c version.c nextprime.c
129 SRCS+= tal-reent.c
131 # these are generated
132 SRCS+= fib_table.c mp_bases.c
134 # Build the files that may have multiple identical base names under
135 # different names.
136 .for _dir _srcfile in \
137 ${MPF_SRCS:C/^/mpf /} \
138 ${MPZ_SRCS:C/^/mpz /} \
139 ${MPQ_SRCS:C/^/mpq /} \
140 ${PRINTF_SRCS:C/^/printf /} \
141 ${SCANF_SRCS:C/^/scanf /}
142 ${_dir}_${_srcfile}: #Makefile
143 echo '#include "'${_dir}/${_srcfile}'"' > ${.TARGET}
145 SRCS+= ${_dir}_${_srcfile}
146 CLEANFILES+= ${_dir}_${_srcfile}
148 .endfor
150 CPPFLAGS+= -I. -I${DIST} -I${.CURDIR}/arch/${GMP_MACHINE_ARCH} \
151 -D__GMP_WITHIN_GMP -DHAVE_CONFIG_H
153 WITHOUT_MAN= yes
155 DPSRCS= fac_table.h fib_table.h fib_table.c jacobitab.h mp_bases.h \
156 mp_bases.c perfsqr.h trialdivtab.h
158 gen-fac: gen-fac.c
159 ${HOST_CC} -o ${.OBJDIR}/gen-fac ${.ALLSRC}
161 fac_table.h: gen-fac
162 ${.OBJDIR}/gen-fac ${GMP_LIMB_BITS} 0 > ${.OBJDIR}/fac_table.h
164 gen-fib: gen-fib.c
165 ${HOST_CC} -o ${.OBJDIR}/gen-fib ${.ALLSRC}
167 fib_table.h: gen-fib
168 ${.OBJDIR}/gen-fib header ${GMP_LIMB_BITS} 0 > ${.OBJDIR}/fib_table.h
170 fib_table.c: gen-fib
171 ${.OBJDIR}/gen-fib table ${GMP_LIMB_BITS} 0 > ${.OBJDIR}/fib_table.c
173 gen-bases: gen-bases.c
174 ${HOST_CC} -o ${.OBJDIR}/gen-bases ${.ALLSRC} -lm
176 mp_bases.h: gen-bases
177 ${.OBJDIR}/gen-bases header ${GMP_LIMB_BITS} 0 > ${.OBJDIR}/mp_bases.h
179 mp_bases.c: gen-bases
180 ${.OBJDIR}/gen-bases table ${GMP_LIMB_BITS} 0 > ${.OBJDIR}/mp_bases.c
182 gen-jacobitab: gen-jacobitab.c
183 ${HOST_CC} -o ${.OBJDIR}/gen-jacobitab ${.ALLSRC} -lm
185 jacobitab.h: gen-jacobitab
186 ${.OBJDIR}/gen-jacobitab > ${.OBJDIR}/jacobitab.h
188 perfsqr.h: gen-psqr.c
189 ${HOST_CC} -o ${.OBJDIR}/gen-psqr ${.ALLSRC}
190 ${.OBJDIR}/gen-psqr ${GMP_LIMB_BITS} 0 > ${.OBJDIR}/perfsqr.h
192 gen-trialdivtab: gen-trialdivtab.c
193 ${HOST_CC} -o ${.OBJDIR}/gen-trialdivtab ${.ALLSRC} -lm
195 trialdiv.c: trialdivtab.h
196 trialdivtab.h: gen-trialdivtab Makefile
197 ${.OBJDIR}/gen-trialdivtab $(GMP_LIMB_BITS) 8000 > ${.OBJDIR}/trialdivtab.h
199 CLEANFILES+= ${DPSRCS} gen-fac gen-fib gen-bases gen-jacobitab \
200 gen-psqr gen-trialdivtab
202 .include "${.CURDIR}/arch/${GMP_MACHINE_ARCH}/Makefile.inc"
204 # Makefile.inc must define GMP_LIMB_BITS.
205 .if !defined(GMP_LIMB_BITS)
206 .BEGIN:
207 @echo "GMP_LIMB_BITS not defined!"
208 false
209 .endif
211 # XXX stuff looks for "../config.m4"
212 dummy:
213 mkdir dummy
214 ${.OBJDIR}/config.m4: ${.CURDIR}/arch/${GMP_MACHINE_ARCH}/config.m4
215 rm -f ${.OBJDIR}/config.m4 && cp ${.CURDIR}/arch/${GMP_MACHINE_ARCH}/config.m4 ${.OBJDIR}/config.m4
217 CLEANFILES+= config.m4
218 clean: cleandummy
219 cleandummy: .PHONY
220 -rmdir dummy
222 BUILD_S_INCS= -I${.CURDIR} -I${.OBJDIR}/dummy -I${DIST}/ -I${DIST}/mpn \
223 -I${.OBJDIR}
225 .for _build _src in ${ASM_SRCS_LIST}
226 ${_build:R}.s: Makefile dummy ${.OBJDIR}/config.m4 ${DIST}/${_src}
227 ${TOOL_M4} -DCONFIG_TOP_SRCDIR=${DIST} ${BUILD_S_INCS} \
228 ${M4FLAGS} ${M4FLAGS.${.TARGET:R}} \
229 -DOPERATION_${.TARGET:R} ${DIST}/${_src} > ${.TARGET}
231 SRCS+= ${_build:R}.s
232 CLEANFILES+= ${_build:R}.s
233 .endfor
235 .for _build _src in ${C_SRCS_LIST}
236 mpn_${_build}: Makefile
237 echo '#include "${_src}"' > ${.TARGET}
239 CPPFLAGS.mpn_${_build}+= -DOPERATION_${_build:R}
241 SRCS+= mpn_${_build}
242 CLEANFILES+= mpn_${_build}
243 .endfor
245 .include <bsd.lib.mk>
247 .PATH: ${DIST} \
248 ${DIST}/rand \
249 ${DIST}/mpn/generic \
250 ${.CURDIR}/arch/${GMP_MACHINE_ARCH} \
251 ${DIST}/mpf \
252 ${DIST}/mpz
254 # Don't warn about functions which cannot be stack smash protected as
255 # there are a lot of them.
256 COPTS += -Wno-stack-protector
257 .if !empty(GMP_MACHINE_ARCH:M*arm*)
258 COPTS += -marm
259 .endif
261 CWARNFLAGS.clang+= -Wno-unused-value -Wno-tautological-compare -Wno-parentheses