f824362e4d758e8e3e289858a12c9550faabab9f
[pub/USBasp.git] / LUFA / Build / LUFA / lufa-gcc.mk
1 #
2 # LUFA Library
3 # Copyright (C) Dean Camera, 2015.
4 #
5 # dean [at] fourwalledcubicle [dot] com
6 # www.lufa-lib.org
7 #
8
9 DMBS_BUILD_MODULES += LUFA_GCC
10 DMBS_BUILD_TARGETS +=
11 DMBS_BUILD_MANDATORY_VARS += LUFA_PATH ARCH F_USB
12 DMBS_BUILD_OPTIONAL_VARS += BOARD
13 DMBS_BUILD_PROVIDED_VARS +=
14 DMBS_BUILD_PROVIDED_MACROS +=
15
16 SHELL = /bin/sh
17
18 ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
19 ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
20 ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
21
22 # Sanity check user supplied values
23 $(call ERROR_IF_EMPTY, LUFA_PATH)
24 $(call ERROR_IF_EMPTY, ARCH)
25 $(call ERROR_IF_EMPTY, F_USB)
26
27 # Default values of optionally user-supplied variables
28 BOARD ?= NONE
29
30 # Determine the utility prefix to use for the selected architecture
31 ifeq ($(ARCH), XMEGA)
32 $(warning The XMEGA device support is currently EXPERIMENTAL (incomplete and/or non-functional), and is included for preview purposes only.)
33 else ifeq ($(ARCH), UC3)
34 $(warning The UC3 device support is currently EXPERIMENTAL (incomplete and/or non-functional), and is included for preview purposes only.)
35 endif
36
37 # Common LUFA C/C++ includes/definitions
38 LUFA_CXX_INCLUDES = -I. -I$(patsubst %/,%,$(LUFA_PATH))/..
39 LUFA_CXX_DEFINES = -DARCH=ARCH_$(ARCH) -DBOARD=BOARD_$(BOARD) -DF_USB=$(F_USB)UL
40
41 # LUFA specific standard build options
42 C_FLAGS += $(LUFA_CXX_INCLUDES) $(LUFA_CXX_DEFINES) $(LUFA_CXX_FLAGS)
43 CPP_FLAGS += $(LUFA_CXX_INCLUDES) $(LUFA_CXX_DEFINES) $(LUFA_CXX_FLAGS)