2024-03-16 23:15:00 -04:00
|
|
|
# =========================================================================
|
|
|
|
# Unity - A Test Framework for C
|
|
|
|
# ThrowTheSwitch.org
|
|
|
|
# Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
# =========================================================================
|
2013-07-17 22:48:50 +10:00
|
|
|
|
2014-11-03 19:39:37 -05:00
|
|
|
#We try to detect the OS we are running on, and adjust commands as needed
|
2017-01-18 08:13:41 -06:00
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
ifeq ($(shell uname -s),) # not in a bash-like shell
|
2014-11-03 19:39:37 -05:00
|
|
|
CLEANUP = del /F /Q
|
|
|
|
MKDIR = mkdir
|
2017-01-18 08:13:41 -06:00
|
|
|
else # in a bash-like shell, like msys
|
|
|
|
CLEANUP = rm -f
|
|
|
|
MKDIR = mkdir -p
|
|
|
|
endif
|
2014-11-03 19:39:37 -05:00
|
|
|
TARGET_EXTENSION=.exe
|
|
|
|
else
|
|
|
|
CLEANUP = rm -f
|
|
|
|
MKDIR = mkdir -p
|
|
|
|
TARGET_EXTENSION=.out
|
|
|
|
endif
|
|
|
|
|
2013-07-17 22:48:50 +10:00
|
|
|
C_COMPILER=gcc
|
2017-01-18 08:13:41 -06:00
|
|
|
ifeq ($(shell uname -s), Darwin)
|
|
|
|
C_COMPILER=clang
|
|
|
|
endif
|
|
|
|
|
|
|
|
UNITY_ROOT=../..
|
2015-01-18 00:32:47 +02:00
|
|
|
|
2015-09-09 21:13:33 +01:00
|
|
|
CFLAGS=-std=c89
|
2015-01-18 00:32:47 +02:00
|
|
|
CFLAGS += -Wall
|
|
|
|
CFLAGS += -Wextra
|
|
|
|
CFLAGS += -Wpointer-arith
|
|
|
|
CFLAGS += -Wcast-align
|
|
|
|
CFLAGS += -Wwrite-strings
|
|
|
|
CFLAGS += -Wswitch-default
|
|
|
|
CFLAGS += -Wunreachable-code
|
|
|
|
CFLAGS += -Winit-self
|
|
|
|
CFLAGS += -Wmissing-field-initializers
|
|
|
|
CFLAGS += -Wno-unknown-pragmas
|
|
|
|
CFLAGS += -Wstrict-prototypes
|
|
|
|
CFLAGS += -Wundef
|
|
|
|
CFLAGS += -Wold-style-definition
|
2019-10-30 09:00:53 -04:00
|
|
|
#CFLAGS += -Wno-misleading-indentation
|
2015-01-18 00:32:47 +02:00
|
|
|
|
2013-07-17 22:48:50 +10:00
|
|
|
TARGET_BASE1=test1
|
|
|
|
TARGET_BASE2=test2
|
|
|
|
TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION)
|
|
|
|
TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION)
|
|
|
|
SRC_FILES1=$(UNITY_ROOT)/src/unity.c src/ProductionCode.c test/TestProductionCode.c test/test_runners/TestProductionCode_Runner.c
|
|
|
|
SRC_FILES2=$(UNITY_ROOT)/src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/test_runners/TestProductionCode2_Runner.c
|
|
|
|
INC_DIRS=-Isrc -I$(UNITY_ROOT)/src
|
2017-01-18 08:13:41 -06:00
|
|
|
SYMBOLS=
|
2013-07-17 22:48:50 +10:00
|
|
|
|
|
|
|
all: clean default
|
|
|
|
|
2016-12-29 22:13:06 -06:00
|
|
|
default: $(SRC_FILES1) $(SRC_FILES2)
|
2014-11-01 21:47:04 +04:00
|
|
|
$(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1)
|
|
|
|
$(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2)
|
2016-12-29 22:13:06 -06:00
|
|
|
- ./$(TARGET1)
|
2019-10-21 11:27:28 -04:00
|
|
|
- ./$(TARGET2)
|
2013-07-17 22:48:50 +10:00
|
|
|
|
2016-12-29 22:13:06 -06:00
|
|
|
test/test_runners/TestProductionCode_Runner.c: test/TestProductionCode.c
|
|
|
|
ruby $(UNITY_ROOT)/auto/generate_test_runner.rb test/TestProductionCode.c test/test_runners/TestProductionCode_Runner.c
|
|
|
|
test/test_runners/TestProductionCode2_Runner.c: test/TestProductionCode2.c
|
|
|
|
ruby $(UNITY_ROOT)/auto/generate_test_runner.rb test/TestProductionCode2.c test/test_runners/TestProductionCode2_Runner.c
|
|
|
|
|
2013-07-17 22:48:50 +10:00
|
|
|
clean:
|
2016-12-29 22:13:06 -06:00
|
|
|
$(CLEANUP) $(TARGET1) $(TARGET2)
|
2013-07-17 22:48:50 +10:00
|
|
|
|
2017-01-18 22:18:11 -06:00
|
|
|
ci: CFLAGS += -Werror
|
|
|
|
ci: default
|