blob: 24dc7bad737d1cd3ca30154f5c1670cc2c672676 [file] [log] [blame]
Philippe Antoine03e87d92019-06-04 19:37:52 +02001
2LOCAL_CFLAGS = -I../../include -D_FILE_OFFSET_BITS=64
3LOCAL_LDFLAGS = -L../../library \
4 -lmbedtls$(SHARED_SUFFIX) \
5 -lmbedx509$(SHARED_SUFFIX) \
6 -lmbedcrypto$(SHARED_SUFFIX)
7
Gilles Peskineaae57bf2020-03-09 17:30:32 +01008LOCAL_CFLAGS += $(patsubst -I../%,-I../../%,$(THIRDPARTY_INCLUDES))
Philippe Antoine03e87d92019-06-04 19:37:52 +02009
10ifndef SHARED
Gilles Peskineaae57bf2020-03-09 17:30:32 +010011DEP=../../library/libmbedcrypto.a ../../library/libmbedx509.a ../../library/libmbedtls.a
Philippe Antoine03e87d92019-06-04 19:37:52 +020012else
Gilles Peskineaae57bf2020-03-09 17:30:32 +010013DEP=../../library/libmbedcrypto.$(DLEXT) ../../library/libmbedx509.$(DLEXT) ../../library/libmbedtls.$(DLEXT)
Philippe Antoine03e87d92019-06-04 19:37:52 +020014endif
15
16
17DLEXT ?= so
18EXEXT=
19SHARED_SUFFIX=
20# python2 for POSIX since FreeBSD has only python2 as default.
21PYTHON ?= python2
22
23# Zlib shared library extensions:
24ifdef ZLIB
25LOCAL_LDFLAGS += -lz
26endif
27
28ifdef FUZZINGENGINE
29LOCAL_LDFLAGS += -lFuzzingEngine
30endif
31
32# A test application is built for each suites/test_suite_*.data file.
33# Application name is same as .data file's base name and can be
34# constructed by stripping path 'suites/' and extension .data.
35APPS = $(basename $(wildcard fuzz_*.c))
36
37# Construct executable name by adding OS specific suffix $(EXEXT).
38BINARIES := $(addsuffix $(EXEXT),$(APPS))
39
40.SILENT:
41
42.PHONY: all check test clean
43
44all: $(BINARIES)
45
46$(DEP):
47 $(MAKE) -C ../../library
48
49C_FILES := $(addsuffix .c,$(APPS))
50
51%.o: %.c
52 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c $< -o $@
53
54
55ifdef FUZZINGENGINE
56$(BINARIES): %$(EXEXT): %.o common.o $(DEP)
57 echo " $(CC) common.o $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@"
58 $(CXX) common.o $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
59else
60$(BINARIES): %$(EXEXT): %.o common.o onefile.o $(DEP)
61 echo " $(CC) common.o onefile.o $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@"
62 $(CC) common.o onefile.o $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
63endif
64
65clean:
66ifndef WINDOWS
67 rm -rf $(BINARIES) *.o
68else
Darryl Green9b9a7902019-08-30 14:51:55 +010069 if exist *.o del /Q /F *.o
70 if exist *.exe del /Q /F *.exe
Philippe Antoine03e87d92019-06-04 19:37:52 +020071endif