# Makefile for building mpdecimal library
# mpdecimal is available at https://www.bytereef.org/mpdecimal/
# The code here is from https://www.bytereef.org/software/mpdecimal/releases/mpdecimal-4.0.1.tar.gz

CC= gcc -std=c99
CFLAGS= -pedantic -Wall -Wextra -Wno-unknown-pragmas -DCONFIG_64 -DNDEBUG -O2 $(PIC)
L= libmpdec.a
T= testc

all:	$L

$L:	*.c *.h
	$(CC) $(CFLAGS) -c *.c
	ar rcu $L *.o
	-rm -f *.o

test:	$T $L
	cp $T $T.c
	$(CC) $(CFLAGS) $T.c $L -lm
	rm -f $T.c
	./a.out 2 2000

clean:
	-rm -f *.o *.a a.out
