| 1 |
# ========================================== |
| 2 |
# Unity Project - A Test Framework for C |
| 3 |
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams |
| 4 |
# [Released under MIT License. Please refer to license.txt for details] |
| 5 |
# ========================================== |
| 6 |
|
| 7 |
#We try to detect the OS we are running on, and adjust commands as needed |
| 8 |
ifeq ($(OS),Windows_NT) |
| 9 |
ifeq ($(shell uname -s),) # not in a bash-like shell |
| 10 |
CLEANUP = del /F /Q |
| 11 |
MKDIR = mkdir |
| 12 |
else # in a bash-like shell, like msys |
| 13 |
CLEANUP = rm -f |
| 14 |
MKDIR = mkdir -p |
| 15 |
endif |
| 16 |
TARGET_EXTENSION=.exe |
| 17 |
else |
| 18 |
CLEANUP = rm -f |
| 19 |
MKDIR = mkdir -p |
| 20 |
TARGET_EXTENSION=.out |
| 21 |
endif |
| 22 |
|
| 23 |
C_COMPILER=gcc |
| 24 |
ifeq ($(shell uname -s), Darwin) |
| 25 |
C_COMPILER=clang |
| 26 |
endif |
| 27 |
|
| 28 |
UNITY_ROOT=../.. |
| 29 |
|
| 30 |
CFLAGS=-std=c89 |
| 31 |
CFLAGS += -Wall |
| 32 |
CFLAGS += -Wextra |
| 33 |
CFLAGS += -Wpointer-arith |
| 34 |
CFLAGS += -Wcast-align |
| 35 |
CFLAGS += -Wwrite-strings |
| 36 |
CFLAGS += -Wswitch-default |
| 37 |
CFLAGS += -Wunreachable-code |
| 38 |
CFLAGS += -Winit-self |
| 39 |
CFLAGS += -Wmissing-field-initializers |
| 40 |
CFLAGS += -Wno-unknown-pragmas |
| 41 |
CFLAGS += -Wstrict-prototypes |
| 42 |
CFLAGS += -Wundef |
| 43 |
CFLAGS += -Wold-style-definition |
| 44 |
#CFLAGS += -Wno-misleading-indentation |
| 45 |
|
| 46 |
TARGET_BASE1=test1 |
| 47 |
TARGET_BASE2=test2 |
| 48 |
TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) |
| 49 |
TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION) |
| 50 |
SRC_FILES1=$(UNITY_ROOT)/src/unity.c src/ProductionCode.c test/TestProductionCode.c test/test_runners/TestProductionCode_Runner.c |
| 51 |
SRC_FILES2=$(UNITY_ROOT)/src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/test_runners/TestProductionCode2_Runner.c |
| 52 |
INC_DIRS=-Isrc -I$(UNITY_ROOT)/src |
| 53 |
SYMBOLS= |
| 54 |
|
| 55 |
all: clean default |
| 56 |
|
| 57 |
default: $(SRC_FILES1) $(SRC_FILES2) |
| 58 |
$(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) |
| 59 |
$(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2) |
| 60 |
- ./$(TARGET1) |
| 61 |
- ./$(TARGET2) |
| 62 |
|
| 63 |
test/test_runners/TestProductionCode_Runner.c: test/TestProductionCode.c |
| 64 |
ruby $(UNITY_ROOT)/auto/generate_test_runner.rb test/TestProductionCode.c test/test_runners/TestProductionCode_Runner.c |
| 65 |
test/test_runners/TestProductionCode2_Runner.c: test/TestProductionCode2.c |
| 66 |
ruby $(UNITY_ROOT)/auto/generate_test_runner.rb test/TestProductionCode2.c test/test_runners/TestProductionCode2_Runner.c |
| 67 |
|
| 68 |
clean: |
| 69 |
$(CLEANUP) $(TARGET1) $(TARGET2) |
| 70 |
|
| 71 |
ci: CFLAGS += -Werror |
| 72 |
ci: default |