blob: 96dc9fc87cc2a35ae8a8fe3132e185cfc4a272d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
#
# $FreeBSD$
#
LIB= mp
GMPDIR= ${.CURDIR}/../../../contrib/libgmp
.if ${MACHINE_ARCH} == "alpha"
.PATH: ${GMPDIR} ${GMPDIR}/mpn ${GMPDIR}/mpn/alpha ${GMPDIR}/mpn/generic \
${GMPDIR}/mpbsd
CFLAGS+= -I${GMPDIR}/mpn/alpha -I${GMPDIR}/mpz -DBERKELEY_MP
MPN_SRC_ASM= add_n.s addmul_1.s lshift.s mul_1.s rshift.s sub_n.s submul_1.s udiv_qrnnd.S
.elif ${MACHINE_ARCH} == "i386"
.PATH: ${GMPDIR} ${GMPDIR}/mpn ${GMPDIR}/mpn/x86 ${GMPDIR}/mpn/generic \
${GMPDIR}/mpbsd
CFLAGS+= -I${GMPDIR}/mpn/x86 -I${GMPDIR}/mpz -DBERKELEY_MP
MPN_SRC_ASM= add_n.S addmul_1.S lshift.S mul_1.S rshift.S sub_n.S submul_1.S
.elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb"
.PATH: ${GMPDIR} ${GMPDIR}/mpn ${GMPDIR}/mpn/mips3 ${GMPDIR}/mpn/generic \
${GMPDIR}/mpbsd
CFLAGS+= -I${GMPDIR}/mpn/mips3 -I${GMPDIR}/mpz -DBERKELEY_MP
MPN_SRC_ASM= add_n.s addmul_1.s lshift.s mul_1.s rshift.s sub_n.s submul_1.s
.elif ${MACHINE_ARCH} == "m68k"
.PATH: ${GMPDIR} ${GMPDIR}/mpn ${GMPDIR}/mpn/m68k ${GMPDIR}/mpn/generic \
${GMPDIR}/mpbsd
CFLAGS+= -I${GMPDIR}/mpn/m68k -I${GMPDIR}/mpz -DBERKELEY_MP
MPN_SRC_ASM= add_n.S lshift.S rshift.S sub_n.S
.elif ${MACHINE_ARCH} == "arm32" || ${MACHINE_ARCH} == "ia64" || ${MACHINE_ARCH} == "ppc" || ${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64"
.PATH: ${GMPDIR} ${GMPDIR}/mpn ${GMPDIR}/mpn/generic ${GMPDIR}/mpbsd
CFLAGS+= -I${GMPDIR}/mpz -DBERKELEY_MP
MPN_SRC_ASM=
.endif
CFLAGS+= -I${GMPDIR} -I${GMPDIR}/mpn/generic
MPN_SRC_C= add_n.c addmul_1.c bdivmod.c cmp.c divmod_1.c divrem.c \
divrem_1.c dump.c gcd.c gcd_1.c gcdext.c get_str.c hamdist.c \
inlines.c lshift.c mod_1.c mul.c mul_1.c mul_n.c perfsqr.c \
popcount.c pre_mod_1.c random2.c rshift.c scan0.c scan1.c \
set_str.c sqrtrem.c mp_bases.c
MPBSD_LINKS= mpz/add.c mpz/cmp.c mpz/gcd.c mpz/mul.c mpz/pow_ui.c \
mpz/powm.c mpz/sqrtrem.c mpz/sub.c mpz/realloc.c
MPBSD_SRCS= itom.c mdiv.c mfree.c min.c mout.c move.c mtox.c sdiv.c xtom.c \
realloc.c $(MPBSD_LINKS)
SRCS= memory.c mp_set_fns.c mp_clz_tab.c version.c stack-alloc.c \
mp_bpl.c extract-double.c insert-double.c \
${MPN_SRC_ASM} \
asm-syntax.h sysdep.h
# Look though the generic C source for names that don't have assembly
# source version.
.for _src in ${MPN_SRC_C}
.if (${MPN_SRC_ASM:R:M${_src:R}} == "")
SRCS+=$(_src)
.endif
.endfor
SRCS+= ${MPBSD_SRCS}
beforedepend all: mpz
.if defined(OBJFORMAT) && ${OBJFORMAT} == elf
sysdep.h: ${GMPDIR}/mpn/sysv.h
cp ${GMPDIR}/mpn/sysv.h sysdep.h
asm-syntax.h:
(echo "#define ELF_SYNTAX" ; \
echo "#include \"syntax.h\"") > asm-syntax.h
.else
sysdep.h: ${GMPDIR}/mpn/bsd.h
cp ${GMPDIR}/mpn/bsd.h sysdep.h
asm-syntax.h:
(echo "#define BSD_SYNTAX" ; \
echo "#include \"syntax.h\"") > asm-syntax.h
CFLAGS+= -DBROKEN_ALIGN
.endif
CLEANFILES+= sysdep.h asm-syntax.h
# Grrr. This package contains modules in separate subdirs that have the
# same name. Nasty hack to keep them from being found by being in
# .PATH:s
#
mpz:
mkdir ${.TARGET}
CLEANDIRS+= ${.OBJDIR}/mpz ${.CURDIR}/mpz
beforeinstall:
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
${GMPDIR}/mp.h ${DESTDIR}/usr/include
.include "../libgmp/Makefile.inc"
.include <bsd.lib.mk>
|