Debian Codegraph @

vendor/unity/extras/memory/test/Makefile

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