1 #******************************************************************************
3 # makedefs - Definitions common to all makefiles.
5 # Copyright (c) 2005,2006 Luminary Micro, Inc. All rights reserved.
7 # Software License Agreement
9 # Luminary Micro, Inc. (LMI) is supplying this software for use solely and
10 # exclusively on LMI's Stellaris Family of microcontroller products.
12 # The software is owned by LMI and/or its suppliers, and is protected under
13 # applicable copyright laws. All rights are reserved. Any use in violation
14 # of the foregoing restrictions may subject the user to criminal sanctions
15 # under applicable laws, as well as to civil liability for the breach of the
16 # terms and conditions of this license.
18 # THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
19 # OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
20 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
21 # LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
22 # CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
24 #******************************************************************************
26 #******************************************************************************
28 # Get the operating system name. If this is Cygwin, the .d files will be
29 # munged to convert c: into /cygdrive/c so that "make" will be happy with the
30 # auto-generated dependencies.
32 #******************************************************************************
35 #******************************************************************************
37 # The compiler to be used.
39 #******************************************************************************
44 #******************************************************************************
46 # The debugger to be used.
48 #******************************************************************************
53 #******************************************************************************
55 # Definitions for using GCC.
57 #******************************************************************************
58 ifeq (${COMPILER}, gcc)
61 # The command for calling the compiler.
63 CC=arm-stellaris-eabi-gcc
66 # The flags passed to the assembler.
73 # The flags passed to the compiler.
81 # The command for calling the library archiver.
83 AR=arm-stellaris-eabi-ar
86 # The command for calling the linker.
88 LD=arm-stellaris-eabi-ld
91 # The flags passed to the linker.
93 LDFLAGS= -Map gcc/out.map
96 # Get the location of libgcc.a from the GCC front-end.
98 LIBGCC=${shell ${CC} -mthumb -march=armv6t2 -print-libgcc-file-name}
101 # Get the location of libc.a from the GCC front-end.
103 LIBC=${shell ${CC} -mthumb -march=armv6t2 -print-file-name=libc.a}
106 # The command for extracting images from the linked executables.
108 OBJCOPY=arm-stellaris-eabi-objcopy
112 #******************************************************************************
114 # Tell the compiler to include debugging information if the DEBUG environment
117 #******************************************************************************
122 #******************************************************************************
124 # The rule for building the object file from each C source file.
126 #******************************************************************************
128 @if [ 'x${VERBOSE}' = x ]; \
132 echo ${CC} ${CFLAGS} -D${COMPILER} -o ${@} -c ${<}; \
134 @${CC} ${CFLAGS} -D${COMPILER} -o ${@} -c ${<}
135 ifeq (${COMPILER}, rvds)
136 @mv -f ${notdir ${@:.o=.d}} ${COMPILER}
138 ifneq ($(findstring CYGWIN, ${os}), )
139 @perl -i.bak -p -e 's/[Cc]:/\/cygdrive\/c/g' ${@:.o=.d}
142 #******************************************************************************
144 # The rule for building the object file from each assembly source file.
146 #******************************************************************************
148 @if [ 'x${VERBOSE}' = x ]; \
152 echo ${CC} ${AFLAGS} -D${COMPILER} -o ${@} -c ${<}; \
154 ifeq (${COMPILER}, rvds)
155 @${CC} ${AFLAGS} -D${COMPILER} -E ${<} > ${@:.o=_.S}
156 @${CC} ${AFLAGS} -o ${@} -c ${@:.o=_.S}
158 @${CC} ${AFLAGS} -D${COMPILER} --md -E ${<}
159 @sed 's,<stdout>,${@},g' ${notdir ${<:.S=.d}} > ${@:.o=.d}
160 @rm ${notdir ${<:.S=.d}}
162 ifeq (${COMPILER}, gcc)
163 @${CC} ${AFLAGS} -D${COMPILER} -o ${@} -c ${<}
165 ifneq ($(findstring CYGWIN, ${os}), )
166 @perl -i.bak -p -e 's/[Cc]:/\/cygdrive\/c/g' ${@:.o=.d}
169 #******************************************************************************
171 # The rule for creating an object library.
173 #******************************************************************************
175 @if [ 'x${VERBOSE}' = x ]; \
179 echo ${AR} -cr ${@} ${^}; \
183 #******************************************************************************
185 # The rule for linking the application.
187 #******************************************************************************
189 @if [ 'x${VERBOSE}' = x ]; \
193 ifeq (${COMPILER}, gcc)
194 @if [ 'x${VERBOSE}' != x ]; \
196 echo ${LD} -T ${SCATTER_${notdir ${@:.axf=}}} \
197 --entry ${ENTRY_${notdir ${@:.axf=}}} \
198 ${LDFLAGSgcc_${notdir ${@:.axf=}}} \
199 ${LDFLAGS} -o ${@} ${^} \
200 '${LIBC}' '${LIBGCC}'; \
202 @${LD} -T ${SCATTER_${notdir ${@:.axf=}}} \
203 --entry ${ENTRY_${notdir ${@:.axf=}}} \
204 ${LDFLAGSgcc_${notdir ${@:.axf=}}} \
205 ${LDFLAGS} -o ${@} ${^} \
206 '${LIBC}' '${LIBGCC}'
207 @${OBJCOPY} -O binary ${@} ${@:.axf=.bin}