3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 # See file CREDITS for list of people who contributed to this
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation; either version 2 of
11 # the License, or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 #########################################################################
27 # When cross-compiling on NetBSD, we have to define __PPC__ or else we
28 # will pick up a va_list declaration that is incompatible with the
29 # actual argument lists emitted by the compiler.
31 # [Tested on NetBSD/i386 1.5 + cross-powerpc-netbsd-1.3]
34 ifeq ($(CROSS_COMPILE
),powerpc-netbsd-
)
35 PLATFORM_CPPFLAGS
+= -D__PPC__
37 ifeq ($(CROSS_COMPILE
),powerpc-openbsd-
)
38 PLATFORM_CPPFLAGS
+= -D__PPC__
43 ifeq ($(CROSS_COMPILE
),powerpc-netbsd-
)
44 PLATFORM_CPPFLAGS
+= -D__ARM__
46 ifeq ($(CROSS_COMPILE
),powerpc-openbsd-
)
47 PLATFORM_CPPFLAGS
+= -D__ARM__
52 sinclude
$(TOPDIR
)/$(ARCH
)_config.mk
# include architecture dependend rules
55 sinclude
$(TOPDIR
)/cpu
/$(CPU
)/config.mk
# include CPU specific rules
58 BOARDDIR
= $(VENDOR
)/$(BOARD
)
63 sinclude
$(TOPDIR
)/board
/$(BOARDDIR
)/config.mk
# include board specific rules
66 #########################################################################
68 CONFIG_SHELL
:= $(shell if
[ -x
"$$BASH" ]; then echo
$$BASH; \
69 else if
[ -x
/bin
/bash
]; then echo
/bin
/bash
; \
70 else echo sh
; fi
; fi
)
72 ifeq ($(HOSTOS
)-$(HOSTARCH
),darwin-ppc
)
77 HOSTCFLAGS
= -Wall
-Wstrict-prototypes
-O2
-fomit-frame-pointer
80 #########################################################################
83 # Include the make variables (CC, etc...)
85 AS
= $(CROSS_COMPILE
)as
86 LD
= $(CROSS_COMPILE
)ld
87 CC
= $(CROSS_COMPILE
)gcc
89 AR
= $(CROSS_COMPILE
)ar
90 NM
= $(CROSS_COMPILE
)nm
91 STRIP
= $(CROSS_COMPILE
)strip
92 OBJCOPY
= $(CROSS_COMPILE
)objcopy
93 OBJDUMP
= $(CROSS_COMPILE
)objdump
94 RANLIB
= $(CROSS_COMPILE
)RANLIB
96 RELFLAGS
= $(PLATFORM_RELFLAGS
)
98 OPTFLAGS
= -Os
#-fomit-frame-pointer
100 #LDSCRIPT := board/$(BOARDDIR)/u-boot.lds.debug
101 LDSCRIPT
:= $(TOPDIR
)/board
/$(BOARDDIR
)/u-boot.lds
103 OBJCFLAGS
+= --gap-fill
=0xff
105 CPPFLAGS
:= $(DBGFLAGS
) $(OPTFLAGS
) $(RELFLAGS
) \
106 -D__KERNEL__
-DTEXT_BASE
=$(TEXT_BASE
) \
107 -I
$(TOPDIR
)/include \
109 -pipe
$(PLATFORM_CPPFLAGS
)
112 CFLAGS
:= $(CPPFLAGS
) -Wall
-Wstrict-prototypes \
113 -DBUILD_TAG
='"$(BUILD_TAG)"'
115 CFLAGS
:= $(CPPFLAGS
) -Wall
-Wstrict-prototypes
118 AFLAGS_DEBUG
:= -Wa
,-gstabs
119 AFLAGS
:= $(AFLAGS_DEBUG
) -D__ASSEMBLY__
$(CPPFLAGS
)
121 LDFLAGS
+= -Bstatic
-T
$(LDSCRIPT
) -Ttext
$(TEXT_BASE
) $(PLATFORM_LDFLAGS
)
123 # Location of a usable BFD library, where we define "usable" as
124 # "built for ${HOST}, supports ${TARGET}". Sensible values are
125 # - When cross-compiling: the root of the cross-environment
126 # - Linux/ppc (native): /usr
127 # - NetBSD/ppc (native): you lose ... (must extract these from the
128 # binutils build directory, plus the native and U-Boot include
129 # files don't like each other)
131 # So far, this is used only by tools/gdb/Makefile.
133 ifeq ($(HOSTOS
)-$(HOSTARCH
),darwin-ppc
)
134 BFD_ROOT_DIR
= /usr
/local
/tools
136 ifeq ($(HOSTARCH
),$(ARCH
))
140 #BFD_ROOT_DIR = /LinuxPPC/CDK # Linux/i386
141 #BFD_ROOT_DIR = /usr/pkg/cross # NetBSD/i386
142 BFD_ROOT_DIR
= /opt
/powerpc
146 #########################################################################
148 export CONFIG_SHELL HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE \
149 AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP \
151 export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
153 #########################################################################
156 $(CPP
) $(AFLAGS
) -o
$@
$(CURDIR
)/$<
158 $(CC
) $(AFLAGS
) -c
-o
$@
$(CURDIR
)/$<
160 $(CC
) $(CFLAGS
) -c
-o
$@
$<
162 #########################################################################