-
Notifications
You must be signed in to change notification settings - Fork 33
/
Makefile
67 lines (52 loc) · 1.77 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
64
65
66
67
.SUFFIXES:
.PHONY: all clean
.SUFFIXES: .cpp .o .c .h
all: unit basic_benchmark
CFLAGS = -fPIC -std=c99 -Wall -Wextra -Wshadow -Wpsabi -Wfatal-errors
HEADERS=./include/chromiumbase64.h \
./include/quicktimebase64.h \
./include/scalarbase64.h
OBJECTS=chromiumbase64.o \
quicktimebase64.o \
scalarbase64.o
SIMD ?= AVX2
ifeq ($(DEBUG), 1)
CFLAGS += -ggdb -fsanitize=undefined -fno-omit-frame-pointer -fsanitize=address
else
CFLAGS += -O3
endif # debug
ifeq ($(SIMD), AVX2)
CFLAGS += -march=native -mavx2 -DHAVE_AVX2
HEADERS += ./include/klompavxbase64.h \
./include/fastavxbase64.h
OBJECTS += klompavxbase64.o \
fastavxbase64.o
endif # AVX2
ifeq ($(SIMD), AVX512BW)
CFLAGS += -march=native -mavx512bw -DHAVE_AVX2 -DHAVE_AVX512BW
HEADERS += ./include/klompavxbase64.h \
./include/fastavxbase64.h \
./include/fastavx512bwbase64.h
OBJECTS += klompavxbase64.o \
fastavxbase64.o \
fastavx512bwbase64.o
endif # AVX512BW
ifeq ($(SIMD), ALTIVEC)
# -D_POSIX_C_SOURCE=199309L is needed to enable clock_gettime
CFLAGS += -mcpu=power9 -mtune=power9 -flax-vector-conversions -D_POSIX_C_SOURCE=199309L -DALTIVEC
HEADERS += ./include/altivecbase64.h
OBJECTS += altivecbase64.o
endif # AltiVec
%.o: ./src/%.c $(HEADERS)
$(CC) $(CFLAGS) -c $< -Iinclude
basic_benchmark: ./benchmarks/basic_benchmark.c ./benchmarks/benchmark.h $(HEADERS) $(OBJECTS)
$(CC) $(CFLAGS) -o $@ ./benchmarks/basic_benchmark.c -Iinclude $(OBJECTS)
unit: ./tests/unit.c $(HEADERS) $(OBJECTS)
$(CC) $(CFLAGS) -o unit ./tests/unit.c -Iinclude $(OBJECTS)
libfastbase64.so: $(OBJECTS)
$(CC) $(CFLAGS) -o libfastbase64.so $(OBJECTS) -shared
libfastbase64.a: $(OBJECTS)
ar -qcs $@ $(OBJECTS)
ranlib $@
clean:
rm -f unit basic_benchmark *.o