-
Notifications
You must be signed in to change notification settings - Fork 161
/
Makefile
38 lines (29 loc) · 798 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
CFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE
ifdef OPENMP
CFLAGS += -fopenmp
endif
TARGET := $(shell $(CC) -dumpmachine)
ifneq (, $(findstring darwin, $(TARGET)))
BENCH_LDFLAGS=
else ifneq (, $(findstring mingw, $(TARGET)))
BENCH_LDFLAGS=
else
# default to linux, -lrt needed
BENCH_LDFLAGS=-lrt
endif
.PHONY: clean test valgrind
test: clean test_base64 benchmark
./test_base64
./benchmark
valgrind: clean test_base64
valgrind --error-exitcode=2 ./test_base64
test_base64: test_base64.c codec_supported.o ../lib/libbase64.o
$(CC) $(CFLAGS) -o $@ $^
benchmark: benchmark.c codec_supported.o ../lib/libbase64.o
$(CC) $(CFLAGS) -o $@ $^ $(BENCH_LDFLAGS)
../%:
make -C .. $*
%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<
clean:
rm -f benchmark test_base64 *.o