makefile 1.8 KB
Newer Older
W
Warwick Stone 已提交
1 2 3 4 5 6
# ==========================================
#   Unity Project - A Test Framework for C
#   Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
#   [Released under MIT License. Please refer to license.txt for details]
# ==========================================

7 8 9 10 11
#We try to detect the OS we are running on, and adjust commands as needed
ifeq ($(OSTYPE),cygwin)
	CLEANUP = rm -f
	MKDIR = mkdir -p
	TARGET_EXTENSION=.out
T
ThingamaByte, LLC 已提交
12 13 14 15 16
elseifeq ($(OSTYPE),msys)
    CLEANUP = rm -f
	MKDIR = mkdir -p
	TARGET_EXTENSION=.exe
elseifeq ($(OS),Windows_NT)
17 18
	CLEANUP = del /F /Q
	MKDIR = mkdir
W
Warwick Stone 已提交
19 20
	TARGET_EXTENSION=.exe
else
21 22
	CLEANUP = rm -f
	MKDIR = mkdir -p
W
Warwick Stone 已提交
23 24
	TARGET_EXTENSION=.out
endif
25 26 27

UNITY_ROOT=../..
C_COMPILER=gcc
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

CFLAGS = -std=c99
CFLAGS += -Wall
CFLAGS += -Wextra
CFLAGS += -Werror 
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
CFLAGS += -Wmissing-prototypes
CFLAGS += -Wmissing-declarations
46
CFLAGS += -DUNITY_FIXTURES
47

48
TARGET_BASE1=all_tests
W
Warwick Stone 已提交
49
TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION)
W
Warwick Stone 已提交
50 51 52 53 54 55 56 57 58 59
SRC_FILES1=\
  $(UNITY_ROOT)/src/unity.c \
  $(UNITY_ROOT)/extras/fixture/src/unity_fixture.c \
  src/ProductionCode.c \
  src/ProductionCode2.c \
  test/TestProductionCode.c \
  test/TestProductionCode2.c \
  test/test_runners/TestProductionCode_Runner.c \
  test/test_runners/TestProductionCode2_Runner.c \
  test/test_runners/all_tests.c
W
Warwick Stone 已提交
60 61 62 63 64 65
INC_DIRS=-Isrc -I$(UNITY_ROOT)/src -I$(UNITY_ROOT)/extras/fixture/src
SYMBOLS=

all: clean default

default:
66
	$(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1)
67
	./$(TARGET1) -v
W
Warwick Stone 已提交
68 69 70 71

clean:
	$(CLEANUP)