-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
50 lines (36 loc) · 1.55 KB
/
Makefile
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
BINDIR := $(PREFIX)/lib/pocketcrypt
INCDIR := $(PREFIX)/include/pocketcrypt
LIBDIR := $(PREFIX)/lib
CFLAGS := -march=native -O3 -Wall -Wfatal-errors
override CFLAGS += -I.
%:: %.c Makefile
$(CC) $(CFLAGS) -o $@ $(filter %.c,$^)
test: $(basename $(wildcard test/*.c))
@echo $(foreach TEST,$^,&& $(TEST))
test/duplex-known test/duplex-sanity test/duplex-speed: duplex.h
test/gimli-known test/gimli-sanity test/gimli-speed: duplex.h
test/shamir-known test/shamir-sanity test/shamir-speed: shamir.[ch]
test/x25519-known test/x25519-sanity test/x25519-speed: x25519.[ch]
tools: $(basename $(wildcard tools/*.c))
tools/cloak tools/reveal: duplex.h swirl.h
tools/decrypt tools/encrypt tools/sign tools/verify: duplex.h x25519.[ch]
tools/keymerge tools/keysplit: shamir.[ch]
tools/keypair: x25519.[ch]
libpocketcrypt.so: shamir.c x25519.c Makefile
$(CC) $(CFLAGS) -fpic -shared -o $@ $(filter %.c,$^)
libpocketcrypt.a: shamir.c x25519.c Makefile
$(CC) $(CFLAGS) -c $(filter %.c,$^)
$(AR) rcs $@ $(patsubst %.c,%.o,$(filter %.c,$^))
install-headers:
mkdir -p $(DESTDIR)$(INCDIR) $(DESTDIR)$(LIBDIR)
install -m 0644 $(wildcard *.h) $(DESTDIR)$(INCDIR)
install-shared: install-headers libpocketcrypt.so
install -m 0644 libpocketcrypt.so $(DESTDIR)$(LIBDIR)
install-static: install-headers libpocketcrypt.a
install -m 0644 libpocketcrypt.a $(DESTDIR)$(LIBDIR)
install-tools: $(basename $(wildcard tools/*.c))
mkdir -p $(DESTDIR)$(BINDIR)
install -s $^ $(DESTDIR)$(BINDIR)
clean:
rm -f $(basename $(wildcard test/*.c tools/*.c)) *.a *.o *.so
.PHONY: clean install-* test tools