makefile 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. #We try to detect the OS we are running on, and adjust commands as needed
  7. ifeq ($(OS),Windows_NT)
  8. ifeq ($(shell uname -s),) # not in a bash-like shell
  9. CLEANUP = del /F /Q
  10. MKDIR = mkdir
  11. else # in a bash-like shell, like msys
  12. CLEANUP = rm -f
  13. MKDIR = mkdir -p
  14. endif
  15. TARGET_EXTENSION=.exe
  16. else
  17. CLEANUP = rm -f
  18. MKDIR = mkdir -p
  19. TARGET_EXTENSION=.out
  20. endif
  21. C_COMPILER=gcc
  22. ifeq ($(shell uname -s), Darwin)
  23. C_COMPILER=clang
  24. endif
  25. UNITY_ROOT=../..
  26. CFLAGS=-std=c99
  27. CFLAGS += -Wall
  28. CFLAGS += -Wextra
  29. CFLAGS += -Wpointer-arith
  30. CFLAGS += -Wcast-align
  31. CFLAGS += -Wwrite-strings
  32. CFLAGS += -Wswitch-default
  33. CFLAGS += -Wunreachable-code
  34. CFLAGS += -Winit-self
  35. CFLAGS += -Wmissing-field-initializers
  36. CFLAGS += -Wno-unknown-pragmas
  37. CFLAGS += -Wstrict-prototypes
  38. CFLAGS += -Wundef
  39. CFLAGS += -Wold-style-definition
  40. TARGET_BASE1=all_tests
  41. TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION)
  42. SRC_FILES1=\
  43. $(UNITY_ROOT)/src/unity.c \
  44. $(UNITY_ROOT)/extras/fixture/src/unity_fixture.c \
  45. src/ProductionCode.c \
  46. src/ProductionCode2.c \
  47. test/TestProductionCode.c \
  48. test/TestProductionCode2.c \
  49. test/test_runners/TestProductionCode_Runner.c \
  50. test/test_runners/TestProductionCode2_Runner.c \
  51. test/test_runners/all_tests.c
  52. INC_DIRS=-Isrc -I$(UNITY_ROOT)/src -I$(UNITY_ROOT)/extras/fixture/src
  53. SYMBOLS=
  54. all: clean default
  55. default:
  56. $(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1)
  57. - ./$(TARGET1) -v
  58. clean:
  59. $(CLEANUP) $(TARGET1)
  60. ci: CFLAGS += -Werror
  61. ci: default