-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (38 loc) · 983 Bytes
/
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
SOURCES := $(wildcard *.c)
OBJECTS := $(SOURCES:.c=.o)
HEADERS := $(wildcard *.h)
TARGETS := kem-enc
TSOURCE := $(wildcard tests/*.c)
TESTS := $(TSOURCE:.c=)
COMMON := -O0 -Wall #Use -O0 to avoid optimizations -- helpful for debugging purposes
CFLAGS := $(CFLAGS) $(COMMON)
CC := gcc
LDADD := -lcrypto -lssl -lgmp
LD := $(CC)
LDFLAGS := # -L/usr/local/lib/
DEFS :=
ifeq ($(shell uname),Linux)
DEFS += -DLINUX
endif
IMPL := ske.o rsa.o kem-enc.o
ifdef skel
IMPL := $(IMPL:.o=-skel.o)
endif
all : $(TARGETS)
.PHONY : all
# {{{ for debugging
debug : CFLAGS += -g -DDEBUG=1
debug : $(TARGETS) $(TESTS)
.PHONY : debug
# }}}
$(OBJECTS) : %.o : %.c $(HEADERS)
$(CC) $(CFLAGS) -c $< -o $@
$(TARGETS) : $(IMPL) prf.o
$(LD) $(LDFLAGS) -o $@ $^ $(LDADD)
tests : $(TESTS)
.PHONY : tests
$(TESTS) : % : %.o $(filter-out kem-enc.o,$(IMPL)) prf.o
$(LD) $(LDFLAGS) -o $@ $^ $(LDADD)
.PHONY : clean
clean :
rm -f $(OBJECTS) $(TARGETS) $(TESTS) $(TSOURCE:.c=.o)