forked from aklomp/base64
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (50 loc) · 1.38 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
CFLAGS += -O3 -Wall -Wextra -pedantic
OBJS = \
lib/lib.o \
lib/codec_avx2.o \
lib/codec_choose.o \
lib/codec_neon32.o \
lib/codec_neon64.o \
lib/codec_plain.o \
lib/codec_ssse3.o
HAVE_AVX2 = 0
HAVE_NEON32 = 0
HAVE_NEON64 = 0
HAVE_SSSE3 = 0
# The user should supply compiler flags for the codecs they want to build.
# Check which codecs we're going to include:
ifdef AVX2_CFLAGS
HAVE_AVX2 = 1
endif
ifdef NEON32_CFLAGS
HAVE_NEON32 = 1
endif
ifdef NEON64_CFLAGS
HAVE_NEON64 = 1
endif
ifdef SSSE3_CFLAGS
HAVE_SSSE3 = 1
endif
.PHONY: all analyze clean
all: bin/base64 lib/libbase64.o
bin/base64: bin/base64.o lib/libbase64.o
$(CC) $(CFLAGS) -o $@ $^
lib/libbase64.o: $(OBJS)
$(LD) --relocatable -o $@ $^
objcopy --keep-global-symbols=lib/exports.txt $@
lib/config.h:
@echo "#define HAVE_AVX2 $(HAVE_AVX2)" > $@
@echo "#define HAVE_NEON32 $(HAVE_NEON32)" >> $@
@echo "#define HAVE_NEON64 $(HAVE_NEON64)" >> $@
@echo "#define HAVE_SSSE3 $(HAVE_SSSE3)" >> $@
lib/codec_choose.o: lib/config.h
lib/codec_avx2.o: CFLAGS += $(AVX2_CFLAGS)
lib/codec_neon32.o: CFLAGS += $(NEON32_CFLAGS)
lib/codec_neon64.o: CFLAGS += $(NEON64_CFLAGS)
lib/codec_ssse3.o: CFLAGS += $(SSSE3_CFLAGS)
%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<
analyze: clean
scan-build --use-analyzer=`which clang` --status-bugs make
clean:
rm -f bin/base64 bin/base64.o lib/libbase64.o lib/config.h $(OBJS)