xref: /btstack/port/msp432p401lp-cc256x/Makefile.defs (revision 9a7ee89c0937a377b7a18eb15b435385fd4ddf72)
1#******************************************************************************
2#
3# Get the operating system name.  If this is Cygwin, the .d files will be
4# munged to convert c: into /cygdrive/c so that "make" will be happy with the
5# auto-generated dependencies.
6#
7#******************************************************************************
8os:=${shell uname -s}
9
10#******************************************************************************
11#
12# The compiler to be used.
13#
14#******************************************************************************
15ifndef COMPILER
16COMPILER=gcc
17endif
18
19#******************************************************************************
20#
21# Definitions for using GCC.
22#
23#******************************************************************************
24ifeq (${COMPILER}, gcc)
25
26#
27# The command for calling the compiler.
28#
29CC=arm-none-eabi-gcc
30
31#
32# The location of the C compiler
33# ARMGCC_ROOT is used by some makefiles that need to know where the compiler
34# is installed.
35#
36ARMGCC_ROOT:=${shell dirname '${shell sh -c "which ${CC}"}'}/..
37
38#
39# Set the compiler CPU/FPU options.
40#
41CPU=-mcpu=cortex-m4
42FPU=-mfpu=fpv4-sp-d16 -mfloat-abi=hard
43
44#
45# The flags passed to the assembler.
46#
47AFLAGS=-mthumb \
48       ${CPU}  \
49       ${FPU}  \
50       -MD
51
52#
53# The flags passed to the compiler.
54#
55CFLAGS=-mthumb             \
56       ${CPU}              \
57       ${FPU}              \
58       -ffunction-sections \
59       -fdata-sections     \
60       -MD                 \
61       -std=c99            \
62       -Dgcc               \
63       -D${PART}           \
64       -specs=nano.specs   \
65       -c
66
67#
68# The command for calling the library archiver.
69#
70AR=arm-none-eabi-ar
71
72#
73# The command for calling the linker.
74#
75LD=arm-none-eabi-ld
76
77#
78# The flags passed to the linker.
79#
80LDFLAGS= --gc-sections
81
82#
83# The command for extracting images from the linked executables.
84#
85OBJCOPY=arm-none-eabi-objcopy
86
87#
88# Tell the compiler to include debugging information if the DEBUG environment
89# variable is set.
90#
91# ifdef DEBUG
92# CFLAGS+=-g -D DEBUG -O0
93# else
94# CFLAGS+=-Os
95# endif
96CFLAGS+=-g -Os
97
98#
99# Add the tool specific CFLAGS.
100#
101CFLAGS+=${CFLAGSgcc}
102
103#
104# Add the include file paths to AFLAGS and CFLAGS.
105#
106AFLAGS+=${patsubst %,-I%,${subst :, ,${IPATH}}}
107CFLAGS+=${patsubst %,-I%,${subst :, ,${IPATH}}}
108
109#
110# The rule for building the object file from each C source file.
111#
112${COMPILER}${SUFFIX}/%.o: %.c
113	@if [ 'x${VERBOSE}' = x ];                            \
114	 then                                                 \
115	     echo "  CC          ${<}";                             \
116	 else                                                 \
117	     echo ${CC} ${CFLAGS} -D${COMPILER} -o ${@} ${<}; \
118	 fi
119	@${CC} ${CFLAGS} -D${COMPILER} -o ${@} ${<}
120ifneq ($(findstring CYGWIN, ${os}), )
121	@sed -i -r 's/ ([A-Za-z]):/ \/cygdrive\/\1/g' ${@:.o=.d}
122endif
123
124#
125# The rule for building the object file from each assembly source file.
126#
127${COMPILER}${SUFFIX}/%.o: %.S
128	@if [ 'x${VERBOSE}' = x ];                               \
129	 then                                                    \
130	     echo "  AS          ${<}";                                \
131	 else                                                    \
132	     echo ${CC} ${AFLAGS} -D${COMPILER} -o ${@} -c ${<}; \
133	 fi
134	@${CC} ${AFLAGS} -D${COMPILER} -o ${@} -c ${<}
135ifneq ($(findstring CYGWIN, ${os}), )
136	@sed -i -r 's/ ([A-Za-z]):/ \/cygdrive\/\1/g' ${@:.o=.d}
137endif
138
139#
140# The rule for creating an object library.
141#
142${COMPILER}${SUFFIX}/%.a:
143	@if [ 'x${VERBOSE}' = x ];     \
144	 then                          \
145	     echo "  AR          ${@}";      \
146	 else                          \
147	     echo ${AR} -cr ${@} ${^}; \
148	 fi
149	@${AR} -cr ${@} ${^}
150
151endif
152
153