1 # $NetBSD: Makefile,v 1.24 2013/12/19 01:07:03 gdt Exp $
5 # We don't install gmp, just provide it for GCC.
8 GMP_MACHINE_ARCH?
= ${MACHINE_ARCH
:S
/earmv4
/arm
/:C
/armv
[5-7]/arm
/}
10 .if
${LIBISPRIVATE} != "yes"
15 DIST
=${.CURDIR
}/..
/..
/dist
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 \
35 fits_sint.c fits_slong.c fits_sshort.c \
36 fits_uint.c fits_ulong.c fits_ushort.c \
41 abs.c add.c add_ui.c \
42 aorsmul.c aorsmul_i.c and.c array_init.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 \
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 \
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 \
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 \
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 \
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 \
106 asprintf.c asprntffuns.c \
107 doprnt.c doprntf.c doprnti.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 \
118 doscan.c fscanf.c fscanffuns.c \
119 scanf.c sscanf.c sscanffuns.c \
120 vfscanf.c vscanf.c vsscanf.c
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
131 # these are generated
132 SRCS
+= fib_table.c mp_bases.c
134 # Build the files that may have multiple identical base names under
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}
150 CPPFLAGS
+= -I.
-I
${DIST} -I
${.CURDIR
}/arch
/${GMP_MACHINE_ARCH} \
151 -D__GMP_WITHIN_GMP
-DHAVE_CONFIG_H
155 DPSRCS
= fac_table.h fib_table.h fib_table.c jacobitab.h mp_bases.h \
156 mp_bases.c perfsqr.h trialdivtab.h
159 ${HOST_CC} -o
${.OBJDIR
}/gen-fac
${.ALLSRC
}
162 ${.OBJDIR
}/gen-fac
${GMP_LIMB_BITS} 0 > ${.OBJDIR
}/fac_table.h
165 ${HOST_CC} -o
${.OBJDIR
}/gen-fib
${.ALLSRC
}
168 ${.OBJDIR
}/gen-fib header
${GMP_LIMB_BITS} 0 > ${.OBJDIR
}/fib_table.h
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
)
207 @echo
"GMP_LIMB_BITS not defined!"
211 # XXX stuff looks for "../config.m4"
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
222 BUILD_S_INCS
= -I
${.CURDIR
} -I
${.OBJDIR
}/dummy
-I
${DIST}/ -I
${DIST}/mpn \
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
}
232 CLEANFILES
+= ${_build
:R
}.s
235 .for _build _src in
${C_SRCS_LIST}
236 mpn_
${_build}: Makefile
237 echo
'#include "${_src}"' > ${.TARGET
}
239 CPPFLAGS.mpn_
${_build}+= -DOPERATION_
${_build
:R
}
242 CLEANFILES
+= mpn_
${_build}
245 .
include <bsd.lib.mk
>
249 ${DIST}/mpn
/generic \
250 ${.CURDIR
}/arch
/${GMP_MACHINE_ARCH} \
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
*)
261 CWARNFLAGS.clang
+= -Wno-unused-value
-Wno-tautological-compare
-Wno-parentheses