11cb0ef41Sopenharmony_ciCFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE
21cb0ef41Sopenharmony_ciifdef OPENMP
31cb0ef41Sopenharmony_ci  CFLAGS += -fopenmp
41cb0ef41Sopenharmony_ciendif
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciTARGET := $(shell $(CC) -dumpmachine)
71cb0ef41Sopenharmony_ciifneq (, $(findstring darwin, $(TARGET)))
81cb0ef41Sopenharmony_ci  BENCH_LDFLAGS=
91cb0ef41Sopenharmony_cielse ifneq (, $(findstring mingw, $(TARGET)))
101cb0ef41Sopenharmony_ci  BENCH_LDFLAGS=
111cb0ef41Sopenharmony_cielse
121cb0ef41Sopenharmony_ci  # default to linux, -lrt needed
131cb0ef41Sopenharmony_ci  BENCH_LDFLAGS=-lrt
141cb0ef41Sopenharmony_ciendif
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci.PHONY: clean test valgrind
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_citest: clean test_base64 benchmark
191cb0ef41Sopenharmony_ci	./test_base64
201cb0ef41Sopenharmony_ci	./benchmark
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_civalgrind: clean test_base64
231cb0ef41Sopenharmony_ci	valgrind --error-exitcode=2 ./test_base64
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_citest_base64: test_base64.c codec_supported.o ../lib/libbase64.o
261cb0ef41Sopenharmony_ci	$(CC) $(CFLAGS) -o $@ $^
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_cibenchmark: benchmark.c codec_supported.o ../lib/libbase64.o
291cb0ef41Sopenharmony_ci	$(CC) $(CFLAGS) -o $@ $^ $(BENCH_LDFLAGS)
301cb0ef41Sopenharmony_ci
311cb0ef41Sopenharmony_ci../%:
321cb0ef41Sopenharmony_ci	make -C .. $*
331cb0ef41Sopenharmony_ci
341cb0ef41Sopenharmony_ci%.o: %.c
351cb0ef41Sopenharmony_ci	$(CC) $(CFLAGS) -o $@ -c $<
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ciclean:
381cb0ef41Sopenharmony_ci	rm -f benchmark test_base64 *.o
39