xref: /netbsd-src/external/lgpl3/gmp/dist/mini-gmp/tests/Makefile (revision 8450a7c42673d65e3b1f6560d3b6ecd317a6cbe8)
1# Note: Requires GNU make
2
3# Copyright 2011, 2012 Free Software Foundation, Inc.
4#
5# This file is part of the GNU MP Library test suite.
6#
7# The GNU MP Library test suite is free software; you can redistribute it
8# and/or modify it under the terms of the GNU General Public License as
9# published by the Free Software Foundation; either version 3 of the License,
10# or (at your option) any later version.
11#
12# The GNU MP Library test suite is distributed in the hope that it will be
13# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
15# Public License for more details.
16#
17# You should have received a copy of the GNU General Public License along with
18# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
19
20srcdir=.
21MINI_GMP_DIR=..
22
23CC = gcc
24EXTRA_CFLAGS = -O -Wall -g
25CFLAGS = $(EXTRA_CFLAGS) -I$(MINI_GMP_DIR)
26LDFLAGS =
27
28LIBS = -lgmp -lm -lmcheck
29
30CHECK_PROGRAMS = t-add t-sub t-mul t-invert t-div t-div_2exp \
31	t-double t-cmp_d t-gcd t-lcm t-import t-comb t-signed \
32	t-sqrt t-root t-powm t-logops t-bitops t-scan t-str \
33	t-reuse
34
35MISC_OBJS = hex-random.o mini-random.o testutils.o
36
37all:
38
39clean:
40	rm -f *.o $(CHECK_PROGRAMS)
41
42%: %.c
43.c:
44
45# Keep object files
46.PRECIOUS: %.o
47
48%.o: %.c $(MINI_GMP_DIR)/mini-gmp.h hex-random.h mini-random.h
49	$(CC) $(CFLAGS) -c $< -o $@
50
51testutils.o: $(MINI_GMP_DIR)/mini-gmp.c
52
53%: %.o $(MISC_OBJS)
54	$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
55
56# Missing tests include:
57#   mpz_cmp_d, mpz_popcount, mpz_hamdist, mpz_ui_pow_ui
58
59check: $(CHECK_PROGRAMS)
60	$(srcdir)/run-tests $(CHECK_PROGRAMS)
61