2 # (C) Copyright 2000-2003
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 BINS
= img2srec
$(SFX
) mkimage
$(SFX
) envcrc
$(SFX
) gen_eth_addr
$(SFX
) bmp_logo
$(SFX
)
26 OBJS
= environment.o img2srec.o mkimage.o crc32.o envcrc.o gen_eth_addr.o bmp_logo.o
29 BINS
+= inca-swap-bytes
$(SFX
)
30 OBJS
+= inca-swap-bytes.o
33 # Don't build by default
35 #BINS += mpc86x_clk$(SFX)
39 LOGO_H
= $(TOPDIR
)/include/bmp_logo.h
42 LOGO_BMP
= logos
/denx.bmp
45 #-------------------------------------------------------------------------
47 HOSTARCH
:= $(shell uname
-m | \
53 -e s
/Power\ Macintosh
/ppc
/ \
56 HOSTOS
:= $(shell uname
-s | tr A-Z a-z | \
57 sed
-e
's/\(cygwin\).*/cygwin/')
62 # Mac OS X / Darwin's C preprocessor is Apple specific. It
63 # generates numerous errors and warnings. We want to bypass it
64 # and use GNU C's cpp. To do this we pass the -traditional-cpp
65 # option to the compiler. Note that the -traditional-cpp flag
66 # DOES NOT have the same semantics as GNU C's flag, all it does
67 # is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
69 # Apple's linker is similar, thanks to the new 2 stage linking
70 # multiple symbol definitions are treated as errors, hence the
71 # -multiply_defined suppress option to turn off this error.
73 ifeq ($(HOSTOS
)-$(HOSTARCH
),darwin-ppc
)
74 HOST_CFLAGS
= -traditional-cpp
-Wall
75 HOST_LDFLAGS
=-multiply_defined suppress
76 HOST_ENVIRO_CFLAGS
= -traditional-cpp
79 ifeq ($(HOSTOS
)-$(HOSTARCH
),netbsd-ppc
)
80 HOST_CFLAGS
= -Wall
-pedantic
88 HOST_CFLAGS
= -Wall
-pedantic
95 # Cygwin needs .exe files :-(
97 ifeq ($(HOSTOS
),cygwin
)
104 # Include this after HOSTOS HOSTARCH check
105 # so that we can act intelligently.
107 include $(TOPDIR
)/config.mk
110 # Use native tools and options
112 CPPFLAGS
= -idirafter ..
/include -DTEXT_BASE
=$(TEXT_BASE
) -DUSE_HOSTCC
113 CFLAGS
= $(HOST_CFLAGS
) $(CPPFLAGS
) -O
114 AFLAGS
= -D__ASSEMBLY__
$(CPPFLAGS
)
117 MAKEDEPEND
= makedepend
119 all: .depend
$(BINS
) $(LOGO_H
) subdirs
121 envcrc
$(SFX
): envcrc.o crc32.o environment.o
122 $(CC
) $(CFLAGS
) -o
$@
$^
124 img2srec
$(SFX
): img2srec.o
125 $(CC
) $(CFLAGS
) $(HOST_LDFLAGS
) -o
$@
$^
128 mkimage
$(SFX
): mkimage.o crc32.o
129 $(CC
) $(CFLAGS
) $(HOST_LDFLAGS
) -o
$@
$^
133 $(CC
) $(CFLAGS
) $(HOST_LDFLAGS
) -o
$@
$^
136 gen_eth_addr
$(SFX
): gen_eth_addr.o
137 $(CC
) $(CFLAGS
) $(HOST_LDFLAGS
) -o
$@
$^
140 bmp_logo
$(SFX
): bmp_logo.o
141 $(CC
) $(CFLAGS
) $(HOST_LDFLAGS
) -o
$@
$^
144 inca-swap-bytes
$(SFX
): inca-swap-bytes.o
145 $(CC
) $(CFLAGS
) $(HOST_LDFLAGS
) -o
$@
$^
148 mpc86x_clk
$(SFX
): mpc86x_clk.o
149 $(CC
) $(CFLAGS
) $(HOST_LDFLAGS
) -o
$@
$^
153 $(CC
) -g
$(CFLAGS
) -c
$<
156 $(CC
) -g
$(CFLAGS
) -c
$<
159 $(CC
) -g
$(CFLAGS
) -c
$<
162 $(CC
) -g
$(CFLAGS
) -c
$<
164 gen_eth_addr.o
: gen_eth_addr.c
165 $(CC
) -g
$(CFLAGS
) -c
$<
167 inca-swap-bytes.o
: inca-swap-bytes.c
168 $(CC
) -g
$(CFLAGS
) -c
$<
170 mpc86x_clk.o
: mpc86x_clk.c
171 $(CC
) -g
$(CFLAGS
) -c
$<
174 ifeq ($(TOOLSUBDIRS
),)
177 @for
dir in
$(TOOLSUBDIRS
) ; do \
180 HOSTARCH
=$(HOSTARCH
) \
181 HOST_CFLAGS
="$(HOST_CFLAGS)" \
182 HOST_LDFLAGS
="$(HOST_LDFLAGS)" \
183 -C
$$dir || exit
1 ; \
189 ln
-s ..
/common
/environment.c environment.c
191 environment.o
: environment.c
192 $(CC
) -g
$(HOST_ENVIRO_CFLAGS
) $(CPPFLAGS
) -c
$<
196 ln
-s ..
/lib_generic
/crc32.c crc32.c
198 $(LOGO_H
): bmp_logo
$(LOGO_BMP
)
199 .
/bmp_logo
$(LOGO_BMP
) >$@
201 #########################################################################
203 .depend
: Makefile
$(OBJS
:.o
=.c
)
204 $(CC
) -M
$(HOST_CFLAGS
) $(CPPFLAGS
) $(OBJS
:.o
=.c
) > $@
208 #########################################################################