1#	$NetBSD: Makefile.inc,v 1.1 2011/07/03 13:43:23 mrg Exp $
2
3SRCS+= \
4	random.c \
5	divrem_2.c \
6	toom_interpolate_7pts.c \
7	sbpi1_divappr_q.c \
8	random2.c \
9	mu_bdiv_q.c \
10	toom32_mul.c \
11	toom44_mul.c \
12	toom8h_mul.c \
13	toom2_sqr.c \
14	zero.c \
15	mod_1_4.c \
16	gcdext.c \
17	binvert.c \
18	mu_div_q.c \
19	invertappr.c \
20	dump.c \
21	mu_divappr_q.c \
22	dcpi1_div_qr.c \
23	redc_1_sec.c \
24	toom6_sqr.c \
25	divrem_1.c \
26	mod_1.c \
27	divexact.c \
28	powlo.c \
29	mul.c \
30	set_str.c \
31	toom42_mul.c \
32	toom_interpolate_6pts.c \
33	dcpi1_divappr_q.c \
34	copyd.c \
35	toom_eval_dgr3_pm2.c \
36	mod_1_3.c \
37	com.c \
38	copyi.c \
39	toom_couple_handling.c \
40	add.c \
41	toom_interpolate_12pts.c \
42	perfsqr.c \
43	toom53_mul.c \
44	toom_eval_pm2exp.c \
45	mu_div_qr.c \
46	toom_interpolate_16pts.c \
47	mod_34lsub1.c \
48	bdiv_q.c \
49	toom22_mul.c \
50	toom4_sqr.c \
51	div_q.c \
52	jacbase.c \
53	gcdext_subdiv_step.c \
54	mullo_n.c \
55	toom33_mul.c \
56	toom_eval_dgr3_pm1.c \
57	mod_1_2.c \
58	sub_1.c \
59	trialdiv.c \
60	add_1.c \
61	sqr_basecase.c \
62	toom_interpolate_5pts.c \
63	sbpi1_bdiv_q.c \
64	pre_mod_1.c \
65	hgcd.c \
66	bdiv_dbm1c.c \
67	sqrtrem.c \
68	bdiv_q_1.c \
69	gcdext_1.c \
70	toom63_mul.c \
71	mul_basecase.c \
72	toom8_sqr.c \
73	neg.c \
74	gcdext_lehmer.c \
75	divis.c \
76	dcpi1_div_q.c \
77	subcnd_n.c \
78	toom_eval_pm2.c \
79	hgcd2.c \
80	toom62_mul.c \
81	sbpi1_bdiv_qr.c \
82	scan1.c \
83	pre_divrem_1.c \
84	perfpow.c \
85	get_str.c \
86	mullo_basecase.c \
87	mulmod_bnm1.c \
88	tdiv_qr.c \
89	toom43_mul.c \
90	mod_1_1.c \
91	matrix22_mul.c \
92	powm_sec.c \
93	divrem.c \
94	gcd_1.c \
95	dcpi1_bdiv_qr.c \
96	mul_n.c \
97	redc_2.c \
98	toom6h_mul.c \
99	mul_fft.c \
100	sqrmod_bnm1.c \
101	powm.c \
102	rootrem.c \
103	mode1o.c \
104	toom_interpolate_8pts.c \
105	remove.c \
106	lshiftc.c \
107	dive_1.c \
108	cmp.c \
109	toom_eval_pm1.c \
110	scan0.c \
111	gcd_subdiv_step.c \
112	sbpi1_div_qr.c \
113	invert.c \
114	sub.c \
115	toom_eval_pm2rexp.c \
116	dcpi1_bdiv_q.c \
117	redc_1.c \
118	sqr.c \
119	nussbaumer_mul.c \
120	mu_bdiv_qr.c \
121	pow_1.c \
122	gcd_lehmer.c \
123	get_d.c \
124	toom52_mul.c \
125	sbpi1_div_q.c \
126	diveby3.c \
127	fib2_ui.c \
128	bdiv_qr.c \
129	toom3_sqr.c \
130	gcd.c \
131	redc_n.c \
132
133C_SRCS_LIST= \
134	xor_n.c		mpn/generic/logops_n.c \
135	nand_n.c		mpn/generic/logops_n.c \
136	nior_n.c		mpn/generic/logops_n.c \
137	hamdist.c		mpn/generic/popham.c \
138	popcount.c		mpn/generic/popham.c \
139	and_n.c		mpn/generic/logops_n.c \
140	ior_n.c		mpn/generic/logops_n.c \
141	xnor_n.c		mpn/generic/logops_n.c \
142	iorn_n.c		mpn/generic/logops_n.c \
143	andn_n.c		mpn/generic/logops_n.c \
144
145ASM_SRCS_LIST= \
146	sqr_diagonal.asm		mpn/mips64/sqr_diagonal.asm \
147	add_n.asm		mpn/mips64/add_n.asm \
148	submul_1.asm		mpn/mips64/submul_1.asm \
149	umul.asm		mpn/mips64/umul.asm \
150	lshift.asm		mpn/mips64/lshift.asm \
151	mul_1.asm		mpn/mips64/mul_1.asm \
152	rshift.asm		mpn/mips64/rshift.asm \
153	addmul_1.asm		mpn/mips64/addmul_1.asm \
154	sub_n.asm		mpn/mips64/sub_n.asm \
155
156gen-trialdivtab: gen-trialdivtab.c
157	${HOST_CC} -o ${.OBJDIR}/gen-trialdivtab ${.ALLSRC} -lm
158
159.if (defined(CPUFLAGS) && !empty(CPUFLAGS:M-mabi=64))
160GMP_LIMB_BITS=64
161.else
162GMP_LIMB_BITS=32
163.endif
164
165trialdiv.c: trialdivtab.h
166trialdivtab.h: gen-trialdivtab Makefile
167	${.OBJDIR}/gen-trialdivtab $(GMP_LIMB_BITS) 8000 > ${.OBJDIR}/trialdivtab.h
168
169CLEANFILES+=	trialdivtab.h
170
171# XXX stuff looks for "../config.m4"
172dummy:
173	mkdir dummy
174${.OBJDIR}/config.m4: ${.CURDIR}/arch/${MACHINE_ARCH}/config.m4
175	cp ${.CURDIR}/arch/${MACHINE_ARCH}/config.m4 ${.TARGET}
176
177.for _build _src in ${ASM_SRCS_LIST}
178${_build:R}.s: Makefile dummy ${.OBJDIR}/config.m4
179	${TOOL_M4} -DCONFIG_TOP_SRCDIR=${DIST} -I${.CURDIR} -I${.OBJDIR}/dummy -I${DIST}/ -I${DIST}/mpn -DOPERATION_${.TARGET:R} ${DIST}/${_src} > ${.TARGET}
180
181SRCS+=		${_build:R}.s
182CLEANFILES+=	${_build:R}.s
183
184.endfor
185
186.for _build _src in ${C_SRCS_LIST}
187mpn_${_build}: Makefile
188	echo '#include "${_src}"' > ${.TARGET}
189
190CPPFLAGS.mpn_${_build}+= -DOPERATION_${_build:R}
191
192SRCS+=		mpn_${_build}
193CLEANFILES+=	mpn_${_build}
194.endfor
195
196COPTS+=		-Wno-error
197