File: Makefile

package info (click to toggle)
aws-crt-python 0.16.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 78,328 kB
  • sloc: ansic: 330,743; python: 18,949; makefile: 6,271; sh: 3,712; asm: 754; cpp: 699; ruby: 208; java: 77; perl: 73; javascript: 46; xml: 11
file content (76 lines) | stat: -rw-r--r-- 2,128 bytes parent folder | download | duplicates (2)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
#  http://aws.amazon.com/apache2.0
#
# or in the "license" file accompanying this file. This file is distributed
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.
#

SRCS=$(wildcard *.c)
OBJS=$(SRCS:.c=.o)
TESTS=$(SRCS:.c=)
CRYPTO_LDFLAGS = -L$(LIBCRYPTO_ROOT)/lib
SHELL:=/bin/bash


ifndef LIBFUZZER_ROOT
    export LIBFUZZER_ROOT = $(shell echo "../../fuzz_dependencies")
endif

ifndef FUZZ_TIMEOUT_SEC
    export FUZZ_TIMEOUT_SEC=120
endif

ifndef FUZZ_TESTS
    export FUZZ_TESTS=${TESTS}
endif

.PHONY : all
all : run_tests

include ../../s2n.mk

CRUFT += $(wildcard *_test) $(wildcard fuzz-*.log) $(wildcard *_test_output.txt) $(wildcard *_test_results.txt) $(wildcard LD_PRELOAD/*.so) $(wildcard *.prof*)

CFLAGS += -Wno-unreachable-code -O0 -I$(LIBCRYPTO_ROOT)/include/ -I../
LIBS += -L../testlib/ -ltests2n -L../../lib/ -ls2n
LDFLAGS += $(LIBFUZZER_ROOT)/lib/libFuzzer.a -lstdc++
LDFLAGS += ${CRYPTO_LDFLAGS} ${LIBS} ${CRYPTO_LIBS} -lm -ldl -lrt -pthread

DYLD_LIBRARY_PATH="../../lib/:../testlib/:$(LIBCRYPTO_ROOT)/lib:$$DYLD_LIBRARY_PATH"
LD_LIBRARY_PATH="../../lib/:../testlib/:$(LIBCRYPTO_ROOT)/lib:$$LD_LIBRARY_PATH"

ifdef AFL_FUZZ
    ifneq ($(FUZZ_COVERAGE), true)
        CFLAGS += $(LIBFUZZER_ROOT)/FuzzingEngine.a
    endif
endif


ld-preload :
	${MAKE} -C LD_PRELOAD

$(TESTS)::
	@${CC} ${CFLAGS} $@.c -o $@  ${LDFLAGS}

run_tests:: $(FUZZ_TESTS) ld-preload
	{ set -e; \
	for test_name in ${FUZZ_TESTS} ; do \
	export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}; \
	export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}; \
	export LIBCRYPTO_ROOT=${LIBCRYPTO_ROOT}; \
	./runFuzzTest.sh $${test_name} ${FUZZ_TIMEOUT_SEC}; done; \
	}
	./calcTotalCov.sh

.PHONY : clean
clean: decruft
	${MAKE} -C LD_PRELOAD decruft
	rm -rf profiles