/
Makefile
58 lines (49 loc) · 1.42 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
SYSTEM?=linux
PBKDF_BACKEND?=openssl
CC?=gcc
DEBUG?=no
WARNFLAGS= -Wsystem-headers -Werror -Wall -W -Wno-unused-parameter \
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
-Wold-style-definition -Wreturn-type -Wcast-qual -Wwrite-strings \
-Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts \
-Winline -Wnested-externs
SRCS= tcplay.c crc32.c safe_mem.c io.c hdr.c humanize.c
SRCS+= crypto.c generic_xts.c
OBJS= tcplay.o crc32.o safe_mem.o io.o hdr.o humanize.o
OBJS+= crypto.o generic_xts.o
CFLAGS+= $(WARNFLAGS)
ifeq (${DEBUG}, yes)
CFLAGS+= -O0 -g -DDEBUG
else
CFLAGS+= -O3
endif
ifeq (${SYSTEM}, linux)
LIBS+= -lgcrypt -ldevmapper -luuid
SRCS+= crypto-gcrypt.c
OBJS+= crypto-gcrypt.o
ifeq (${PBKDF_BACKEND}, gcrypt)
SRCS+= pbkdf2-gcrypt.c
OBJS+= pbkdf2-gcrypt.o
endif
ifeq (${PBKDF_BACKEND}, openssl)
SRCS+= pbkdf2-openssl.c
OBJS+= pbkdf2-openssl.o
LIBS+= -lcrypto
endif
endif
ifeq (${SYSTEM}, dragonfly)
LIBS+= -lcrypto -ldm -lprop
SRCS+= crypto-dev.c
OBJS+= crypto-dev.o
SRCS+= pbkdf2-openssl.c
OBJS+= pbkdf2-openssl.o
endif
program:
$(CC) $(CFLAGS) -o tc-play main.c $(SRCS) $(LIBS)
lib:
$(CC) $(CFLAGS) -c -fPIC tcplay_api.c $(SRCS)
$(CC) -shared -Wl,-version-script=tcplay.map -o libtcplay.so tcplay_api.o $(OBJS)
test:
gcc -O0 -g -L. -I. tcplay_api_test.c -ltcplay -lcrypto -ldm -lprop
clean:
rm -f tc-play libtcplay.so tc-play.core *.o ktrace.out