shachain: allow overriding of number of bits, add cmdline tool.
[ccan] / ccan / crypto / shachain / tools / Makefile
1 #! /usr/bin/make
2
3 CCANDIR=../../../..
4 CFLAGS=-Wall -Werror -O3 -I$(CCANDIR) -DSHACHAIN_BITS=48
5 #CFLAGS=-Wall -Werror -g3 -I$(CCANDIR) -DSHACHAIN_BITS=48
6
7 # 48 bit index for shachain.  This is what lightning uses.
8 CCAN_OBJS:=ccan-str.o ccan-err.o ccan-hex.o ccan-shachain.o ccan-sha256.o ccan-rbuf.o
9
10 all: shachain48
11
12 shachain48: shachain48.o $(CCAN_OBJS)
13
14 shachain48.o: $(CCANDIR)/ccan/crypto/shachain/shachain.h        \
15         $(CCANDIR)/ccan/str/hex/hex.h                   \
16         $(CCANDIR)/ccan/str/str.h                               \
17         $(CCANDIR)/ccan/err/err.h                               \
18         $(CCANDIR)/ccan/rbuf/rbuf.h
19
20 shachain48.o $(CCAN_OBJS): $(CCANDIR)/config.h
21
22 $(CCANDIR)/config.h:
23         $(MAKE) -C $(CCANDIR) config.h
24
25 clean:
26         rm -f shachain *.o
27
28 ccan-err.o: $(CCANDIR)/ccan/err/err.c
29         $(CC) $(CFLAGS) -c -o $@ $<
30 ccan-hex.o: $(CCANDIR)/ccan/str/hex/hex.c
31         $(CC) $(CFLAGS) -c -o $@ $<
32 ccan-str.o: $(CCANDIR)/ccan/str/str.c
33         $(CC) $(CFLAGS) -c -o $@ $<
34 ccan-shachain.o: $(CCANDIR)/ccan/crypto/shachain/shachain.c
35         $(CC) $(CFLAGS) -c -o $@ $<
36 ccan-sha256.o: $(CCANDIR)/ccan/crypto/sha256/sha256.c
37         $(CC) $(CFLAGS) -c -o $@ $<
38 ccan-rbuf.o: $(CCANDIR)/ccan/rbuf/rbuf.c
39         $(CC) $(CFLAGS) -c -o $@ $<