160786Sps# Note: Requires GNU make
260786Sps
360786Sps# Copyright 2011, 2012, 2014, 2016, 2018 Free Software Foundation, Inc.
460786Sps#
560786Sps# This file is part of the GNU MP Library test suite.
660786Sps#
760786Sps# The GNU MP Library test suite is free software; you can redistribute it
860786Sps# and/or modify it under the terms of the GNU General Public License as
960786Sps# published by the Free Software Foundation; either version 3 of the License,
1060786Sps# or (at your option) any later version.
1160786Sps#
1260786Sps# The GNU MP Library test suite is distributed in the hope that it will be
1360786Sps# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
1460786Sps# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
1560786Sps# Public License for more details.
1660786Sps#
1760786Sps# You should have received a copy of the GNU General Public License along with
1860786Sps# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
1960786Sps
2060786Spssrcdir=.
2160786SpsMINI_GMP_DIR=..
22128345Stjr
23128345StjrCC = gcc
2460786SpsCFLAGS = -O -Wall -g
2560786SpsCPPFLAGS =
2660786SpsLDFLAGS =
2760786Sps
2860786SpsLIBS = -lgmp -lm -lmcheck
2960786Sps
3060786SpsCHECK_PROGRAMS = t-add t-sub t-mul t-invert t-div t-div_2exp \
3160786Sps	t-double t-cmp_d t-gcd t-lcm t-import t-comb t-signed \
3260786Sps	t-sqrt t-root t-powm t-logops t-bitops t-scan t-str \
3360786Sps	t-reuse t-aorsmul t-limbs t-cong t-pprime_p t-lucm \
3460786Sps	t-mpq_addsub t-mpq_muldiv t-mpq_muldiv_2exp t-mpq_str \
3560786Sps	t-mpq_double
3660786Sps# Default TESTS to all tests, allowing overriding TESTS for building tests
3760786Sps# without running them.
3860786SpsTESTS = $(CHECK_PROGRAMS)
3960786Sps
4060786SpsMISC_OBJS = hex-random.o mini-random.o testutils.o
41191930Sdelphij
4260786Spsall:
4360786Sps
4460786Spsclean:
4560786Sps	rm -f *.o $(CHECK_PROGRAMS)
4660786Sps
4760786Sps%: %.c
4860786Sps.c:
4960786Sps
5060786Sps# Keep object files
5160786Sps.PRECIOUS: %.o
5260786Sps
5360786Sps%.o: %.c $(MINI_GMP_DIR)/mini-gmp.h $(MINI_GMP_DIR)/mini-mpq.h hex-random.h mini-random.h
5460786Sps	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
5560786Sps
5689019Spstestutils.o: $(MINI_GMP_DIR)/mini-gmp.c $(MINI_GMP_DIR)/mini-mpq.c
5789019Sps
5860786Sps%: %.o $(MISC_OBJS)
5960786Sps	$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
6060786Sps
6160786Sps# Missing tests include:
6260786Sps#   mpz_cmp_d, mpz_popcount, mpz_hamdist, mpz_ui_pow_ui
6360786Sps
6460786Spscheck: $(CHECK_PROGRAMS)
6560786Sps	$(srcdir)/run-tests $(TESTS)
6660786Sps