gcc44/gmp: remove Makefile hack, it is fixed proper in bsd.dep.mk
[dragonfly.git] / gnu / usr.bin / cc44 / gmp / Makefile
CommitLineData
cdefb602
SS
1LIB= gmp
2INTERNALLIB= # yes
3
4CONTRIBDIR= ${.CURDIR}/../../../../contrib/gmp
5.PATH: ${CONTRIBDIR}
6
7.include "${.CURDIR}/Makefile.${MACHINE_ARCH}"
8
9CFLAGS+= -D__GMP_WITHIN_GMP -I${CONTRIBDIR} -I${.OBJDIR} -I${.CURDIR}
10CFLAGS+= -I${CONTRIBDIR}/mpn/generic
11CFLAGS+= -D__LONG_INT_BITS=${LONG_INT_BITS}
12CFLAGS+= -D__INT_BITS=${INT_BITS}
13CFLAGS+= -D__SHORT_BITS=${SHORT_BITS}
14
15
16# The following comes verbatim from Makefile.am
17
18MPF_OBJECTS = mpf/init$U.lo mpf/init2$U.lo mpf/set$U.lo mpf/set_ui$U.lo \
19 mpf/set_si$U.lo mpf/set_str$U.lo mpf/set_d$U.lo mpf/set_z$U.lo \
20 mpf/iset$U.lo mpf/iset_ui$U.lo mpf/iset_si$U.lo mpf/iset_str$U.lo \
21 mpf/iset_d$U.lo mpf/clear$U.lo mpf/get_str$U.lo mpf/dump$U.lo \
22 mpf/size$U.lo mpf/eq$U.lo mpf/reldiff$U.lo mpf/sqrt$U.lo mpf/random2$U.lo \
23 mpf/inp_str$U.lo mpf/out_str$U.lo mpf/add$U.lo mpf/add_ui$U.lo \
24 mpf/sub$U.lo mpf/sub_ui$U.lo mpf/ui_sub$U.lo mpf/mul$U.lo mpf/mul_ui$U.lo \
25 mpf/div$U.lo mpf/div_ui$U.lo \
26 mpf/cmp$U.lo mpf/cmp_d$U.lo mpf/cmp_ui$U.lo mpf/cmp_si$U.lo \
27 mpf/mul_2exp$U.lo mpf/div_2exp$U.lo mpf/abs$U.lo mpf/neg$U.lo \
28 mpf/set_q$U.lo mpf/get_d$U.lo mpf/get_d_2exp$U.lo mpf/set_dfl_prec$U.lo \
29 mpf/set_prc$U.lo mpf/set_prc_raw$U.lo mpf/get_dfl_prec$U.lo \
30 mpf/get_prc$U.lo mpf/ui_div$U.lo mpf/sqrt_ui$U.lo \
31 mpf/ceilfloor$U.lo mpf/trunc$U.lo mpf/pow_ui$U.lo \
32 mpf/urandomb$U.lo mpf/swap$U.lo \
33 mpf/fits_sint$U.lo mpf/fits_slong$U.lo mpf/fits_sshort$U.lo \
34 mpf/fits_uint$U.lo mpf/fits_ulong$U.lo mpf/fits_ushort$U.lo \
35 mpf/get_si$U.lo mpf/get_ui$U.lo \
36 mpf/int_p$U.lo
37
38MPZ_OBJECTS = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo \
39 mpz/aorsmul$U.lo mpz/aorsmul_i$U.lo mpz/and$U.lo mpz/array_init$U.lo \
40 mpz/bin_ui$U.lo mpz/bin_uiui$U.lo \
41 mpz/cdiv_q$U.lo mpz/cdiv_q_ui$U.lo \
42 mpz/cdiv_qr$U.lo mpz/cdiv_qr_ui$U.lo \
43 mpz/cdiv_r$U.lo mpz/cdiv_r_ui$U.lo mpz/cdiv_ui$U.lo \
44 mpz/cfdiv_q_2exp$U.lo mpz/cfdiv_r_2exp$U.lo \
45 mpz/clear$U.lo mpz/clrbit$U.lo \
46 mpz/cmp$U.lo mpz/cmp_d$U.lo mpz/cmp_si$U.lo mpz/cmp_ui$U.lo \
47 mpz/cmpabs$U.lo mpz/cmpabs_d$U.lo mpz/cmpabs_ui$U.lo \
48 mpz/com$U.lo mpz/combit$U.lo \
49 mpz/cong$U.lo mpz/cong_2exp$U.lo mpz/cong_ui$U.lo \
50 mpz/divexact$U.lo mpz/divegcd$U.lo mpz/dive_ui$U.lo \
51 mpz/divis$U.lo mpz/divis_ui$U.lo mpz/divis_2exp$U.lo mpz/dump$U.lo \
52 mpz/export$U.lo mpz/fac_ui$U.lo mpz/fdiv_q$U.lo \
53 mpz/fdiv_q_ui$U.lo mpz/fdiv_qr$U.lo mpz/fdiv_qr_ui$U.lo \
54 mpz/fdiv_r$U.lo mpz/fdiv_r_ui$U.lo \
55 mpz/fdiv_ui$U.lo mpz/fib_ui$U.lo mpz/fib2_ui$U.lo mpz/fits_sint$U.lo \
56 mpz/fits_slong$U.lo mpz/fits_sshort$U.lo mpz/fits_uint$U.lo \
57 mpz/fits_ulong$U.lo mpz/fits_ushort$U.lo mpz/gcd$U.lo \
58 mpz/gcd_ui$U.lo mpz/gcdext$U.lo mpz/get_d$U.lo mpz/get_d_2exp$U.lo \
59 mpz/get_si$U.lo mpz/get_str$U.lo mpz/get_ui$U.lo mpz/getlimbn$U.lo \
60 mpz/hamdist$U.lo \
61 mpz/import$U.lo mpz/init$U.lo mpz/init2$U.lo mpz/inp_raw$U.lo \
62 mpz/inp_str$U.lo mpz/invert$U.lo \
63 mpz/ior$U.lo mpz/iset$U.lo mpz/iset_d$U.lo mpz/iset_si$U.lo \
64 mpz/iset_str$U.lo mpz/iset_ui$U.lo mpz/jacobi$U.lo mpz/kronsz$U.lo \
65 mpz/kronuz$U.lo mpz/kronzs$U.lo mpz/kronzu$U.lo \
66 mpz/lcm$U.lo mpz/lcm_ui$U.lo mpz/lucnum_ui$U.lo mpz/lucnum2_ui$U.lo \
67 mpz/millerrabin$U.lo mpz/mod$U.lo mpz/mul$U.lo mpz/mul_2exp$U.lo \
68 mpz/mul_si$U.lo mpz/mul_ui$U.lo \
69 mpz/n_pow_ui$U.lo mpz/neg$U.lo mpz/nextprime$U.lo \
70 mpz/out_raw$U.lo mpz/out_str$U.lo mpz/perfpow$U.lo mpz/perfsqr$U.lo \
71 mpz/popcount$U.lo mpz/pow_ui$U.lo mpz/powm$U.lo mpz/powm_ui$U.lo \
72 mpz/pprime_p$U.lo mpz/random$U.lo mpz/random2$U.lo \
73 mpz/realloc$U.lo mpz/realloc2$U.lo mpz/remove$U.lo \
74 mpz/root$U.lo mpz/rootrem$U.lo mpz/rrandomb$U.lo mpz/scan0$U.lo \
75 mpz/scan1$U.lo mpz/set$U.lo mpz/set_d$U.lo mpz/set_f$U.lo \
76 mpz/set_q$U.lo mpz/set_si$U.lo mpz/set_str$U.lo mpz/set_ui$U.lo \
77 mpz/setbit$U.lo \
78 mpz/size$U.lo mpz/sizeinbase$U.lo mpz/sqrt$U.lo \
79 mpz/sqrtrem$U.lo mpz/sub$U.lo mpz/sub_ui$U.lo mpz/swap$U.lo \
80 mpz/tdiv_ui$U.lo mpz/tdiv_q$U.lo mpz/tdiv_q_2exp$U.lo \
81 mpz/tdiv_q_ui$U.lo mpz/tdiv_qr$U.lo mpz/tdiv_qr_ui$U.lo \
82 mpz/tdiv_r$U.lo mpz/tdiv_r_2exp$U.lo mpz/tdiv_r_ui$U.lo \
83 mpz/tstbit$U.lo mpz/ui_pow_ui$U.lo mpz/ui_sub$U.lo mpz/urandomb$U.lo \
84 mpz/urandomm$U.lo mpz/xor$U.lo
85
86MPQ_OBJECTS = mpq/abs$U.lo mpq/aors$U.lo \
87 mpq/canonicalize$U.lo mpq/clear$U.lo \
88 mpq/cmp$U.lo mpq/cmp_si$U.lo mpq/cmp_ui$U.lo mpq/div$U.lo \
89 mpq/get_d$U.lo mpq/get_den$U.lo mpq/get_num$U.lo mpq/get_str$U.lo \
90 mpq/init$U.lo mpq/inp_str$U.lo mpq/inv$U.lo \
91 mpq/md_2exp$U.lo mpq/mul$U.lo mpq/neg$U.lo mpq/out_str$U.lo \
92 mpq/set$U.lo mpq/set_den$U.lo mpq/set_num$U.lo \
93 mpq/set_si$U.lo mpq/set_str$U.lo mpq/set_ui$U.lo \
94 mpq/equal$U.lo mpq/set_z$U.lo mpq/set_d$U.lo \
95 mpq/set_f$U.lo mpq/swap$U.lo
96
97MPN_OBJECTS = mpn/fib_table$U.lo mpn/mp_bases$U.lo
98
99PRINTF_OBJECTS = \
100 printf/asprintf$U.lo printf/asprntffuns$U.lo \
101 printf/doprnt$U.lo printf/doprntf$U.lo printf/doprnti$U.lo \
102 printf/fprintf$U.lo \
103 printf/obprintf$U.lo printf/obvprintf$U.lo printf/obprntffuns$U.lo \
104 printf/printf$U.lo printf/printffuns$U.lo \
105 printf/snprintf$U.lo printf/snprntffuns$U.lo \
106 printf/sprintf$U.lo printf/sprintffuns$U.lo \
107 printf/vasprintf$U.lo printf/vfprintf$U.lo printf/vprintf$U.lo \
108 printf/vsnprintf$U.lo printf/vsprintf$U.lo \
109 printf/repl-vsnprintf$U.lo
110
111SCANF_OBJECTS = \
112 scanf/doscan$U.lo scanf/fscanf$U.lo scanf/fscanffuns$U.lo \
113 scanf/scanf$U.lo scanf/sscanf$U.lo scanf/sscanffuns$U.lo \
114 scanf/vfscanf$U.lo scanf/vscanf$U.lo scanf/vsscanf$U.lo
115
116libgmp_la_SOURCES = gmp-impl.h longlong.h randmt.h \
117 assert.c compat.c errno.c extract-dbl.c invalid.c memory.c \
118 mp_bpl.c mp_clz_tab.c mp_dv_tab.c mp_minv_tab.c mp_get_fns.c mp_set_fns.c \
119 rand.c randclr.c randdef.c randiset.c randlc2s.c randlc2x.c randmt.c \
120 randmts.c rands.c randsd.c randsdui.c randbui.c randmui.c version.c
121
122# From configure.in
123gmp_mpn_functions= \
124 add add_1 add_n sub sub_1 sub_n neg_n mul_1 addmul_1 \
125 submul_1 lshift rshift dive_1 diveby3 divis divrem divrem_1 divrem_2 \
126 fib2_ui mod_1 mod_34lsub1 mode1o pre_divrem_1 pre_mod_1 dump \
127 mod_1_1 mod_1_2 mod_1_3 mod_1_4 \
128 mul mul_fft mul_n mul_basecase sqr_basecase random random2 pow_1 \
129 rootrem sqrtrem get_str set_str scan0 scan1 popcount hamdist cmp perfsqr \
130 bdivmod gcd_1 gcd gcdext_1 gcdext gcd_lehmer gcd_subdiv_step \
131 gcdext_lehmer gcdext_subdiv_step \
132 tdiv_qr dc_divrem_n sb_divrem_mn jacbase get_d \
133 matrix22_mul hgcd2 hgcd mullow_n mullow_basecase \
134 toom22_mul toom33_mul toom44_mul \
135 toom32_mul toom42_mul toom62_mul toom53_mul \
136 toom2_sqr toom3_sqr toom4_sqr \
137 toom_interpolate_5pts toom_interpolate_7pts invert binvert \
138 sb_div_qr sb_divappr_q sb_div_q dc_div_qr dc_divappr_q dc_div_q \
139 mu_div_qr mu_divappr_q mu_div_q \
140 sb_bdiv_q sb_bdiv_qr dc_bdiv_q dc_bdiv_qr mu_bdiv_q mu_bdiv_qr \
141 divexact bdiv_dbm1c redc_1 redc_2 powm powlo powm_sec subcnd_n \
142 umul udiv copyi copyd com_n \
143 and_n andn_n nand_n ior_n iorn_n nior_n xor_n xnor_n \
144 invert_limb sqr_diagonal \
145 mul_2 mul_3 mul_4 \
146 addmul_2 addmul_3 addmul_4 addmul_5 addmul_6 addmul_7 addmul_8 \
147 addlsh1_n sublsh1_n rsh1add_n rsh1sub_n addsub_n addaddmul_1msb0 lshiftc
148
149# end verbatim copy
150
151MULFUNC_add_n= aors_n
152MULFUNC_sub_n= aors_n
153MULFUNC_addmul_1= aorsmul_1
154MULFUNC_submul_1= aorsmul_1
155MULFUNC_popcount= popham
156MULFUNC_hamdist= popham
157MULFUNC_and_n= logops_n
158MULFUNC_andn_n= logops_n
159MULFUNC_nand_n= logops_n
160MULFUNC_ior_n= logops_n
161MULFUNC_iorn_n= logops_n
162MULFUNC_nior_n= logops_n
163MULFUNC_xor_n= logops_n
164MULFUNC_xnor_n= logops_n
165MULFUNC_lshift= lorrshift
166MULFUNC_rshift= lorrshift
167MULFUNC_addlsh1_n= aorslsh1_n
168MULFUNC_sublsh1_n= aorslsh1_n
169MULFUNC_rsh1add_n= rsh1aors_n
170MULFUNC_rsh1sub_n= rsh1aors_n
171
172
173U=
174LO_OBJECTS= ${MPF_OBJECTS} ${MPZ_OBJECTS} ${MPQ_OBJECTS} ${MPN_OBJECTS} \
175 ${PRINTF_OBJECTS} ${SCANF_OBJECTS}
176
177.for func in ${gmp_mpn_functions}
178.for mapfunc in ${func} ${MULFUNC_${func}}
179.for mapsource in mpn/generic/${mapfunc}.c
180.for source in mpn/generic/${func}.c
181.if exists(${mapsource}) && empty(MPNSRC:M${source})
182
183.if !exists(${source})
2387e584
SS
184${source}: ${mapsource}
185 cp ${.ALLSRC} ${.TARGET}
cdefb602
SS
186CLEANFILES+= ${source}
187.endif
188
189MPNSRC+= ${source}
190${source:.c=.o}: ${source}
191 ${CC} -o ${.TARGET} ${CFLAGS} -DOPERATION_${func} -c ${.ALLSRC}
192.endif
193.endfor
194.endfor
195.endfor
196.endfor
197
198SRCS= ${LO_OBJECTS:.lo=.c} ${libgmp_la_SOURCES} ${MPNSRC}
199SRCS+= tal-reent.c
200
201# the following are generated sources, so we have to add them
202# explicitly to SRCS
203GENSRC= fac_ui.h fib_table.h mpn/fib_table.c mp_bases.h perfsqr.h
204SRCS+= ${GENSRC}
205CLEANFILES+= ${GENSRC}
206
207
208fac_ui.h: gen-fac_ui.nx
209 ${.OBJDIR}/gen-fac_ui.nx ${LONG_INT_BITS} 0 > ${.TARGET}
210
211fib_table.h: gen-fib.nx
212 ${.OBJDIR}/gen-fib.nx header ${LONG_INT_BITS} 0 > ${.TARGET}
213
214mpn/fib_table.c: gen-fib.nx
215 ${.OBJDIR}/gen-fib.nx table ${LONG_INT_BITS} 0 > ${.TARGET}
216
217mp_bases.h: gen-bases.nx
218 ${.OBJDIR}/gen-bases.nx header ${LONG_INT_BITS} 0 > ${.TARGET}
219
220mpn/mp_bases.c: gen-bases.nx
221 ${.OBJDIR}/gen-bases.nx table ${LONG_INT_BITS} 0 > ${.TARGET}
222
223perfsqr.h: gen-psqr.nx
224 ${.OBJDIR}/gen-psqr.nx ${LONG_INT_BITS} 0 > ${.TARGET}
225
226.for _gen in fac_ui fib bases psqr
227gen-${_gen}.nx: gen-${_gen}.c dumbmp.c
228 ${NXCC} ${.ALLSRC:M*/gen-*} -o ${.TARGET} -lm
229CLEANFILES+= gen-${_gen}.nx
230.endfor
231
232GENDIRS= mpf mpz mpq mpn mpn/generic printf scanf
233CLEANDIRS+= ${GENDIRS}
234beforedepend: mkdirs
235mkdirs:
236 mkdir -p ${GENDIRS}
237
238.include <bsd.lib.mk>