135375f98Sopenharmony_ciCC = gcc 235375f98Sopenharmony_ciifeq ($(shell uname -s), Darwin) 335375f98Sopenharmony_ciCC = clang 435375f98Sopenharmony_ciendif 535375f98Sopenharmony_ci#DEBUG = -O0 -g 635375f98Sopenharmony_ciCFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror 735375f98Sopenharmony_ciCFLAGS += $(DEBUG) 835375f98Sopenharmony_ciDEFINES = -D UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar 935375f98Sopenharmony_ciifeq ($(OS),Windows_NT) 1035375f98Sopenharmony_ci DEFINES += -D UNITY_OUTPUT_CHAR_HEADER_DECLARATION=UnityOutputCharSpy_OutputChar(int) 1135375f98Sopenharmony_cielse 1235375f98Sopenharmony_ci DEFINES += -D UNITY_OUTPUT_CHAR_HEADER_DECLARATION=UnityOutputCharSpy_OutputChar\(int\) 1335375f98Sopenharmony_ciendif 1435375f98Sopenharmony_ciSRC = ../src/unity_memory.c \ 1535375f98Sopenharmony_ci ../../../src/unity.c \ 1635375f98Sopenharmony_ci unity_memory_Test.c \ 1735375f98Sopenharmony_ci unity_memory_TestRunner.c \ 1835375f98Sopenharmony_ci unity_output_Spy.c \ 1935375f98Sopenharmony_ci 2035375f98Sopenharmony_ciINC_DIR = -I../src -I../../../src/ 2135375f98Sopenharmony_ciBUILD_DIR = ../build 2235375f98Sopenharmony_ciTARGET = ../build/memory_tests.exe 2335375f98Sopenharmony_ci 2435375f98Sopenharmony_ciall: default noStdlibMalloc 32bits 2535375f98Sopenharmony_ci 2635375f98Sopenharmony_cidefault: $(BUILD_DIR) 2735375f98Sopenharmony_ci $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_SUPPORT_64 2835375f98Sopenharmony_ci @ echo "default build" 2935375f98Sopenharmony_ci ./$(TARGET) 3035375f98Sopenharmony_ci 3135375f98Sopenharmony_ci32bits: $(BUILD_DIR) 3235375f98Sopenharmony_ci $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m32 3335375f98Sopenharmony_ci @ echo "32bits build" 3435375f98Sopenharmony_ci ./$(TARGET) 3535375f98Sopenharmony_ci 3635375f98Sopenharmony_cinoStdlibMalloc: $(BUILD_DIR) 3735375f98Sopenharmony_ci $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_EXCLUDE_STDLIB_MALLOC 3835375f98Sopenharmony_ci @ echo "build with noStdlibMalloc" 3935375f98Sopenharmony_ci ./$(TARGET) 4035375f98Sopenharmony_ci 4135375f98Sopenharmony_ciC89: CFLAGS += -D UNITY_EXCLUDE_STDINT_H # C89 did not have type 'long long', <stdint.h> 4235375f98Sopenharmony_ciC89: $(BUILD_DIR) 4335375f98Sopenharmony_ci $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -std=c89 && ./$(TARGET) 4435375f98Sopenharmony_ci $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_EXCLUDE_STDLIB_MALLOC -std=c89 4535375f98Sopenharmony_ci ./$(TARGET) 4635375f98Sopenharmony_ci 4735375f98Sopenharmony_ci$(BUILD_DIR): 4835375f98Sopenharmony_ci mkdir -p $(BUILD_DIR) 4935375f98Sopenharmony_ci 5035375f98Sopenharmony_ciclean: 5135375f98Sopenharmony_ci rm -f $(TARGET) $(BUILD_DIR)/*.gc* 5235375f98Sopenharmony_ci 5335375f98Sopenharmony_cicov: $(BUILD_DIR) 5435375f98Sopenharmony_ci cd $(BUILD_DIR) && \ 5535375f98Sopenharmony_ci $(CC) $(DEFINES) $(foreach i, $(SRC), ../test/$(i)) $(INC_DIR) -o $(TARGET) -fprofile-arcs -ftest-coverage 5635375f98Sopenharmony_ci rm -f $(BUILD_DIR)/*.gcda 5735375f98Sopenharmony_ci ./$(TARGET) > /dev/null ; ./$(TARGET) -v > /dev/null 5835375f98Sopenharmony_ci cd $(BUILD_DIR) && \ 5935375f98Sopenharmony_ci gcov unity_memory.c | head -3 6035375f98Sopenharmony_ci grep '###' $(BUILD_DIR)/unity_memory.c.gcov -C2 || true # Show uncovered lines 6135375f98Sopenharmony_ci 6235375f98Sopenharmony_ci# These extended flags DO get included before any target build runs 6335375f98Sopenharmony_ciCFLAGS += -Wbad-function-cast 6435375f98Sopenharmony_ciCFLAGS += -Wcast-qual 6535375f98Sopenharmony_ciCFLAGS += -Wconversion 6635375f98Sopenharmony_ciCFLAGS += -Wformat=2 6735375f98Sopenharmony_ciCFLAGS += -Wmissing-prototypes 6835375f98Sopenharmony_ciCFLAGS += -Wold-style-definition 6935375f98Sopenharmony_ciCFLAGS += -Wpointer-arith 7035375f98Sopenharmony_ciCFLAGS += -Wshadow 7135375f98Sopenharmony_ciCFLAGS += -Wstrict-overflow=5 7235375f98Sopenharmony_ciCFLAGS += -Wstrict-prototypes 7335375f98Sopenharmony_ciCFLAGS += -Wswitch-default 7435375f98Sopenharmony_ciCFLAGS += -Wundef 7535375f98Sopenharmony_ciCFLAGS += -Wno-error=undef # Warning only, this should not stop the build 7635375f98Sopenharmony_ciCFLAGS += -Wunreachable-code 7735375f98Sopenharmony_ciCFLAGS += -Wunused 7835375f98Sopenharmony_ciCFLAGS += -fstrict-aliasing 79