-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (44 loc) · 1.02 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
51
52
53
54
55
56
57
58
59
60
61
62
63
#
# Simple makefile to build the standalone Whirlwind implementation.
#
# Requires GNU make.
#
# Notes:
# o to produce debug builds, 'gmake'
# o to produce optimized builds, 'gmake OPTIMIZE=1'
# o to clean build products 'gmake clean' or 'gmake realclean'
#
CC = gcc
AR = ar
LD = $(CC)
OFLAGS = -O3
CFLAGS = -Wall -Wextra -g
ARFLAGS = rv
LDFLAGS =
ifneq ($(OPTIMIZE),)
CFLAGS += $(OFLAGS)
endif
libobjs = blake2b-ref.o whirlwind-rng.o
lib = ww.a
tests = t-ww bench-ww
objs = $(libobjs) $(addsuffix %.d, $(tests))
deps = $(objs:.o=.d)
all: $(tests)
t-ww: t-ww.o $(lib)
$(CC) -o $@ $(LDFLAGS) $^
bench-ww: bench-ww.o $(lib)
$(CC) -o $@ $(LDFLAGS) $^
$(lib): $(libobjs)
-rm -f $@
$(AR) $(ARFLAGS) $@ $^
.PHONY: clean
clean:
rm -f $(objs) $(lib) $(tests)
realclean: clean
rm -f $(deps)
%.o: %.c
$(CC) -MMD $(_MP) -MT '$@ $(@:.o=.d)' -MF "$(@:.o=.d)" $(CFLAGS) -c -o $@ $<
ifneq ($(findstring clean, $(MAKECMDGOALS)),clean)
-include $(deps)
endif
# vim: ft=make:noexpandtab:sw=4:ts=4:notextmode: