xref: /netbsd-src/external/lgpl3/gmp/dist/mini-gmp/tests/Makefile (revision 2dd295436a0082eb4f8d294f4aa73c223413d0f2)
1# Note: Requires GNU make
2
3# Copyright 2011, 2012, 2014, 2016, 2018 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 t-lucm \
34	t-mpq_addsub t-mpq_muldiv t-mpq_muldiv_2exp t-mpq_str \
35	t-mpq_double
36# Default TESTS to all tests, allowing overriding TESTS for building tests
37# without running them.
38TESTS = $(CHECK_PROGRAMS)
39
40MISC_OBJS = hex-random.o mini-random.o testutils.o
41
42all:
43
44clean:
45	rm -f *.o $(CHECK_PROGRAMS)
46
47%: %.c
48.c:
49
50# Keep object files
51.PRECIOUS: %.o
52
53%.o: %.c $(MINI_GMP_DIR)/mini-gmp.h $(MINI_GMP_DIR)/mini-mpq.h hex-random.h mini-random.h
54	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
55
56testutils.o: $(MINI_GMP_DIR)/mini-gmp.c $(MINI_GMP_DIR)/mini-mpq.c
57
58%: %.o $(MISC_OBJS)
59	$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
60
61# Missing tests include:
62#   mpz_cmp_d, mpz_popcount, mpz_hamdist, mpz_ui_pow_ui
63
64check: $(CHECK_PROGRAMS)
65	$(srcdir)/run-tests $(TESTS)
66