interplane.Get Omega
Read in your language

cJSON

[Ported from github.com/DaveGamble/cJSON] Fix: heap-use-after-free in merge_patch when patch is subtree of target (#1065)

Brought by drakestapleton

branch master Branches Tags History

cJSON / tests / unity / extras / fixture / test / Makefile

75 lines · 2314 bytes Raw Blame History
1CC = gcc
2ifeq ($(shell uname -s), Darwin)
3CC = clang
4endif
5#DEBUG = -O0 -g
6CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror
7CFLAGS += $(DEBUG)
8DEFINES = -D UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar
9DEFINES += -D UNITY_OUTPUT_CHAR_HEADER_DECLARATION=UnityOutputCharSpy_OutputChar\(int\)
10SRC = ../src/unity_fixture.c \
11 ../../../src/unity.c \
12 unity_fixture_Test.c \
13 unity_fixture_TestRunner.c \
14 unity_output_Spy.c \
15 main/AllTests.c
16
17INC_DIR = -I../src -I../../../src/
18BUILD_DIR = ../build
19TARGET = ../build/fixture_tests.exe
20
21all: default noStdlibMalloc 32bits
22
23default: $(BUILD_DIR)
24 $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_SUPPORT_64
25 @ echo "default build"
26 ./$(TARGET)
27
2832bits: $(BUILD_DIR)
29 $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m32
30 @ echo "32bits build"
31 ./$(TARGET)
32
33noStdlibMalloc: $(BUILD_DIR)
34 $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_EXCLUDE_STDLIB_MALLOC
35 @ echo "build with noStdlibMalloc"
36 ./$(TARGET)
37
38C89: CFLAGS += -D UNITY_EXCLUDE_STDINT_H # C89 did not have type 'long long', <stdint.h>
39C89: $(BUILD_DIR)
40 $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -std=c89 && ./$(TARGET)
41 $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_EXCLUDE_STDLIB_MALLOC -std=c89
42 ./$(TARGET)
43
44$(BUILD_DIR):
45 mkdir -p $(BUILD_DIR)
46
47clean:
48 rm -f $(TARGET) $(BUILD_DIR)/*.gc*
49
50cov: $(BUILD_DIR)
51 cd $(BUILD_DIR) && \
52 $(CC) $(DEFINES) $(foreach i, $(SRC), ../test/$(i)) $(INC_DIR) -o $(TARGET) -fprofile-arcs -ftest-coverage
53 rm -f $(BUILD_DIR)/*.gcda
54 ./$(TARGET) > /dev/null ; ./$(TARGET) -v > /dev/null
55 cd $(BUILD_DIR) && \
56 gcov unity_fixture.c | head -3
57 grep '###' $(BUILD_DIR)/unity_fixture.c.gcov -C2 || true # Show uncovered lines
58
59# These extended flags DO get included before any target build runs
60CFLAGS += -Wbad-function-cast
61CFLAGS += -Wcast-qual
62CFLAGS += -Wconversion
63CFLAGS += -Wformat=2
64CFLAGS += -Wmissing-prototypes
65CFLAGS += -Wold-style-definition
66CFLAGS += -Wpointer-arith
67CFLAGS += -Wshadow
68CFLAGS += -Wstrict-overflow=5
69CFLAGS += -Wstrict-prototypes
70CFLAGS += -Wswitch-default
71CFLAGS += -Wundef
72CFLAGS += -Wno-error=undef # Warning only, this should not stop the build
73CFLAGS += -Wunreachable-code
74CFLAGS += -Wunused
75CFLAGS += -fstrict-aliasing