Introduction
Introduction Statistics Contact Development Disclaimer Help
Makefile - libzahl - big integer library
git clone git://git.suckless.org/libzahl
Log
Files
Refs
README
LICENSE
---
Makefile (5457B)
---
1 CONFIG = config.mk
2 include $(CONFIG)
3
4 HDR_SEMIPUBLIC =\
5 zahl/inlines.h\
6 zahl/internals.h\
7 zahl/memory.h
8
9 HDR_PRIVATE =\
10 src/internals.h
11
12 FUN =\
13 zadd\
14 zand\
15 zbset\
16 zdivmod\
17 zerror\
18 zfree\
19 zgcd\
20 zload\
21 zlsh\
22 zmodmul\
23 zmodpow\
24 zmodpowu\
25 zmodsqr\
26 zmul\
27 znot\
28 zor\
29 zperror\
30 zpow\
31 zpowu\
32 zptest\
33 zrand\
34 zrsh\
35 zsets\
36 zsetup\
37 zsqr\
38 zstr\
39 zstr_length\
40 zsub\
41 ztrunc\
42 zunsetup\
43 zxor
44
45 INLINE_FUN =\
46 zabs\
47 zbits\
48 zbtest\
49 zcmp\
50 zcmpi\
51 zcmpmag\
52 zcmpu\
53 zdiv\
54 zeven\
55 zeven_nonzero\
56 zinit\
57 zlsb\
58 zmod\
59 zneg\
60 zodd\
61 zodd_nonzero\
62 zsave\
63 zset\
64 zseti\
65 zsetu\
66 zsignum\
67 zsplit\
68 zswap\
69 zzero
70
71 DOC =\
72 refsheet.pdf\
73 libzahl.pdf
74
75 TEXSRC =\
76 doc/libzahl.tex\
77 doc/what-is-libzahl.tex\
78 doc/libzahls-design.tex\
79 doc/get-started.tex\
80 doc/miscellaneous.tex\
81 doc/arithmetic.tex\
82 doc/bit-operations.tex\
83 doc/number-theory.tex\
84 doc/random-numbers.tex\
85 doc/not-implemented.tex\
86 doc/exercises.tex
87
88 HDR_PUBLIC = zahl.h $(HDR_SEMIPUBLIC)
89 HDR = $(HDR_PUBLIC) $(HDR_PRIVATE)
90 OBJ = $(FUN:=.o) allocator.o
91 MAN3 = $(FUN:=.3) $(INLINE_FUN:=.3)
92 MAN7 = libzahl.7
93
94 VPATH = src
95
96 BENCHMARK_LIB_ = libzahl.a
97 BENCHMARK_LIB_zahl = libzahl.a
98 BENCHMARK_LIB_libzahl = libzahl.a
99 BENCHMARK_LIB_tommath = -ltommath
100 BENCHMARK_LIB_libtommath = -ltommath
101 BENCHMARK_LIB_gmp = -lgmp
102 BENCHMARK_LIB_libgmp = -lgmp
103 BENCHMARK_LIB_tfm = libtfm.a
104 BENCHMARK_LIB_libtfm = libtfm.a
105 BENCHMARK_LIB_hebimath = libhebimath.a
106 BENCHMARK_LIB_libhebimath = libhebimath.a
107
108 BENCHMARK_DEP_ = libzahl.a
109 BENCHMARK_DEP_zahl = libzahl.a
110 BENCHMARK_DEP_libzahl = libzahl.a
111 BENCHMARK_DEP_tommath = bench/libtommath.h
112 BENCHMARK_DEP_libtommath = bench/libtommath.h
113 BENCHMARK_DEP_gmp = bench/libgmp.h
114 BENCHMARK_DEP_libgmp = bench/libgmp.h
115 BENCHMARK_DEP_tfm = bench/libtfm.h
116 BENCHMARK_DEP_libtfm = bench/libtfm.h
117 BENCHMARK_DEP_hebimath = bench/libhebimath.h
118 BENCHMARK_DEP_libhebimath = bench/libhebimath.h
119
120 BENCHMARK_CPP_tommath = '-DBENCHMARK_LIB="libtommath.h"'
121 BENCHMARK_CPP_libtommath = '-DBENCHMARK_LIB="libtommath.h"'
122 BENCHMARK_CPP_gmp = '-DBENCHMARK_LIB="libgmp.h"'
123 BENCHMARK_CPP_libgmp = '-DBENCHMARK_LIB="libgmp.h"'
124 BENCHMARK_CPP_tfm = '-DBENCHMARK_LIB="libtfm.h"'
125 BENCHMARK_CPP_libtfm = '-DBENCHMARK_LIB="libtfm.h"'
126 BENCHMARK_CPP_hebimath = '-DBENCHMARK_LIB="libhebimath.h"'
127 BENCHMARK_CPP_libhebimath = '-DBENCHMARK_LIB="libhebimath.h"'
128
129 BENCHMARK_C_hebimath = -static
130 BENCHMARK_C_libhebimath = -static
131
132 CPPFLAGS += $(BENCHMARK_CPP_$(BENCHMARK_LIB))
133
134 CFLAGS_WITHOUT_O = $$(printf '%s\n' $(CFLAGS) | sed '/^-O.*$$/d')
135
136
137 all: libzahl.a $(DOC)
138
139 .o: .c $(HDR) $(CONFIG)
140 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
141
142 libzahl.a: $(OBJ)
143 $(AR) -rcs $@ $?
144
145 test-random.c: test-generate.py
146 ./test-generate.py > test-random.c
147
148 test: test.c libzahl.a test-random.c
149 $(CC) $(LDFLAGS) $(CFLAGS_WITHOUT_O) -O0 $(CPPFLAGS) -o $@ test.…
150
151 benchmark: bench/benchmark.c bench/util.c bench/util.h $(BENCHMARK_DEP_$…
152 $(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ bench/benchmark.c b…
153 $(BENCHMARK_LIB_$(BENCHMARK_LIB)) $(BENCHMARK_C_$(BENCHM…
154
155 benchmark-func: bench/benchmark-func.c bench/util.c bench/util.h $(BENCH…
156 $(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ bench/benchmark-fun…
157 $(BENCHMARK_LIB_$(BENCHMARK_LIB)) $(BENCHMARK_C_$(BENCHM…
158
159 benchmark-zrand: bench/benchmark-zrand.c bench/util.c bench/util.h libza…
160 $(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ bench/benchmark-zra…
161
162 refsheet.pdf: doc/refsheet.tex
163 pdflatex doc/refsheet.tex </dev/null
164 pdflatex doc/refsheet.tex </dev/null
165 -@printf 'refsheet.%s\n' aux log | xargs rm -- 2>/dev/null
166
167 libzahl.pdf: $(TEXSRC)
168 pdflatex doc/libzahl.tex </dev/null
169 pdflatex doc/libzahl.tex </dev/null
170 -@printf 'libzahl.%s\n' aux idx log maf toc out | xargs rm -- li…
171
172 check: test
173 ./test
174
175 install: libzahl.a
176 mkdir -p -- "$(DESTDIR)$(EXECPREFIX)/lib"
177 mkdir -p -- "$(DESTDIR)$(PREFIX)/include/zahl"
178 mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man3"
179 mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man7"
180 mkdir -p -- "$(DESTDIR)$(DOCPREFIX)/libzahl"
181 @if test -n "$(DESTDIR)"; then \
182 cd man && test -d "$(DESTDIR)$(MANPREFIX)/man7" || \
183 (printf '\n\n!! DESTDIR must be an absolute path. !!\n…
184 fi
185 cp -- libzahl.a "$(DESTDIR)$(EXECPREFIX)/lib"
186 cp -- zahl.h "$(DESTDIR)$(PREFIX)/include"
187 cp -- $(HDR_SEMIPUBLIC) "$(DESTDIR)$(PREFIX)/include/zahl"
188 cd man && cp -- $(MAN3) "$(DESTDIR)$(MANPREFIX)/man3"
189 cd man && cp -- $(MAN7) "$(DESTDIR)$(MANPREFIX)/man7"
190 cp -- $(DOC) "$(DESTDIR)$(DOCPREFIX)/libzahl"
191
192 uninstall:
193 -rm -- "$(DESTDIR)$(EXECPREFIX)/lib/libzahl.a"
194 -cd -- "$(DESTDIR)$(PREFIX)/include" && rm $(HDR_PUBLIC)
195 -rmdir -- "$(DESTDIR)$(PREFIX)/include/zahl"
196 -cd -- "$(DESTDIR)$(MANPREFIX)/man3" && rm $(MAN3)
197 -cd -- "$(DESTDIR)$(MANPREFIX)/man7" && rm $(MAN7)
198 -cd -- "$(DESTDIR)$(DOCPREFIX)/libzahl" && rm $(DOC)
199 -rmdir -- "$(DESTDIR)$(DOCPREFIX)/libzahl"
200
201 clean:
202 -rm -- *.o *.su *.a *.so test test-random.c 2>/dev/null
203 -rm -- benchmark benchmark-zrand benchmark-func 2>/dev/null
204 -rm -- *.aux *.log *.out *.idx *.maf *.mtc* *.toc 2>/dev/null
205 -rm -- refsheet.pdf refsheet.dvi refsheet.ps 2>/dev/null
206 -rm -- libzahl.pdf libzahl.dvi libzahl.ps 2>/dev/null
207
208 .PHONY: all check clean install uninstall
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.