xref: /netbsd-src/external/lgpl3/gmp/dist/mini-gmp/tests/Makefile (revision 7330f729ccf0bd976a06f95fad452fe774fc7fd1)
1# Note: Requires GNU make
2
3# Copyright 2011, 2012, 2014, 2016 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 https://www.gnu.org/licenses/.
19
20srcdir=.
21MINI_GMP_DIR=..
22
23CC = gcc
24CFLAGS = -O -Wall -g
25CPPFLAGS =
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 t-aorsmul t-limbs t-cong t-pprime_p
34# Default TESTS to all tests, allowing overriding TESTS for building tests
35# without running them.
36TESTS = $(CHECK_PROGRAMS)
37
38MISC_OBJS = hex-random.o mini-random.o testutils.o
39
40all:
41
42clean:
43	rm -f *.o $(CHECK_PROGRAMS)
44
45%: %.c
46.c:
47
48# Keep object files
49.PRECIOUS: %.o
50
51%.o: %.c $(MINI_GMP_DIR)/mini-gmp.h hex-random.h mini-random.h
52	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
53
54testutils.o: $(MINI_GMP_DIR)/mini-gmp.c
55
56%: %.o $(MISC_OBJS)
57	$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
58
59# Missing tests include:
60#   mpz_cmp_d, mpz_popcount, mpz_hamdist, mpz_ui_pow_ui
61
62check: $(CHECK_PROGRAMS)
63	$(srcdir)/run-tests $(TESTS)
64