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_BYTES=${LONG_INT_BYTES} 12CFLAGS+= -D__INT_BITS=${INT_BITS} 13CFLAGS+= -DHAVE_HOST_CPU_FAMILY_${CPU_FAMILY}=1 14 15 16# The following comes verbatim from Makefile.am 17 18MPF_OBJECTS = mpf/init$U.lo mpf/init2$U.lo mpf/inits$U.lo mpf/set$U.lo \ 19 mpf/set_ui$U.lo mpf/set_si$U.lo mpf/set_str$U.lo mpf/set_d$U.lo \ 20 mpf/set_z$U.lo mpf/iset$U.lo mpf/iset_ui$U.lo mpf/iset_si$U.lo \ 21 mpf/iset_str$U.lo mpf/iset_d$U.lo mpf/clear$U.lo mpf/clears$U.lo \ 22 mpf/get_str$U.lo mpf/dump$U.lo mpf/size$U.lo mpf/eq$U.lo mpf/reldiff$U.lo \ 23 mpf/sqrt$U.lo mpf/random2$U.lo mpf/inp_str$U.lo mpf/out_str$U.lo \ 24 mpf/add$U.lo mpf/add_ui$U.lo mpf/sub$U.lo mpf/sub_ui$U.lo mpf/ui_sub$U.lo \ 25 mpf/mul$U.lo mpf/mul_ui$U.lo 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/clears$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/inits$U.lo \ 62 mpz/inp_raw$U.lo 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_sec$U.lo \ 72 mpz/powm_ui$U.lo 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 mpq/clears$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/inits$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 nextprime.c 122 123# From configure.in 124gmp_mpn_functions_optional=umul udiv \ 125 invert_limb sqr_diagonal \ 126 mul_2 mul_3 mul_4 \ 127 addmul_2 addmul_3 addmul_4 addmul_5 addmul_6 addmul_7 addmul_8 \ 128 addlsh1_n sublsh1_n rsblsh1_n rsh1add_n rsh1sub_n \ 129 addlsh2_n sublsh2_n rsblsh2_n \ 130 addlsh_n sublsh_n rsblsh_n \ 131 add_n_sub_n addaddmul_1msb0 132 133gmp_mpn_functions=${extra_functions} \ 134 add add_1 add_n sub sub_1 sub_n neg com mul_1 addmul_1 \ 135 submul_1 lshift rshift dive_1 diveby3 divis divrem divrem_1 divrem_2 \ 136 fib2_ui mod_1 mod_34lsub1 mode1o pre_divrem_1 pre_mod_1 dump \ 137 mod_1_1 mod_1_2 mod_1_3 mod_1_4 lshiftc \ 138 mul mul_fft mul_n sqr mul_basecase sqr_basecase nussbaumer_mul \ 139 random random2 pow_1 \ 140 rootrem sqrtrem get_str set_str scan0 scan1 popcount hamdist cmp \ 141 perfsqr perfpow \ 142 gcd_1 gcd gcdext_1 gcdext gcd_lehmer gcd_subdiv_step \ 143 gcdext_lehmer gcdext_subdiv_step \ 144 div_q tdiv_qr jacbase get_d \ 145 matrix22_mul hgcd2 hgcd mullo_n mullo_basecase \ 146 toom22_mul toom32_mul toom42_mul toom52_mul toom62_mul \ 147 toom33_mul toom43_mul toom53_mul toom63_mul \ 148 toom44_mul \ 149 toom6h_mul toom6_sqr toom8h_mul toom8_sqr \ 150 toom_couple_handling \ 151 toom2_sqr toom3_sqr toom4_sqr \ 152 toom_eval_dgr3_pm1 toom_eval_dgr3_pm2 \ 153 toom_eval_pm1 toom_eval_pm2 toom_eval_pm2exp toom_eval_pm2rexp \ 154 toom_interpolate_5pts toom_interpolate_6pts toom_interpolate_7pts \ 155 toom_interpolate_8pts toom_interpolate_12pts toom_interpolate_16pts \ 156 invertappr invert binvert mulmod_bnm1 sqrmod_bnm1 \ 157 sbpi1_div_q sbpi1_div_qr sbpi1_divappr_q \ 158 dcpi1_div_q dcpi1_div_qr dcpi1_divappr_q \ 159 mu_div_qr mu_divappr_q mu_div_q \ 160 bdiv_q_1 \ 161 sbpi1_bdiv_q sbpi1_bdiv_qr \ 162 dcpi1_bdiv_q dcpi1_bdiv_qr \ 163 mu_bdiv_q mu_bdiv_qr \ 164 bdiv_q bdiv_qr \ 165 divexact bdiv_dbm1c redc_1 redc_2 redc_n powm powlo powm_sec subcnd_n \ 166 redc_1_sec trialdiv remove \ 167 and_n andn_n nand_n ior_n iorn_n nior_n xor_n xnor_n \ 168 copyi copyd zero \ 169 ${gmp_mpn_functions_optional} 170 171# end verbatim copy 172 173MULFUNC_add_n= aors_n 174MULFUNC_sub_n= aors_n 175MULFUNC_addmul_1= aorsmul_1 176MULFUNC_submul_1= aorsmul_1 177MULFUNC_popcount= popham 178MULFUNC_hamdist= popham 179MULFUNC_and_n= logops_n 180MULFUNC_andn_n= logops_n 181MULFUNC_nand_n= logops_n 182MULFUNC_ior_n= logops_n 183MULFUNC_iorn_n= logops_n 184MULFUNC_nior_n= logops_n 185MULFUNC_xor_n= logops_n 186MULFUNC_xnor_n= logops_n 187MULFUNC_lshift= lorrshift 188MULFUNC_rshift= lorrshift 189MULFUNC_addlsh1_n= aorslsh1_n 190MULFUNC_sublsh1_n= aorslsh1_n 191MULFUNC_rsh1add_n= rsh1aors_n 192MULFUNC_rsh1sub_n= rsh1aors_n 193 194 195U= 196extra_functions= 197LO_OBJECTS= ${MPF_OBJECTS} ${MPZ_OBJECTS} ${MPQ_OBJECTS} ${MPN_OBJECTS} \ 198 ${PRINTF_OBJECTS} ${SCANF_OBJECTS} 199 200.for func in ${gmp_mpn_functions} 201.for mapfunc in ${func} ${MULFUNC_${func}} 202.for mapsource in mpn/generic/${mapfunc}.c 203.for source in mpn/generic/${func}.c 204.if exists(${mapsource}) && empty(MPNSRC:M${source}) 205 206.if !exists(${source}) 207${source}: ${mapsource} mkdirs 208 cp ${.ALLSRC:Nmkdirs} ${.TARGET} 209CLEANFILES+= ${source} 210.ORDER: mkdirs ${source} 211.endif 212 213MPNSRC+= ${source} 214${source:.c=.o}: ${source} 215 ${CC} -o ${.TARGET} ${CFLAGS} -DOPERATION_${func} -c ${.ALLSRC} 216.endif 217.endfor 218.endfor 219.endfor 220.endfor 221 222SRCS= ${LO_OBJECTS:.lo=.c} ${libgmp_la_SOURCES} ${MPNSRC} 223SRCS+= tal-reent.c 224 225# the following are generated sources, so we have to add them 226# explicitly to SRCS 227GENSRC= fac_ui.h fib_table.h mpn/fib_table.c mp_bases.h perfsqr.h 228GENSRC+= trialdivtab.h 229SRCS+= ${GENSRC} 230CLEANFILES+= ${GENSRC} 231 232 233fac_ui.h: gen-fac_ui.nx 234 ${.OBJDIR}/gen-fac_ui.nx ${LONG_INT_BITS} 0 > ${.TARGET} 235 236fib_table.h: gen-fib.nx 237 ${.OBJDIR}/gen-fib.nx header ${LONG_INT_BITS} 0 > ${.TARGET} 238 239mpn/fib_table.c: gen-fib.nx 240 ${.OBJDIR}/gen-fib.nx table ${LONG_INT_BITS} 0 > ${.TARGET} 241 242mp_bases.h: gen-bases.nx 243 ${.OBJDIR}/gen-bases.nx header ${LONG_INT_BITS} 0 > ${.TARGET} 244 245mpn/mp_bases.c: gen-bases.nx 246 ${.OBJDIR}/gen-bases.nx table ${LONG_INT_BITS} 0 > ${.TARGET} 247 248perfsqr.h: gen-psqr.nx 249 ${.OBJDIR}/gen-psqr.nx ${LONG_INT_BITS} 0 > ${.TARGET} 250 251trialdivtab.h: gen-trialdivtab.nx 252 ${.OBJDIR}/gen-trialdivtab.nx $(LONG_INT_BITS) 8000 > ${.TARGET} 253 254.for _gen in fac_ui fib bases psqr trialdivtab 255gen-${_gen}.nx: gen-${_gen}.c dumbmp.c 256 ${NXCC} ${.ALLSRC:M*/gen-*} -o ${.TARGET} -lm 257CLEANFILES+= gen-${_gen}.nx 258.endfor 259 260GENDIRS= mpf mpz mpq mpn mpn/generic printf scanf 261CLEANDIRS+= ${GENDIRS} 262beforedepend: mkdirs 263mkdirs: 264 mkdir -p ${GENDIRS} 265 266.include <bsd.lib.mk> 267