1CFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE
2ifdef OPENMP
3  CFLAGS += -fopenmp
4endif
5
6TARGET := $(shell $(CC) -dumpmachine)
7ifneq (, $(findstring darwin, $(TARGET)))
8  BENCH_LDFLAGS=
9else ifneq (, $(findstring mingw, $(TARGET)))
10  BENCH_LDFLAGS=
11else
12  # default to linux, -lrt needed
13  BENCH_LDFLAGS=-lrt
14endif
15
16.PHONY: clean test valgrind
17
18test: clean test_base64 benchmark
19	./test_base64
20	./benchmark
21
22valgrind: clean test_base64
23	valgrind --error-exitcode=2 ./test_base64
24
25test_base64: test_base64.c codec_supported.o ../lib/libbase64.o
26	$(CC) $(CFLAGS) -o $@ $^
27
28benchmark: benchmark.c codec_supported.o ../lib/libbase64.o
29	$(CC) $(CFLAGS) -o $@ $^ $(BENCH_LDFLAGS)
30
31../%:
32	make -C .. $*
33
34%.o: %.c
35	$(CC) $(CFLAGS) -o $@ -c $<
36
37clean:
38	rm -f benchmark test_base64 *.o
39