aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 691e35f1991806292d2669f4f616371ae8ed7205 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
include config.mk

HDR =\
	zahl.h\
	src/internals.h

FUN =\
	zabs\
	zadd\
	zand\
	zbits\
	zbset\
	zbtest\
	zcmp\
	zcmpi\
	zcmpmag\
	zcmpu\
	zdiv\
	zdivmod\
	zerror\
	zfree\
	zgcd\
	zload\
	zlsb\
	zlsh\
	zmod\
	zmodmul\
	zmodpow\
	zmodpowu\
	zmodsqr\
	zmul\
	zneg\
	znot\
	zor\
	zperror\
	zpow\
	zpowu\
	zptest\
	zrand\
	zrsh\
	zsave\
	zset\
	zseti\
	zsets\
	zsetu\
	zsetup\
	zsplit\
	zsqr\
	zstr\
	zstr_length\
	zsub\
	zswap\
	ztrunc\
	zunsetup\
	zxor

INLINE_FUN =\
	zinit\
	zeven\
	zodd\
	zeven_nonzero\
	zodd_nonzero\
	zzero\
	zsignum

OBJ = $(FUN:=.o) allocator.o
MAN = $(foreach F,$(FUN) $(INLINE_FUN),man/$(F).3) man/libzahl.7

all: libzahl.a

%.o: src/%.c $(HDR) config.mk
	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<

libzahl.a: $(OBJ)
	$(AR) rc $@ $?
	$(RANLIB) $@

test-random.c: test-generate.py
	./test-generate.py > test-random.c

test: test.c libzahl.a test-random.c
	$(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ test.c libzahl.a

check: test
	./test

clean:
	-rm -- *.o *.su *.a *.so test test-random.c 2>/dev/null

.PHONY: all check clean