head	1.36;
access;
symbols
	netbsd-11-0-RC4:1.35
	netbsd-11-0-RC3:1.35
	netbsd-11-0-RC2:1.35
	netbsd-11-0-RC1:1.35
	perseant-exfatfs-base-20250801:1.35
	netbsd-11:1.35.0.2
	netbsd-11-base:1.35
	netbsd-10-1-RELEASE:1.34
	perseant-exfatfs-base-20240630:1.34
	perseant-exfatfs:1.34.0.4
	perseant-exfatfs-base:1.34
	netbsd-8-3-RELEASE:1.25
	netbsd-9-4-RELEASE:1.28
	netbsd-10-0-RELEASE:1.34
	netbsd-10-0-RC6:1.34
	netbsd-10-0-RC5:1.34
	netbsd-10-0-RC4:1.34
	netbsd-10-0-RC3:1.34
	netbsd-10-0-RC2:1.34
	netbsd-10-0-RC1:1.34
	netbsd-10:1.34.0.2
	netbsd-10-base:1.34
	netbsd-9-3-RELEASE:1.28
	cjep_sun2x-base1:1.28
	cjep_sun2x:1.28.0.8
	cjep_sun2x-base:1.28
	cjep_staticlib_x-base1:1.28
	netbsd-9-2-RELEASE:1.28
	cjep_staticlib_x:1.28.0.6
	cjep_staticlib_x-base:1.28
	netbsd-9-1-RELEASE:1.28
	phil-wifi-20200421:1.28
	phil-wifi-20200411:1.28
	is-mlppp:1.28.0.4
	is-mlppp-base:1.28
	phil-wifi-20200406:1.28
	netbsd-8-2-RELEASE:1.25
	netbsd-9-0-RELEASE:1.28
	netbsd-9-0-RC2:1.28
	netbsd-9-0-RC1:1.28
	phil-wifi-20191119:1.28
	netbsd-9:1.28.0.2
	netbsd-9-base:1.28
	phil-wifi-20190609:1.28
	netbsd-8-1-RELEASE:1.25
	netbsd-8-1-RC1:1.25
	pgoyette-compat-merge-20190127:1.27.2.1
	pgoyette-compat-20190127:1.28
	pgoyette-compat-20190118:1.28
	pgoyette-compat-1226:1.28
	pgoyette-compat-1126:1.28
	pgoyette-compat-1020:1.28
	pgoyette-compat-0930:1.28
	pgoyette-compat-0906:1.28
	netbsd-7-2-RELEASE:1.24
	pgoyette-compat-0728:1.27
	netbsd-8-0-RELEASE:1.25
	phil-wifi:1.27.0.4
	phil-wifi-base:1.27
	pgoyette-compat-0625:1.27
	netbsd-8-0-RC2:1.25
	pgoyette-compat-0521:1.27
	pgoyette-compat-0502:1.27
	pgoyette-compat-0422:1.27
	netbsd-8-0-RC1:1.25
	pgoyette-compat-0415:1.27
	pgoyette-compat-0407:1.27
	pgoyette-compat-0330:1.27
	pgoyette-compat-0322:1.27
	pgoyette-compat-0315:1.27
	netbsd-7-1-2-RELEASE:1.24
	pgoyette-compat:1.27.0.2
	pgoyette-compat-base:1.27
	netbsd-7-1-1-RELEASE:1.24
	matt-nb8-mediatek:1.25.0.12
	matt-nb8-mediatek-base:1.25
	perseant-stdc-iso10646:1.25.0.10
	perseant-stdc-iso10646-base:1.25
	netbsd-8:1.25.0.8
	netbsd-8-base:1.25
	prg-localcount2-base3:1.25
	prg-localcount2-base2:1.25
	prg-localcount2-base1:1.25
	prg-localcount2:1.25.0.6
	prg-localcount2-base:1.25
	pgoyette-localcount-20170426:1.25
	bouyer-socketcan-base1:1.25
	pgoyette-localcount-20170320:1.25
	netbsd-7-1:1.24.0.10
	netbsd-7-1-RELEASE:1.24
	netbsd-7-1-RC2:1.24
	netbsd-7-nhusb-base-20170116:1.24
	bouyer-socketcan:1.25.0.4
	bouyer-socketcan-base:1.25
	pgoyette-localcount-20170107:1.25
	netbsd-7-1-RC1:1.24
	pgoyette-localcount-20161104:1.25
	netbsd-7-0-2-RELEASE:1.24
	localcount-20160914:1.25
	netbsd-7-nhusb:1.24.0.8
	netbsd-7-nhusb-base:1.24
	pgoyette-localcount-20160806:1.25
	pgoyette-localcount-20160726:1.25
	pgoyette-localcount:1.25.0.2
	pgoyette-localcount-base:1.25
	netbsd-7-0-1-RELEASE:1.24
	netbsd-7-0:1.24.0.6
	netbsd-7-0-RELEASE:1.24
	netbsd-7-0-RC3:1.24
	netbsd-7-0-RC2:1.24
	netbsd-7-0-RC1:1.24
	netbsd-6-0-6-RELEASE:1.12
	netbsd-6-1-5-RELEASE:1.12
	netbsd-7:1.24.0.4
	netbsd-7-base:1.24
	yamt-pagecache-base9:1.24
	yamt-pagecache-tag8:1.12.2.2
	netbsd-6-1-4-RELEASE:1.12
	netbsd-6-0-5-RELEASE:1.12
	tls-earlyentropy:1.24.0.2
	tls-earlyentropy-base:1.24
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.24
	riastradh-drm2-base3:1.24
	netbsd-6-1-3-RELEASE:1.12
	netbsd-6-0-4-RELEASE:1.12
	netbsd-6-1-2-RELEASE:1.12
	netbsd-6-0-3-RELEASE:1.12
	netbsd-6-1-1-RELEASE:1.12
	riastradh-drm2-base2:1.14
	riastradh-drm2-base1:1.14
	riastradh-drm2:1.14.0.2
	riastradh-drm2-base:1.14
	netbsd-6-1:1.12.0.10
	netbsd-6-0-2-RELEASE:1.12
	netbsd-6-1-RELEASE:1.12
	netbsd-6-1-RC4:1.12
	netbsd-6-1-RC3:1.12
	agc-symver:1.14.0.4
	agc-symver-base:1.14
	netbsd-6-1-RC2:1.12
	netbsd-6-1-RC1:1.12
	yamt-pagecache-base8:1.14
	netbsd-6-0-1-RELEASE:1.12
	yamt-pagecache-base7:1.14
	matt-nb6-plus-nbase:1.12
	yamt-pagecache-base6:1.13
	netbsd-6-0:1.12.0.8
	netbsd-6-0-RELEASE:1.12
	netbsd-6-0-RC2:1.12
	tls-maxphys:1.13.0.2
	tls-maxphys-base:1.24
	matt-nb6-plus:1.12.0.6
	matt-nb6-plus-base:1.12
	netbsd-6-0-RC1:1.12
	yamt-pagecache-base5:1.12
	yamt-pagecache-base4:1.12
	netbsd-6:1.12.0.4
	netbsd-6-base:1.12
	yamt-pagecache-base3:1.12
	yamt-pagecache-base2:1.12
	yamt-pagecache:1.12.0.2
	yamt-pagecache-base:1.12;
locks; strict;
comment	@# @;


1.36
date	2026.04.18.21.19.15;	author rillig;	state Exp;
branches;
next	1.35;
commitid	9M6I2d5l7RifauCG;

1.35
date	2025.04.06.23.03.05;	author rillig;	state Exp;
branches;
next	1.34;
commitid	19bgwc0qOk34R2QF;

1.34
date	2021.12.07.19.14.05;	author rillig;	state Exp;
branches
	1.34.4.1;
next	1.33;
commitid	cgURTu3dGc7yGKjD;

1.33
date	2021.12.07.19.12.54;	author rillig;	state Exp;
branches;
next	1.32;
commitid	vR53DqjzhXaMFKjD;

1.32
date	2021.12.07.19.04.27;	author rillig;	state Exp;
branches;
next	1.31;
commitid	LrEHNaLhRBEZCKjD;

1.31
date	2021.12.06.23.07.49;	author rillig;	state Exp;
branches;
next	1.30;
commitid	Ree7Ou0QxrEB0EjD;

1.30
date	2021.12.06.23.05.36;	author rillig;	state Exp;
branches;
next	1.29;
commitid	kzf66ZnC9bt1ZDjD;

1.29
date	2021.09.18.01.47.10;	author christos;	state Exp;
branches;
next	1.28;
commitid	NKw39S32w03lsn9D;

1.28
date	2018.09.04.06.09.31;	author mrg;	state Exp;
branches;
next	1.27;
commitid	ddyF7AD9uY6VAKQA;

1.27
date	2017.08.22.09.59.37;	author mrg;	state Exp;
branches
	1.27.2.1
	1.27.4.1;
next	1.26;
commitid	H9HFyQz0W7BD0c4A;

1.26
date	2017.08.22.09.17.50;	author mrg;	state Exp;
branches;
next	1.25;
commitid	Ec79w0Jbdz0CMb4A;

1.25
date	2016.04.12.19.38.41;	author christos;	state Exp;
branches;
next	1.24;
commitid	Kb9DVJUr3Uco9n2z;

1.24
date	2013.12.19.01.07.03;	author gdt;	state Exp;
branches;
next	1.23;
commitid	ihdXwI3okhU0dGhx;

1.23
date	2013.12.04.00.57.21;	author mrg;	state Exp;
branches;
next	1.22;
commitid	5T9gzjztOgkyDKfx;

1.22
date	2013.12.04.00.49.17;	author mrg;	state Exp;
branches;
next	1.21;
commitid	tOU2KELhQkDHAKfx;

1.21
date	2013.12.01.09.29.37;	author martin;	state Exp;
branches;
next	1.20;
commitid	IiymSczIuBcgzpfx;

1.20
date	2013.11.30.23.45.05;	author wiz;	state Exp;
branches;
next	1.19;
commitid	xioqkolqIc8Ikmfx;

1.19
date	2013.11.29.14.51.36;	author martin;	state Exp;
branches;
next	1.18;
commitid	R8498rfMSCRDpbfx;

1.18
date	2013.11.29.08.03.41;	author mrg;	state Exp;
branches;
next	1.17;
commitid	AEwwBnUtwLxB99fx;

1.17
date	2013.08.19.22.25.32;	author matt;	state Exp;
branches;
next	1.16;
commitid	Nd2Pvn1at7Klc72x;

1.16
date	2013.08.06.05.35.57;	author matt;	state Exp;
branches;
next	1.15;
commitid	QjsiTdEOqdxe2m0x;

1.15
date	2013.08.04.23.37.54;	author matt;	state Exp;
branches;
next	1.14;
commitid	nXwIsBlyTEoX4c0x;

1.14
date	2012.11.26.18.57.33;	author drochner;	state Exp;
branches;
next	1.13;

1.13
date	2012.08.10.16.05.26;	author joerg;	state Exp;
branches
	1.13.2.1;
next	1.12;

1.12
date	2011.09.21.02.06.42;	author mrg;	state Exp;
branches
	1.12.2.1;
next	1.11;

1.11
date	2011.08.09.13.01.34;	author joerg;	state Exp;
branches;
next	1.10;

1.10
date	2011.07.21.03.13.30;	author mrg;	state Exp;
branches;
next	1.9;

1.9
date	2011.07.18.16.55.49;	author tron;	state Exp;
branches;
next	1.8;

1.8
date	2011.07.04.12.00.15;	author mrg;	state Exp;
branches;
next	1.7;

1.7
date	2011.07.03.15.25.11;	author mrg;	state Exp;
branches;
next	1.6;

1.6
date	2011.07.02.14.04.30;	author mrg;	state Exp;
branches;
next	1.5;

1.5
date	2011.07.01.01.30.16;	author mrg;	state Exp;
branches;
next	1.4;

1.4
date	2011.06.29.08.09.43;	author mrg;	state Exp;
branches;
next	1.3;

1.3
date	2011.06.24.03.50.23;	author mrg;	state Exp;
branches;
next	1.2;

1.2
date	2011.06.23.12.09.30;	author mrg;	state Exp;
branches;
next	1.1;

1.1
date	2011.06.21.04.23.56;	author mrg;	state Exp;
branches;
next	;

1.34.4.1
date	2025.08.02.05.50.22;	author perseant;	state Exp;
branches;
next	;
commitid	23j6GFaDws3O875G;

1.27.2.1
date	2018.09.06.06.53.43;	author pgoyette;	state Exp;
branches;
next	;
commitid	HCi1bXD317XIK0RA;

1.27.4.1
date	2019.06.10.22.02.23;	author christos;	state Exp;
branches;
next	;
commitid	jtc8rnCzWiEEHGqB;

1.13.2.1
date	2013.02.25.00.27.34;	author tls;	state Exp;
branches;
next	1.13.2.2;

1.13.2.2
date	2014.08.19.23.59.59;	author tls;	state Exp;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.12.2.1
date	2012.10.30.18.58.07;	author yamt;	state Exp;
branches;
next	1.12.2.2;

1.12.2.2
date	2013.01.16.05.28.05;	author yamt;	state Exp;
branches;
next	1.12.2.3;

1.12.2.3
date	2014.05.22.14.09.10;	author yamt;	state Exp;
branches;
next	;
commitid	nx2BSsHy0NPeAxBx;


desc
@@


1.36
log
@libgmp: suppress the most common lint warnings

Lint no longer issues warning 259 about prototypes, as that warning is
only useful when migrating from traditional C to C90. In other
scenarios, warning 298 about loss of accuracy has taken its place.
@
text
@#	$NetBSD: Makefile,v 1.35 2025/04/06 23:03:05 rillig Exp $

.include <bsd.init.mk>

# We don't install gmp, just provide it for GCC.
LIBISPRIVATE?=	yes

.include "../../Makefile.arch"

.if ${LIBISPRIVATE} != "yes"
INCS=         gmp.h
INCSDIR=      /usr/include
.endif

DIST=${.CURDIR}/../../dist

LIB=	gmp

MPF_SRCS = \
	init.c init2.c inits.c set.c			\
	set_ui.c set_si.c set_str.c set_d.c		\
	set_z.c iset.c iset_ui.c iset_si.c		\
	iset_str.c iset_d.c clear.c clears.c		\
	get_str.c dump.c size.c eq.c reldiff.c		\
	sqrt.c random2.c inp_str.c out_str.c		\
	add.c add_ui.c sub.c sub_ui.c ui_sub.c		\
	mul.c mul_ui.c div.c div_ui.c			\
	cmp.c cmp_d.c cmp_ui.c cmp_si.c cmp_z.c		\
	mul_2exp.c div_2exp.c abs.c neg.c		\
	set_q.c get_d.c get_d_2exp.c set_dfl_prec.c	\
	set_prc.c set_prc_raw.c get_dfl_prec.c		\
	get_prc.c ui_div.c sqrt_ui.c			\
	ceilfloor.c trunc.c pow_ui.c			\
	urandomb.c swap.c				\
	fits_sint.c fits_slong.c fits_sshort.c		\
	fits_uint.c fits_ulong.c fits_ushort.c		\
	get_si.c get_ui.c				\
	int_p.c

MPZ_SRCS = \
	abs.c add.c add_ui.c				\
	aorsmul.c aorsmul_i.c and.c array_init.c	\
	bin_ui.c bin_uiui.c				\
	cdiv_q.c cdiv_q_ui.c				\
	cdiv_qr.c cdiv_qr_ui.c				\
	cdiv_r.c cdiv_r_ui.c cdiv_ui.c			\
	cfdiv_q_2exp.c cfdiv_r_2exp.c			\
	clear.c clears.c clrbit.c			\
	cmp.c cmp_d.c cmp_si.c cmp_ui.c			\
	cmpabs.c cmpabs_d.c cmpabs_ui.c			\
	com.c combit.c					\
	cong.c cong_2exp.c cong_ui.c			\
	divexact.c divegcd.c dive_ui.c			\
	divis.c divis_ui.c divis_2exp.c dump.c		\
	export.c fac_ui.c fdiv_q.c			\
	fdiv_q_ui.c fdiv_qr.c fdiv_qr_ui.c		\
	fdiv_r.c fdiv_r_ui.c				\
	fdiv_ui.c fib_ui.c fib2_ui.c fits_sint.c	\
	fits_slong.c fits_sshort.c fits_uint.c		\
	fits_ulong.c fits_ushort.c gcd.c		\
	gcd_ui.c gcdext.c get_d.c get_d_2exp.c		\
	get_si.c get_str.c get_ui.c getlimbn.c		\
	hamdist.c					\
	import.c init.c init2.c inits.c 		\
	inp_raw.c inp_str.c invert.c			\
	ior.c iset.c iset_d.c iset_si.c			\
	iset_str.c iset_ui.c jacobi.c kronsz.c		\
	kronuz.c kronzs.c kronzu.c			\
	limbs_finish.c limbs_modify.c			\
	limbs_read.c limbs_write.c			\
	lcm.c lcm_ui.c lucnum_ui.c lucnum2_ui.c		\
	millerrabin.c mod.c mul.c mul_2exp.c		\
	mul_si.c mul_ui.c				\
	n_pow_ui.c neg.c nextprime.c			\
	oddfac_1.c					\
	out_raw.c out_str.c perfpow.c perfsqr.c		\
	popcount.c pow_ui.c powm.c			\
	powm_ui.c pprime_p.c 				\
	prodlimbs.c					\
	random.c random2.c				\
	realloc.c realloc2.c remove.c			\
	roinit_n.c					\
	root.c rootrem.c rrandomb.c scan0.c		\
	scan1.c set.c set_d.c set_f.c			\
	set_q.c set_si.c set_str.c set_ui.c		\
	setbit.c					\
	size.c sizeinbase.c sqrt.c			\
	sqrtrem.c sub.c sub_ui.c swap.c			\
	tdiv_ui.c tdiv_q.c tdiv_q_2exp.c		\
	tdiv_q_ui.c tdiv_qr.c tdiv_qr_ui.c		\
	tdiv_r.c tdiv_r_2exp.c tdiv_r_ui.c		\
	tstbit.c ui_pow_ui.c ui_sub.c urandomb.c	\
	urandomm.c xor.c

MPQ_SRCS = \
	abs.c aors.c					\
	canonicalize.c clear.c clears.c			\
	cmp.c cmp_si.c cmp_ui.c div.c			\
	get_d.c get_den.c get_num.c get_str.c		\
	init.c inits.c inp_str.c inv.c			\
	md_2exp.c mul.c neg.c out_str.c			\
	set.c set_den.c set_num.c			\
	set_si.c set_str.c set_ui.c			\
	equal.c set_z.c set_d.c				\
	set_f.c swap.c

PRINTF_SRCS =						\
	asprintf.c asprntffuns.c			\
	doprnt.c doprntf.c doprnti.c			\
	fprintf.c					\
	obprintf.c obvprintf.c obprntffuns.c		\
	printf.c printffuns.c				\
	snprintf.c snprntffuns.c			\
	sprintf.c sprintffuns.c				\
	vasprintf.c vfprintf.c vprintf.c		\
	vsnprintf.c vsprintf.c				\
	repl-vsnprintf.c

SCANF_SRCS =						\
	doscan.c fscanf.c fscanffuns.c			\
	scanf.c sscanf.c sscanffuns.c			\
	vfscanf.c vscanf.c vsscanf.c

.include "${.CURDIR}/arch/${GMP_MACHINE_ARCH}/Makefile.inc"

SRCS+= 									\
	assert.c compat.c errno.c extract-dbl.c invalid.c memory.c	\
	mp_bpl.c mp_clz_tab.c mp_dv_tab.c mp_minv_tab.c mp_get_fns.c	\
	mp_set_fns.c randclr.c randdef.c randiset.c randlc2s.c 	\
	randlc2x.c randmt.c randmts.c rands.c randsd.c randsdui.c 	\
	randbui.c randmui.c version.c nextprime.c primesieve.c

SRCS+=	tal-reent.c

# these are generated
SRCS+=	fib_table.c mp_bases.c

# Build the files that may have multiple identical base names under
# different names.
.for _dir _srcfile in \
	${MPF_SRCS:C/^/mpf /} \
	${MPZ_SRCS:C/^/mpz /} \
	${MPQ_SRCS:C/^/mpq /} \
	${PRINTF_SRCS:C/^/printf /} \
	${SCANF_SRCS:C/^/scanf /}
${_dir}_${_srcfile}: #Makefile
	echo '#include "'${_dir}/${_srcfile}'"' > ${.TARGET}

SRCS+=		${_dir}_${_srcfile}
CLEANFILES+=	${_dir}_${_srcfile}

.endfor

CPPFLAGS+=	-I. -I${DIST} -I${.CURDIR}/arch/${GMP_MACHINE_ARCH} \
		-D__GMP_WITHIN_GMP -DHAVE_CONFIG_H

WITHOUT_MAN=	yes

DPSRCS= fac_table.h fib_table.h fib_table.c jacobitab.h mp_bases.h \
	mp_bases.c perfsqr.h trialdivtab.h

gen-fac: gen-fac.c
	${HOST_CC} ${HOST_CPPFLAGS} -o ${.OBJDIR}/gen-fac ${.ALLSRC}

fac_table.h: gen-fac
	${.OBJDIR}/gen-fac ${GMP_LIMB_BITS} 0 > ${.OBJDIR}/fac_table.h

gen-fib: gen-fib.c
	${HOST_CC} ${HOST_CPPFLAGS} -o ${.OBJDIR}/gen-fib ${.ALLSRC}

fib_table.h: gen-fib
	${.OBJDIR}/gen-fib header ${GMP_LIMB_BITS} 0 > ${.OBJDIR}/fib_table.h

fib_table.c: gen-fib
	${.OBJDIR}/gen-fib table ${GMP_LIMB_BITS} 0 > ${.OBJDIR}/fib_table.c

gen-bases: gen-bases.c
	${HOST_CC} ${HOST_CPPFLAGS} -o ${.OBJDIR}/gen-bases ${.ALLSRC} -lm

mp_bases.h: gen-bases
	${.OBJDIR}/gen-bases header ${GMP_LIMB_BITS} 0 > ${.OBJDIR}/mp_bases.h

mp_bases.c: gen-bases
	${.OBJDIR}/gen-bases table ${GMP_LIMB_BITS} 0 > ${.OBJDIR}/mp_bases.c

gen-jacobitab: gen-jacobitab.c
	${HOST_CC} ${HOST_CPPFLAGS} -o ${.OBJDIR}/gen-jacobitab ${.ALLSRC} -lm

jacobitab.h: gen-jacobitab
	${.OBJDIR}/gen-jacobitab > ${.OBJDIR}/jacobitab.h

perfsqr.h: gen-psqr.c
	${HOST_CC} ${HOST_CPPFLAGS} -o ${.OBJDIR}/gen-psqr ${.ALLSRC}
	${.OBJDIR}/gen-psqr ${GMP_LIMB_BITS} 0 > ${.OBJDIR}/perfsqr.h

gen-trialdivtab: gen-trialdivtab.c
	${HOST_CC} ${HOST_CPPFLAGS} -o ${.OBJDIR}/gen-trialdivtab ${.ALLSRC} -lm

trialdiv.c: trialdivtab.h
trialdivtab.h: gen-trialdivtab Makefile
	${.OBJDIR}/gen-trialdivtab $(GMP_LIMB_BITS) 8000 > ${.OBJDIR}/trialdivtab.h

CLEANFILES+=	${DPSRCS} gen-fac gen-fib gen-bases gen-jacobitab \
		gen-psqr gen-trialdivtab

# Makefile.inc must define GMP_LIMB_BITS.
.if !defined(GMP_LIMB_BITS)
.BEGIN:
	@@echo "GMP_LIMB_BITS not defined!"
	false
.endif

# XXX stuff looks for "../config.m4"
dummy:
	mkdir dummy
${.OBJDIR}/config.m4: ${.CURDIR}/arch/${GMP_MACHINE_ARCH}/config.m4
	rm -f ${.OBJDIR}/config.m4 && cp ${.CURDIR}/arch/${GMP_MACHINE_ARCH}/config.m4 ${.OBJDIR}/config.m4

CLEANFILES+=	config.m4
clean: cleandummy
cleandummy: .PHONY
	-if [ -d dummy ]; then rmdir dummy; fi

BUILD_S_INCS=	-I${.CURDIR} -I${.OBJDIR}/dummy -I${DIST}/ -I${DIST}/mpn \
		-I${.OBJDIR}

.for _build _src in ${ASM_SRCS_LIST}
${_build:R}.s: Makefile dummy ${.OBJDIR}/config.m4 ${DIST}/${_src}
	${TOOL_M4} -DCONFIG_TOP_SRCDIR=${DIST} ${BUILD_S_INCS} \
		${M4FLAGS} ${M4FLAGS.${.TARGET:R}} \
		-DOPERATION_${.TARGET:R} ${DIST}/${_src} > ${.TARGET}

SRCS+=		${_build:R}.s
CLEANFILES+=	${_build:R}.s
.endfor

.for _build _src in ${C_SRCS_LIST}
mpn_${_build}: Makefile
	echo '#include "${_src}"' > ${.TARGET}

CPPFLAGS.mpn_${_build}+= -DOPERATION_${_build:R}

SRCS+=		mpn_${_build}
CLEANFILES+=	mpn_${_build}
.endfor

.include <bsd.lib.mk>

.PATH:	${DIST} \
	${DIST}/rand \
	${DIST}/mpn/generic \
	${.CURDIR}/arch/${GMP_MACHINE_ARCH} \
	${DIST}/mpf \
	${DIST}/mpz

# Don't warn about functions which cannot be stack smash protected as
# there are a lot of them.
COPTS += -Wno-stack-protector
.if !empty(GMP_MACHINE_ARCH:M*arm*)
COPTS += -marm
.endif

CWARNFLAGS.clang+=	-Wno-unused-value -Wno-tautological-compare -Wno-parentheses

.if !empty(CFLAGS:M-fPIE)
M4FLAGS+=-DPIC
.endif

# many places in gmp-impl.h: warning: bitwise '>>' on signed value possibly nonportable [117]
LINTFLAGS+=	-X 117
# many places: warning: conversion from 'long' to 'int' may lose accuracy [132]
LINTFLAGS+=	-X 132
# many places: warning: conversion from 'unsigned long' to 'unsigned int' may lose accuracy, arg #1 [298]
LINTFLAGS+=	-X 298
@


1.35
log
@all: remove 'constant in conditional context' from LINTFLAGS

Lint no longer emits this message, as it produced too many false
positives.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.34 2021/12/07 19:14:05 rillig Exp $
d269 1
a269 1
# gmp-impl.h(5187): warning: bitwise '>>' on signed value possibly nonportable [117]
d271 1
a271 1
# com.c(67): warning: conversion from 'long' to 'int' may lose accuracy [132]
d273 2
a274 2
# gcd.c(101): warning: argument #4 is converted from 'unsigned long' to 'unsigned int' due to prototype [259]
LINTFLAGS+=	-X 259
@


1.34
log
@libgmp: remove trailing whitespace
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.33 2021/12/07 19:12:54 rillig Exp $
a268 2
# gmp-impl.h(5172): warning: constant in conditional context [161]
LINTFLAGS+=	-X 161
@


1.34.4.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.35 2025/04/06 23:03:05 rillig Exp $
d269 2
@


1.33
log
@libgmp: suppress lint warnings about int/size_t mismatch

The cases where numbers have 4 GB of precision are probably rare.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.32 2021/12/07 19:04:27 rillig Exp $
d243 2
a244 2
SRCS+=		mpn_${_build}   
CLEANFILES+=	mpn_${_build}   
@


1.32
log
@libgmp: clean up LINTFLAGS

Now that gmp-impl.h includes <stdlib.h>, defining alloca is no longer
necessary.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.31 2021/12/06 23:07:49 rillig Exp $
d273 4
@


1.31
log
@libgmp: fix unwarranted ignored error on 'make clean'

rmdir: dummy: No such file or directory
*** Error code 1 (ignored)
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.30 2021/12/06 23:05:36 rillig Exp $
a268 2
# redc_n.c(62): error: function 'alloca' implicitly declared to return int [215]
LINTFLAGS+=	-Dalloca=__builtin_alloca
@


1.30
log
@libgmp: suppress a few lint warnings

Instead of erroring out due to the unknown function alloca, lint now
warns about a pointer/integer mismatch since it wrongly assumes that all
__builtin functions return int. The warning is still better than a
failing build though.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.29 2021/09/18 01:47:10 christos Exp $
d222 1
a222 1
	-rmdir dummy
@


1.29
log
@Patch the build script and toolchain to allow passing through
HOST_CPPFLAGS, HOST_CXXFLAGS, but not LIBRARY_PATH because it breaks
the build. These variables are necessary to support building NetBSD
from a GNU Guix or NixOS host, where /usr/include, /lib, and all
but /bin/sh do not exist.  In many cases, support for HOST_CPPFLAGS
was incomplete. From Ryan Sundberg
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.28 2018/09/04 06:09:31 mrg Exp $
d268 7
@


1.28
log
@add missing sources needed by new mpfr/mpc.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.27 2017/08/22 09:59:37 mrg Exp $
d163 1
a163 1
	${HOST_CC} -o ${.OBJDIR}/gen-fac ${.ALLSRC}
d169 1
a169 1
	${HOST_CC} -o ${.OBJDIR}/gen-fib ${.ALLSRC}
d178 1
a178 1
	${HOST_CC} -o ${.OBJDIR}/gen-bases ${.ALLSRC} -lm
d187 1
a187 1
	${HOST_CC} -o ${.OBJDIR}/gen-jacobitab ${.ALLSRC} -lm
d193 1
a193 1
	${HOST_CC} -o ${.OBJDIR}/gen-psqr ${.ALLSRC}
d197 1
a197 1
	${HOST_CC} -o ${.OBJDIR}/gen-trialdivtab ${.ALLSRC} -lm
@


1.27
log
@updates for GMP 6.1.2 and most platforms.  run tested on i386, amd64,
sparc sparc64, earm, ofppc and mips64eb.  build tested on most.

remove the earm* variants as they're now the same as the arm* ones.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.26 2017/08/22 09:17:50 mrg Exp $
d75 1
d78 3
a80 1
	powm_ui.c pprime_p.c random.c random2.c		\
d131 1
a131 1
	randbui.c randmui.c version.c nextprime.c
@


1.27.4.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.28 2018/09/04 06:09:31 mrg Exp $
a74 1
	oddfac_1.c					\
d77 1
a77 3
	powm_ui.c pprime_p.c 				\
	prodlimbs.c					\
	random.c random2.c				\
d128 1
a128 1
	randbui.c randmui.c version.c nextprime.c primesieve.c
@


1.27.2.1
log
@Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.28 2018/09/04 06:09:31 mrg Exp $
a74 1
	oddfac_1.c					\
d77 1
a77 3
	powm_ui.c pprime_p.c 				\
	prodlimbs.c					\
	random.c random2.c				\
d128 1
a128 1
	randbui.c randmui.c version.c nextprime.c primesieve.c
@


1.26
log
@move the GMP_MACHINE_ARCH definition into external/lgpl3/gmp/Makefile.arch.
soon to be GMP 6 allows us to have only two arm copies.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.25 2016/04/12 19:38:41 christos Exp $
d28 1
a28 1
	cmp.c cmp_d.c cmp_ui.c cmp_si.c			\
d69 2
d76 1
a76 1
	popcount.c pow_ui.c powm.c powm_sec.c		\
d79 1
a103 4
MPN_GENERIC_SRCS = \
	popcount.c \
	hamdist.c

d121 2
a202 2
.include "${.CURDIR}/arch/${GMP_MACHINE_ARCH}/Makefile.inc"

@


1.25
log
@Add -DPIC for PIE builds so that we can avoid text relocations.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.24 2013/12/19 01:07:03 gdt Exp $
d8 1
a8 1
GMP_MACHINE_ARCH?=	${MACHINE_ARCH:S/earmv4/arm/:C/armv[5-7]/arm/}
@


1.24
log
@When copying an .OBJDIR file, rm -f first.

Arguably there should be some general mechanism, but there isn't yet,
and I hit a build failure at

	cp ${.CURDIR}/arch/${GMP_MACHINE_ARCH}/config.m4 ${.OBJDIR}/config.m4

because my source tree is mode 444, and hence my previously-copied
config.m4 was too.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.23 2013/12/04 00:57:21 mrg Exp $
d262 4
@


1.23
log
@make trialdivtab.h depend on the Makefile.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.22 2013/12/04 00:49:17 mrg Exp $
d215 1
a215 1
	cp ${.CURDIR}/arch/${GMP_MACHINE_ARCH}/config.m4 ${.OBJDIR}/config.m4
@


1.22
log
@consolidate the trialdivtab.h generation code.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.21 2013/12/01 09:29:37 martin Exp $
d196 1
a196 1
trialdivtab.h: gen-trialdivtab
@


1.21
log
@Enable warnings on sparc64 again
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.20 2013/11/30 23:45:05 wiz Exp $
d150 2
a151 1
CPPFLAGS+=	-I. -I${DIST} -I${.CURDIR}/arch/${GMP_MACHINE_ARCH} -D__GMP_WITHIN_GMP -DHAVE_CONFIG_H
d155 2
a156 1
DPSRCS= fac_table.h fib_table.h fib_table.c jacobitab.h mp_bases.h mp_bases.c perfsqr.h
d192 2
a193 1
CLEANFILES+=	${DPSRCS} gen-fac gen-fib gen-bases gen-jacobitab gen-psqr gen-trialdivtab
d195 6
d204 7
d222 2
a223 1
BUILD_S_INCS=	-I${.CURDIR} -I${.OBJDIR}/dummy -I${DIST}/ -I${DIST}/mpn -I${.OBJDIR}
@


1.20
log
@Disable parentheses checks since libgmp doesn't pass them.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.19 2013/11/29 14:51:36 martin Exp $
a242 3
.if ${GMP_MACHINE_ARCH} == "sparc64"
NOGCCERROR=yes
.endif
@


1.19
log
@Make warnings non-fatal on sparc64.
Warings reported upstream.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.18 2013/11/29 08:03:41 mrg Exp $
d247 1
a247 1
CWARNFLAGS.clang+=	-Wno-unused-value -Wno-tautological-compare
@


1.18
log
@updates for GMP 5.1.3, and new build files for most platforms.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.17 2013/08/19 22:25:32 matt Exp $
d243 3
@


1.17
log
@always compile GMP and MPFR as ARM
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.16 2013/08/06 05:35:57 matt Exp $
d125 1
a125 1
	mp_set_fns.c rand.c randclr.c randdef.c randiset.c randlc2s.c 	\
d154 1
a154 1
DPSRCS= fac_ui.h fib_table.h fib_table.c mp_bases.h mp_bases.c perfsqr.h
d156 5
a160 3
fac_ui.h: gen-fac_ui.c
	${HOST_CC} -o ${.OBJDIR}/gen-fac_ui ${.ALLSRC}
	${.OBJDIR}/gen-fac_ui ${GMP_LIMB_BITS} 0 > ${.OBJDIR}/fac_ui.h
d180 6
d190 1
a190 1
CLEANFILES+=	${DPSRCS} gen-fac_ui gen-fib gen-bases gen-psqr gen-trialdivtab
d206 1
a206 1
BUILD_S_INCS=	-I${.CURDIR} -I${.OBJDIR}/dummy -I${DIST}/ -I${DIST}/mpn
d209 1
a209 1
${_build:R}.s: Makefile dummy ${.OBJDIR}/config.m4
d231 1
@


1.16
log
@Use armv[4-7] to be consistend
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.15 2013/08/04 23:37:54 matt Exp $
d8 1
a8 1
GMP_MACHINE_ARCH?=	${MACHINE_ARCH:S/earmv4/arm/:C/armv[67]/arm/}
d231 3
@


1.15
log
@If MACHINE_ARCH contains armv[467], use arm instead.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.14 2012/11/26 18:57:33 drochner Exp $
d8 1
a8 1
LIBGMP_MACHINE_ARCH?=	${MACHINE_ARCH:C/armv[467]/arm/}
d150 1
a150 1
CPPFLAGS+=	-I. -I${DIST} -I${.CURDIR}/arch/${LIBGMP_MACHINE_ARCH} -D__GMP_WITHIN_GMP -DHAVE_CONFIG_H
d185 1
a185 1
.include "${.CURDIR}/arch/${LIBGMP_MACHINE_ARCH}/Makefile.inc"
d190 2
a191 2
${.OBJDIR}/config.m4: ${.CURDIR}/arch/${LIBGMP_MACHINE_ARCH}/config.m4
	cp ${.CURDIR}/arch/${LIBGMP_MACHINE_ARCH}/config.m4 ${.OBJDIR}/config.m4
d224 1
a224 1
	${.CURDIR}/arch/${LIBGMP_MACHINE_ARCH} \
@


1.14
log
@collect common rules in the shared Makefile, this propagates the .OBJDIR
fix done for i386 last year to all other ports
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.13 2012/08/10 16:05:26 joerg Exp $
d8 2
d150 1
a150 1
CPPFLAGS+=	-I. -I${DIST} -I${.CURDIR}/arch/${MACHINE_ARCH} -D__GMP_WITHIN_GMP -DHAVE_CONFIG_H
d184 2
a185 1
.include "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.inc"
d190 2
a191 2
${.OBJDIR}/config.m4: ${.CURDIR}/arch/${MACHINE_ARCH}/config.m4
	cp ${.CURDIR}/arch/${MACHINE_ARCH}/config.m4 ${.OBJDIR}/config.m4
d224 1
a224 1
	${.CURDIR}/arch/${MACHINE_ARCH} \
@


1.13
log
@Deal with optional HAVE_GCC.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.12 2011/09/21 02:06:42 mrg Exp $
d184 33
@


1.13.2.1
log
@resync with head
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.13 2012/08/10 16:05:26 joerg Exp $
a183 33
# XXX stuff looks for "../config.m4"
dummy:
	mkdir dummy
${.OBJDIR}/config.m4: ${.CURDIR}/arch/${MACHINE_ARCH}/config.m4
	cp ${.CURDIR}/arch/${MACHINE_ARCH}/config.m4 ${.OBJDIR}/config.m4

CLEANFILES+=	config.m4
clean: cleandummy
cleandummy: .PHONY
	-rmdir dummy

BUILD_S_INCS=	-I${.CURDIR} -I${.OBJDIR}/dummy -I${DIST}/ -I${DIST}/mpn

.for _build _src in ${ASM_SRCS_LIST}
${_build:R}.s: Makefile dummy ${.OBJDIR}/config.m4
	${TOOL_M4} -DCONFIG_TOP_SRCDIR=${DIST} ${BUILD_S_INCS} \
		${M4FLAGS} ${M4FLAGS.${.TARGET:R}} \
		-DOPERATION_${.TARGET:R} ${DIST}/${_src} > ${.TARGET}

SRCS+=		${_build:R}.s
CLEANFILES+=	${_build:R}.s
.endfor

.for _build _src in ${C_SRCS_LIST}
mpn_${_build}: Makefile
	echo '#include "${_src}"' > ${.TARGET}

CPPFLAGS.mpn_${_build}+= -DOPERATION_${_build:R}

SRCS+=		mpn_${_build}   
CLEANFILES+=	mpn_${_build}   
.endfor

@


1.13.2.2
log
@Rebase to HEAD as of a few days ago.
@
text
@d1 1
a1 1
#	$NetBSD$
a7 2
GMP_MACHINE_ARCH?=	${MACHINE_ARCH:S/earmv4/arm/:C/armv[5-7]/arm/}

d123 1
a123 1
	mp_set_fns.c randclr.c randdef.c randiset.c randlc2s.c 	\
d148 1
a148 2
CPPFLAGS+=	-I. -I${DIST} -I${.CURDIR}/arch/${GMP_MACHINE_ARCH} \
		-D__GMP_WITHIN_GMP -DHAVE_CONFIG_H
d152 1
a152 5
DPSRCS= fac_table.h fib_table.h fib_table.c jacobitab.h mp_bases.h \
	mp_bases.c perfsqr.h trialdivtab.h

gen-fac: gen-fac.c
	${HOST_CC} -o ${.OBJDIR}/gen-fac ${.ALLSRC}
d154 3
a156 2
fac_table.h: gen-fac
	${.OBJDIR}/gen-fac ${GMP_LIMB_BITS} 0 > ${.OBJDIR}/fac_table.h
a175 6
gen-jacobitab: gen-jacobitab.c
	${HOST_CC} -o ${.OBJDIR}/gen-jacobitab ${.ALLSRC} -lm

jacobitab.h: gen-jacobitab
	${.OBJDIR}/gen-jacobitab > ${.OBJDIR}/jacobitab.h

d180 1
a180 2
gen-trialdivtab: gen-trialdivtab.c
	${HOST_CC} -o ${.OBJDIR}/gen-trialdivtab ${.ALLSRC} -lm
d182 1
a182 15
trialdiv.c: trialdivtab.h
trialdivtab.h: gen-trialdivtab Makefile
	${.OBJDIR}/gen-trialdivtab $(GMP_LIMB_BITS) 8000 > ${.OBJDIR}/trialdivtab.h

CLEANFILES+=	${DPSRCS} gen-fac gen-fib gen-bases gen-jacobitab \
		gen-psqr gen-trialdivtab

.include "${.CURDIR}/arch/${GMP_MACHINE_ARCH}/Makefile.inc"

# Makefile.inc must define GMP_LIMB_BITS.
.if !defined(GMP_LIMB_BITS)
.BEGIN:
	@@echo "GMP_LIMB_BITS not defined!"
	false
.endif
d187 2
a188 2
${.OBJDIR}/config.m4: ${.CURDIR}/arch/${GMP_MACHINE_ARCH}/config.m4
	rm -f ${.OBJDIR}/config.m4 && cp ${.CURDIR}/arch/${GMP_MACHINE_ARCH}/config.m4 ${.OBJDIR}/config.m4
d195 1
a195 2
BUILD_S_INCS=	-I${.CURDIR} -I${.OBJDIR}/dummy -I${DIST}/ -I${DIST}/mpn \
		-I${.OBJDIR}
d198 1
a198 1
${_build:R}.s: Makefile dummy ${.OBJDIR}/config.m4 ${DIST}/${_src}
a219 1
	${DIST}/rand \
d221 1
a221 1
	${.CURDIR}/arch/${GMP_MACHINE_ARCH} \
a227 3
.if !empty(GMP_MACHINE_ARCH:M*arm*)
COPTS += -marm
.endif
d229 1
a229 1
CWARNFLAGS.clang+=	-Wno-unused-value -Wno-tautological-compare -Wno-parentheses
@


1.12
log
@allow LIBISPRIVATE to be overriden, and install everything again.
helpful for mknative-gcc.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.11 2011/08/09 13:01:34 joerg Exp $
a193 1
.if defined(HAVE_GCC) || defined(HAVE_PCC)
a194 1
.endif
@


1.12.2.1
log
@sync with head
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.12 2011/09/21 02:06:42 mrg Exp $
d194 1
d196 1
@


1.12.2.2
log
@sync with (a bit old) head
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.12.2.1 2012/10/30 18:58:07 yamt Exp $
a183 33
# XXX stuff looks for "../config.m4"
dummy:
	mkdir dummy
${.OBJDIR}/config.m4: ${.CURDIR}/arch/${MACHINE_ARCH}/config.m4
	cp ${.CURDIR}/arch/${MACHINE_ARCH}/config.m4 ${.OBJDIR}/config.m4

CLEANFILES+=	config.m4
clean: cleandummy
cleandummy: .PHONY
	-rmdir dummy

BUILD_S_INCS=	-I${.CURDIR} -I${.OBJDIR}/dummy -I${DIST}/ -I${DIST}/mpn

.for _build _src in ${ASM_SRCS_LIST}
${_build:R}.s: Makefile dummy ${.OBJDIR}/config.m4
	${TOOL_M4} -DCONFIG_TOP_SRCDIR=${DIST} ${BUILD_S_INCS} \
		${M4FLAGS} ${M4FLAGS.${.TARGET:R}} \
		-DOPERATION_${.TARGET:R} ${DIST}/${_src} > ${.TARGET}

SRCS+=		${_build:R}.s
CLEANFILES+=	${_build:R}.s
.endfor

.for _build _src in ${C_SRCS_LIST}
mpn_${_build}: Makefile
	echo '#include "${_src}"' > ${.TARGET}

CPPFLAGS.mpn_${_build}+= -DOPERATION_${_build:R}

SRCS+=		mpn_${_build}   
CLEANFILES+=	mpn_${_build}   
.endfor

@


1.12.2.3
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.12.2.2 2013/01/16 05:28:05 yamt Exp $
a7 2
GMP_MACHINE_ARCH?=	${MACHINE_ARCH:S/earmv4/arm/:C/armv[5-7]/arm/}

d123 1
a123 1
	mp_set_fns.c randclr.c randdef.c randiset.c randlc2s.c 	\
d148 1
a148 2
CPPFLAGS+=	-I. -I${DIST} -I${.CURDIR}/arch/${GMP_MACHINE_ARCH} \
		-D__GMP_WITHIN_GMP -DHAVE_CONFIG_H
d152 1
a152 5
DPSRCS= fac_table.h fib_table.h fib_table.c jacobitab.h mp_bases.h \
	mp_bases.c perfsqr.h trialdivtab.h

gen-fac: gen-fac.c
	${HOST_CC} -o ${.OBJDIR}/gen-fac ${.ALLSRC}
d154 3
a156 2
fac_table.h: gen-fac
	${.OBJDIR}/gen-fac ${GMP_LIMB_BITS} 0 > ${.OBJDIR}/fac_table.h
a175 6
gen-jacobitab: gen-jacobitab.c
	${HOST_CC} -o ${.OBJDIR}/gen-jacobitab ${.ALLSRC} -lm

jacobitab.h: gen-jacobitab
	${.OBJDIR}/gen-jacobitab > ${.OBJDIR}/jacobitab.h

d180 1
a180 2
gen-trialdivtab: gen-trialdivtab.c
	${HOST_CC} -o ${.OBJDIR}/gen-trialdivtab ${.ALLSRC} -lm
d182 1
a182 15
trialdiv.c: trialdivtab.h
trialdivtab.h: gen-trialdivtab Makefile
	${.OBJDIR}/gen-trialdivtab $(GMP_LIMB_BITS) 8000 > ${.OBJDIR}/trialdivtab.h

CLEANFILES+=	${DPSRCS} gen-fac gen-fib gen-bases gen-jacobitab \
		gen-psqr gen-trialdivtab

.include "${.CURDIR}/arch/${GMP_MACHINE_ARCH}/Makefile.inc"

# Makefile.inc must define GMP_LIMB_BITS.
.if !defined(GMP_LIMB_BITS)
.BEGIN:
	@@echo "GMP_LIMB_BITS not defined!"
	false
.endif
d187 2
a188 2
${.OBJDIR}/config.m4: ${.CURDIR}/arch/${GMP_MACHINE_ARCH}/config.m4
	rm -f ${.OBJDIR}/config.m4 && cp ${.CURDIR}/arch/${GMP_MACHINE_ARCH}/config.m4 ${.OBJDIR}/config.m4
d195 1
a195 2
BUILD_S_INCS=	-I${.CURDIR} -I${.OBJDIR}/dummy -I${DIST}/ -I${DIST}/mpn \
		-I${.OBJDIR}
d198 1
a198 1
${_build:R}.s: Makefile dummy ${.OBJDIR}/config.m4 ${DIST}/${_src}
a219 1
	${DIST}/rand \
d221 1
a221 1
	${.CURDIR}/arch/${GMP_MACHINE_ARCH} \
a227 3
.if !empty(GMP_MACHINE_ARCH:M*arm*)
COPTS += -marm
.endif
d229 1
a229 1
CWARNFLAGS.clang+=	-Wno-unused-value -Wno-tautological-compare -Wno-parentheses
@


1.11
log
@Requires -Wno-unused-value -Wno-tautological-compare when building with
clang.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.10 2011/07/21 03:13:30 mrg Exp $
d6 6
a11 1
LIBISPRIVATE=	yes
@


1.10
log
@build GMP, MPFR and MPC as private libraries just for GCC.  don't
install the headers or librarys into the system.

someone who really cares could make them shlibs again and have them
installed into eg, /usr/lib/gcc.  not convinced it is worth it.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.9 2011/07/18 16:55:49 tron Exp $
d192 2
@


1.9
log
@Disable SSP warnings (not SSP itself) for this library as their are too
many source files with functions that use variable sized arrays.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.8 2011/07/04 12:00:15 mrg Exp $
d5 3
d143 1
a143 4
INCS=		gmp.h
INCSDIR=	/usr/include

CPPFLAGS+=	-I. -I${DIST} -I${.CURDIR}/arch/${LIBGMP_MACHINE_ARCH} -D__GMP_WITHIN_GMP -DHAVE_CONFIG_H
d177 1
a177 6
.if defined(MLIBDIR)
LIBGMP_MACHINE_ARCH?=${MLIBDIR}
.endif
LIBGMP_MACHINE_ARCH?=${MACHINE_ARCH}

.include "${.CURDIR}/arch/${LIBGMP_MACHINE_ARCH}/Makefile.inc"
d183 1
a183 1
	${.CURDIR}/arch/${LIBGMP_MACHINE_ARCH} \
@


1.8
log
@don't force LIBGMP_MACHINE_ARCH:=${MLIBDIR}.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.7 2011/07/03 15:25:11 mrg Exp $
a123 1

d191 6
@


1.7
log
@clean up another generator.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.6 2011/07/02 14:04:30 mrg Exp $
d179 1
a179 1
LIBGMP_MACHINE_ARCH:=${MLIBDIR}
@


1.6
log
@remove a stale XXX comment.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.5 2011/07/01 01:30:16 mrg Exp $
d176 1
a176 1
CLEANFILES+=	${DPSRCS} gen-fac_ui gen-fib gen-bases gen-psqr
@


1.5
log
@- add support for src/compat builds
- use .include not .sinclude for the arch Makefile.inc file
- clean up
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.4 2011/06/29 08:09:43 mrg Exp $
a126 1
# XXX	${MPBSD_SRCS:C/^/mpbsd /}
@


1.4
log
@enable lint.
fix the 32 / 64 bit problem.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.3 2011/06/24 03:50:23 mrg Exp $
a141 14
.if 0
# Build the generic popcount/hamdist for now
.for _srcfile in \
	${MPN_GENERIC_SRCS}
mpn_${_srcfile}: Makefile
	echo '#include "mpn/generic/popham.c"' > ${.TARGET}

COPTS.mpn_${_srcfile}+= -DOPERATION_${_srcfile:R}

SRCS+=		mpn_${_srcfile}
CLEANFILES+=	mpn_${_srcfile}
.endfor
.endif

d145 1
a145 1
CPPFLAGS+=	-I. -I${DIST} -I${.CURDIR}/arch/${MACHINE_ARCH} -D__GMP_WITHIN_GMP -DHAVE_CONFIG_H
d179 6
a184 1
.sinclude "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.inc"
d190 1
a190 1
	${.CURDIR}/arch/${MACHINE_ARCH} \
@


1.3
log
@add a README to describe how to port GMP build framework, and a script
to parse the GMP ./configure output and generate part of a makefile.

move all the mpn build stuff into the MD part of the framework, and
update the amd64 port to build all the parts it should.

XXX: amd64 build fails to preprocess redc_1.asm gcd_1.asm mod_1_4.asm,
XXX: so we're using the generic C versions for now.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.2 2011/06/23 12:09:30 mrg Exp $
a6 3
# XXX
MKLINT=no

d167 1
a167 1
	${.OBJDIR}/gen-fac_ui 64 0 > ${.OBJDIR}/fac_ui.h
d173 1
a173 1
	${.OBJDIR}/gen-fib header 64 0 > ${.OBJDIR}/fib_table.h
d176 1
a176 1
	${.OBJDIR}/gen-fib table 64 0 > ${.OBJDIR}/fib_table.c
d182 1
a182 1
	${.OBJDIR}/gen-bases header 64 0 > ${.OBJDIR}/mp_bases.h
d185 1
a185 1
	${.OBJDIR}/gen-bases table 64 0 > ${.OBJDIR}/mp_bases.c
d189 1
a189 1
	${.OBJDIR}/gen-psqr 64 0 > ${.OBJDIR}/perfsqr.h
@


1.2
log
@make this build on amd64.

XXX: need to confirm that all the objects are built but this is
XXX: enough to make GCC happy.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.1 2011/06/21 04:23:56 mrg Exp $
a93 132
#	addmul_2.c \
#	addmul_3.c \
#	addmul_4.c \
#	addmul_5.c \
#	addmul_6.c \
#	addmul_7.c \
#	addmul_8.c \
#	and_n.c \
#	andn_n.c \
#	ior_n.c \
#	iorn_n.c \
#	mul_2.c \
#	mul_3.c \
#	mul_4.c \
#	nand_n.c \
#	nior_n.c \
#	udiv_qrnnd.c \
#	xor_n.c
#	xnor_n.c
# many asm
#	sqr_diagonal.c \

MPN_SRCS = \
	add.c \
	add_1.c \
	add_n.c \
	addmul_1.c \
	cmp.c \
	com.c \
	copyd.c \
	copyi.c \
	dive_1.c \
	diveby3.c \
	divexact.c \
	divis.c \
	divrem.c \
	divrem_1.c \
	divrem_2.c \
	sbpi1_bdiv_qr.c \
	sbpi1_bdiv_q.c \
	sbpi1_div_qr.c \
	sbpi1_div_q.c \
	sbpi1_divappr_q.c \
	dcpi1_bdiv_qr.c \
	dcpi1_bdiv_q.c \
	dcpi1_div_qr.c \
	dcpi1_div_q.c \
	dcpi1_divappr_q.c \
	dump.c \
	fib2_ui.c \
	gcd.c \
	gcd_1.c \
	gcdext.c \
	get_d.c \
	get_str.c \
	hgcd2.c \
	hgcd.c \
	jacbase.c \
	lshift.c \
	matrix22_mul.c \
	mod_1.c \
	mod_34lsub1.c \
	mode1o.c \
	mod_1_1.c \
	mod_1_2.c \
	mod_1_3.c \
	mod_1_4.c \
	mul.c \
	mul_1.c \
	mul_fft.c \
	mul_n.c \
	mul_basecase.c \
	nussbaumer_mul.c \
	toom22_mul.c \
	toom32_mul.c \
	toom42_mul.c \
	toom52_mul.c \
	toom62_mul.c \
	toom33_mul.c \
	toom43_mul.c \
	toom53_mul.c \
	toom63_mul.c \
	toom44_mul.c \
	toom6h_mul.c \
	toom6_sqr.c \
	toom8h_mul.c \
	toom8_sqr.c \
	toom_couple_handling.c \
	toom2_sqr.c \
	toom3_sqr.c \
	toom4_sqr.c \
	toom_eval_dgr3_pm1.c \
	toom_eval_dgr3_pm2.c \
	toom_eval_pm1.c \
	toom_eval_pm1.c \
	toom_eval_pm2exp.c \
	toom_eval_pm2rexp.c \
	toom_interpolate_5pts.c \
	toom_interpolate_6pts.c \
	toom_interpolate_7pts.c \
	toom_interpolate_8pts.c \
	toom_interpolate_12pts.c \
	toom_interpolate_16pts.c \
	invertappr.c \
	invert.c \
	binvert.c \
	mulmod_bnm1.c \
	sqrmod_bnm1.c \
	mullo_n.c \
	mullo_basecase.c \
	neg.c \
	perfsqr.c \
	pre_divrem_1.c \
	pre_mod_1.c \
	pow_1.c \
	random.c \
	random2.c \
	rshift.c \
	rootrem.c \
	scan0.c \
	scan1.c \
	set_str.c \
	sqr_basecase.c \
	sqrtrem.c \
	sub.c \
	sub_1.c \
	sub_n.c \
	submul_1.c \
	tdiv_qr.c \

#	udiv_w_sdiv.c

a121 5
.for _src in ${MPN_SRCS}
COPTS.${_src}+=	-DOPERATION_${_src:R}
.endfor
SRCS+=	${MPN_SRCS}

d145 1
d157 1
@


1.1
log
@build stuff for mpc, mpfr and gmp.  mpfr is mine, the others are from chuq.

XXX: i don't think gmp works yet.  it wants multiple files with the same
basename but in different subdirs to link into one library...
@
text
@d1 1
a1 1
#	$NetBSD$
d5 5
d12 281
a292 465
SRCS=			\
	assert.c	\
	compat.c	\
	errno.c	\
	extract-dbl.c	\
	invalid.c	\
	memory.c	\
	mp_bpl.c	\
	mp_clz_tab.c	\
	mp_dv_tab.c	\
	mp_minv_tab.c	\
	mp_get_fns.c	\
	mp_set_fns.c	\
	rand.c	\
	randclr.c	\
	randdef.c	\
	randiset.c	\
	randlc2s.c	\
	randlc2x.c	\
	randmt.c	\
	randmts.c	\
	rands.c	\
	randsd.c	\
	randsdui.c	\
	randbui.c	\
	randmui.c	\
	version.c	\
	nextprime.c	\
	tal-reent.c	\
	init.c	\
	init2.c	\
	inits.c	\
	set.c	\
	set_ui.c	\
	set_si.c	\
	set_str.c	\
	set_d.c	\
	set_z.c	\
	iset.c	\
	iset_ui.c	\
	iset_si.c	\
	iset_str.c	\
	iset_d.c	\
	clear.c	\
	clears.c	\
	get_str.c	\
	dump.c	\
	size.c	\
	eq.c	\
	reldiff.c	\
	sqrt.c	\
	random2.c	\
	inp_str.c	\
	out_str.c	\
	add.c	\
	add_ui.c	\
	sub.c	\
	sub_ui.c	\
	ui_sub.c	\
	mul.c	\
	mul_ui.c	\
	div.c	\
	div_ui.c	\
	cmp.c	\
	cmp_d.c	\
	cmp_ui.c	\
	cmp_si.c	\
	mul_2exp.c	\
	div_2exp.c	\
	abs.c	\
	neg.c	\
	set_q.c	\
	get_d.c	\
	get_d_2exp.c	\
	set_dfl_prec.c	\
	set_prc.c	\
	set_prc_raw.c	\
	get_dfl_prec.c	\
	get_prc.c	\
	ui_div.c	\
	sqrt_ui.c	\
	ceilfloor.c	\
	trunc.c	\
	pow_ui.c	\
	urandomb.c	\
	swap.c	\
	fits_sint.c	\
	fits_slong.c	\
	fits_sshort.c	\
	fits_uint.c	\
	fits_ulong.c	\
	fits_ushort.c	\
	get_si.c	\
	get_ui.c	\
	int_p.c	\
	abs.c	\
	add.c	\
	add_ui.c	\
	aorsmul.c	\
	aorsmul_i.c	\
	and.c	\
	array_init.c	\
	bin_ui.c	\
	bin_uiui.c	\
	cdiv_q.c	\
	cdiv_q_ui.c	\
	cdiv_qr.c	\
	cdiv_qr_ui.c	\
	cdiv_r.c	\
	cdiv_r_ui.c	\
	cdiv_ui.c	\
	cfdiv_q_2exp.c	\
	cfdiv_r_2exp.c	\
	clear.c	\
	clears.c	\
	clrbit.c	\
	cmp.c	\
	cmp_d.c	\
	cmp_si.c	\
	cmp_ui.c	\
	cmpabs.c	\
	cmpabs_d.c	\
	cmpabs_ui.c	\
	com.c	\
	combit.c	\
	cong.c	\
	cong_2exp.c	\
	cong_ui.c	\
	divexact.c	\
	divegcd.c	\
	dive_ui.c	\
	divis.c	\
	divis_ui.c	\
	divis_2exp.c	\
	dump.c	\
	export.c	\
	fac_ui.c	\
	fdiv_q.c	\
	fdiv_q_ui.c	\
	fdiv_qr.c	\
	fdiv_qr_ui.c	\
	fdiv_r.c	\
	fdiv_r_ui.c	\
	fdiv_ui.c	\
	fib_ui.c	\
	fib2_ui.c	\
	fits_sint.c	\
	fits_slong.c	\
	fits_sshort.c	\
	fits_uint.c	\
	fits_ulong.c	\
	fits_ushort.c	\
	gcd.c	\
	gcd_ui.c	\
	gcdext.c	\
	get_d.c	\
	get_d_2exp.c	\
	get_si.c	\
	get_str.c	\
	get_ui.c	\
	getlimbn.c	\
	hamdist.c	\
	import.c	\
	init.c	\
	init2.c	\
	inits.c	\
	inp_raw.c	\
	inp_str.c	\
	invert.c	\
	ior.c	\
	iset.c	\
	iset_d.c	\
	iset_si.c	\
	iset_str.c	\
	iset_ui.c	\
	jacobi.c	\
	kronsz.c	\
	kronuz.c	\
	kronzs.c	\
	kronzu.c	\
	lcm.c	\
	lcm_ui.c	\
	lucnum_ui.c	\
	lucnum2_ui.c	\
	millerrabin.c	\
	mod.c	\
	mul.c	\
	mul_2exp.c	\
	mul_si.c	\
	mul_ui.c	\
	n_pow_ui.c	\
	neg.c	\
	nextprime.c	\
	out_raw.c	\
	out_str.c	\
	perfpow.c	\
	perfsqr.c	\
	popcount.c	\
	pow_ui.c	\
	powm.c	\
	powm_sec.c	\
	powm_ui.c	\
	pprime_p.c	\
	random.c	\
	random2.c	\
	realloc.c	\
	realloc2.c	\
	remove.c	\
	root.c	\
	rootrem.c	\
	rrandomb.c	\
	scan0.c	\
	scan1.c	\
	set.c	\
	set_d.c	\
	set_f.c	\
	set_q.c	\
	set_si.c	\
	set_str.c	\
	set_ui.c	\
	setbit.c	\
	size.c	\
	sizeinbase.c	\
	sqrt.c	\
	sqrtrem.c	\
	sub.c	\
	sub_ui.c	\
	swap.c	\
	tdiv_ui.c	\
	tdiv_q.c	\
	tdiv_q_2exp.c	\
	tdiv_q_ui.c	\
	tdiv_qr.c	\
	tdiv_qr_ui.c	\
	tdiv_r.c	\
	tdiv_r_2exp.c	\
	tdiv_r_ui.c	\
	tstbit.c	\
	ui_pow_ui.c	\
	ui_sub.c	\
	urandomb.c	\
	urandomm.c	\
	xor.c	\
	abs.c	\
	aors.c	\
	canonicalize.c	\
	clear.c	\
	clears.c	\
	cmp.c	\
	cmp_si.c	\
	cmp_ui.c	\
	div.c	\
	get_d.c	\
	get_den.c	\
	get_num.c	\
	get_str.c	\
	init.c	\
	inits.c	\
	inp_str.c	\
	inv.c	\
	md_2exp.c	\
	mul.c	\
	neg.c	\
	out_str.c	\
	set.c	\
	set_den.c	\
	set_num.c	\
	set_si.c	\
	set_str.c	\
	set_ui.c	\
	equal.c	\
	set_z.c	\
	set_d.c	\
	set_f.c	\
	swap.c	\
	fib_table.c	\
	mp_bases.c	\
	add.c	\
	add_1.c	\
	add_n.c	\
	sub.c	\
	sub_1.c	\
	sub_n.c	\
	neg.c	\
	com.c	\
	mul_1.c	\
	addmul_1.c	\
	submul_1.c	\
	lshift.c	\
	rshift.c	\
	dive_1.c	\
	diveby3.c	\
	divis.c	\
	divrem.c	\
	divrem_1.c	\
	divrem_2.c	\
	fib2_ui.c	\
	mod_1.c	\
	mod_34lsub1.c	\
	mode1o.c	\
	pre_mod_1.c	\
	dump.c	\
	mod_1_1.c	\
	mod_1_2.c	\
	mod_1_3.c	\
	mod_1_4.c	\
	lshiftc.c	\
	mul.c	\
	mul_fft.c	\
	mul_n.c	\
	sqr.c	\
	mul_basecase.c	\
	sqr_basecase.c	\
	nussbaumer_mul.c	\
	random.c	\
	random2.c	\
	pow_1.c	\
	rootrem.c	\
	sqrtrem.c	\
	get_str.c	\
	set_str.c	\
	scan0.c	\
	scan1.c	\
	popcount.c	\
	hamdist.c	\
	cmp.c	\
	perfsqr.c	\
	perfpow.c	\
	gcd_1.c	\
	gcd.c	\
	gcdext_1.c	\
	gcdext.c	\
	gcd_lehmer.c	\
	gcd_subdiv_step.c	\
	gcdext_lehmer.c	\
	gcdext_subdiv_step.c	\
	div_q.c	\
	tdiv_qr.c	\
	jacbase.c	\
	get_d.c	\
	matrix22_mul.c	\
	hgcd2.c	\
	hgcd.c	\
	mullo_n.c	\
	mullo_basecase.c	\
	toom22_mul.c	\
	toom32_mul.c	\
	toom42_mul.c	\
	toom52_mul.c	\
	toom62_mul.c	\
	toom33_mul.c	\
	toom43_mul.c	\
	toom53_mul.c	\
	toom63_mul.c	\
	toom44_mul.c	\
	toom6h_mul.c	\
	toom6_sqr.c	\
	toom8h_mul.c	\
	toom8_sqr.c	\
	toom_couple_handling.c	\
	toom2_sqr.c	\
	toom3_sqr.c	\
	toom4_sqr.c	\
	toom_eval_dgr3_pm1.c	\
	toom_eval_dgr3_pm2.c	\
	toom_eval_pm1.c	\
	toom_eval_pm2.c	\
	toom_eval_pm2exp.c	\
	toom_eval_pm2rexp.c	\
	toom_interpolate_5pts.c	\
	toom_interpolate_6pts.c	\
	toom_interpolate_7pts.c	\
	toom_interpolate_8pts.c	\
	toom_interpolate_12pts.c	\
	toom_interpolate_16pts.c	\
	invertappr.c	\
	invert.c	\
	binvert.c	\
	mulmod_bnm1.c	\
	sqrmod_bnm1.c	\
	sbpi1_div_q.c	\
	sbpi1_div_qr.c	\
	sbpi1_divappr_q.c	\
	dcpi1_div_q.c	\
	dcpi1_div_qr.c	\
	dcpi1_divappr_q.c	\
	mu_div_qr.c	\
	mu_divappr_q.c	\
	mu_div_q.c	\
	bdiv_q_1.c	\
	sbpi1_bdiv_q.c	\
	sbpi1_bdiv_qr.c	\
	dcpi1_bdiv_q.c	\
	dcpi1_bdiv_qr.c	\
	mu_bdiv_q.c	\
	mu_bdiv_qr.c	\
	bdiv_q.c	\
	bdiv_qr.c	\
	divexact.c	\
	bdiv_dbm1c.c	\
	redc_1.c	\
	redc_2.c	\
	redc_n.c	\
	powm.c	\
	powlo.c	\
	powm_sec.c	\
	subcnd_n.c	\
	redc_1_sec.c	\
	trialdiv.c	\
	remove.c	\
	and_n.c	\
	andn_n.c	\
	nand_n.c	\
	ior_n.c	\
	iorn_n.c	\
	nior_n.c	\
	xor_n.c	\
	xnor_n.c	\
	copyi.c	\
	copyd.c	\
	zero.c	\
	invert_limb.c	\
	mul_2.c	\
	addmul_2.c	\
	addlsh1_n.c	\
	sublsh1_n.c	\
	rsblsh1_n.c	\
	rsh1add_n.c	\
	rsh1sub_n.c	\
	addlsh2_n.c	\
	rsblsh2_n.c	\
	addlsh_n.c	\
	rsblsh_n.c	\
	addaddmul_1msb0.c	\
	asprintf.c	\
	asprntffuns.c	\
	doprnt.c	\
	doprntf.c	\
	doprnti.c	\
	fprintf.c	\
	obprintf.c	\
	obvprintf.c	\
	obprntffuns.c	\
	printf.c	\
	printffuns.c	\
	snprintf.c	\
	snprntffuns.c	\
	sprintf.c	\
	sprintffuns.c	\
	vasprintf.c	\
	vfprintf.c	\
	vprintf.c	\
	vsnprintf.c	\
	vsprintf.c	\
	repl-vsnprintf.c	\
	doscan.c	\
	fscanf.c	\
	fscanffuns.c	\
	scanf.c		\
	sscanf.c	\
	sscanffuns.c	\
	vfscanf.c	\
	vscanf.c	\
	vsscanf.c

d297 1
a297 1
CPPFLAGS+=	-I${.CURDIR} -D__GMP_WITHIN_GMP
d331 2
d335 5
a339 1
.PATH: ${.CURDIR}/../../dist ${.CURDIR}/../../dist/mpf
@

