makefile.test 2.48 KB
Newer Older
1
2
#
#             LUFA Library
Dean Camera's avatar
Dean Camera committed
3
#     Copyright (C) Dean Camera, 2017.
4
5
6
7
8
9
10
11
#
#  dean [at] fourwalledcubicle [dot] com
#           www.lufa-lib.org
#
# --------------------------------------
#         LUFA Project Makefile.
# --------------------------------------

12
13
# Run "make help" for target help.

14
15
MCU          =
ARCH         =
16
17
18
19
20
BOARD        = NONE
F_CPU        = $(F_USB)
OPTIMIZATION = 1
TARGET       = Test
SRC          = $(TARGET)_C.c $(TARGET)_CPP.cpp Dummy.S $(LUFA_SRC_USB)
21
LUFA_PATH    = ../../LUFA
22
DEBUG_LEVEL  = 0
23
24

ifeq ($(ARCH), AVR8)
25
  F_USB        = 8000000
26
else ifeq ($(ARCH), XMEGA)
27
  F_USB        = 48000000
28
else ifeq ($(ARCH), UC3)
29
  F_USB        = 48000000
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
endif

# Generic C/C++ compiler flags
CC_FLAGS  = -Wextra
CC_FLAGS += -Werror
CC_FLAGS += -Wformat=2
CC_FLAGS += -Winit-self
CC_FLAGS += -Wswitch-enum
CC_FLAGS += -Wunused
CC_FLAGS += -Wundef
CC_FLAGS += -Wpointer-arith
CC_FLAGS += -Wcast-align
CC_FLAGS += -Wwrite-strings
CC_FLAGS += -Wlogical-op
CC_FLAGS += -Wmissing-declarations
CC_FLAGS += -Wmissing-field-initializers
CC_FLAGS += -Wmissing-format-attribute
CC_FLAGS += -Woverlength-strings
48
CC_FLAGS += -Wswitch-default
49
50
51
52
53
54
55
56
CC_FLAGS += -Wfloat-equal
CC_FLAGS += -Waggregate-return
CC_FLAGS += -Wmissing-include-dirs

# Disable warnings not supported by the version of GCC used for UC3 targets (FIXME)
ifneq ($(ARCH), UC3)
  CC_FLAGS += -Wdouble-promotion
endif
57

58
# Only enable redundant declaration warnings for AVR8 target (FIXME)
59
ifeq ($(ARCH), AVR8)
60
  CC_FLAGS += -Wredundant-decls
61
62
63
64
endif

# C compiler only flags
C_FLAGS += -Wmissing-parameter-type
65
C_FLAGS += -Wmissing-prototypes
66
C_FLAGS += -Wnested-externs
67
68
69
70
71
72
73
74
75
C_FLAGS += -Wbad-function-cast
C_FLAGS += -Wstrict-prototypes
C_FLAGS += -Wold-style-definition

# Disable warnings not supported by the version of GCC used for UC3 targets (FIXME)
ifneq ($(ARCH), UC3)
  C_FLAGS += -Wunsuffixed-float-constants
  C_FLAGS += -Wjump-misses-init
endif
76

77
# Only check C++ compatibility on the build files, to ensure headers are C++ compatible
78
Test_C.c Test_CPP.cpp: CC_FLAGS += -Wc++-compat
79

80
81
82
# Potential additional warnings to enable in the future (FIXME)
#CC_FLAGS += -Wcast-qual
#CC_FLAGS += -Wconversion
83
#CC_FLAGS += -Wsign-conversion
84
85
#CC_FLAGS += -pedantic

86
87
88
89
90
91
92
93
94
# Include LUFA-specific DMBS extension modules
DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA
include $(DMBS_LUFA_PATH)/lufa-sources.mk
include $(DMBS_LUFA_PATH)/lufa-gcc.mk

# Include common DMBS build system modules
DMBS_PATH      ?= $(LUFA_PATH)/Build/DMBS/DMBS
include $(DMBS_PATH)/core.mk
include $(DMBS_PATH)/gcc.mk