2002-07-20 20:14:13 +00:00
|
|
|
#
|
2006-09-01 17:49:50 +00:00
|
|
|
# (C) Copyright 2000-2006
|
2002-07-20 20:14:13 +00:00
|
|
|
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
#
|
|
|
|
# See file CREDITS for list of people who contributed to this
|
|
|
|
# project.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License as
|
|
|
|
# published by the Free Software Foundation; either version 2 of
|
|
|
|
# the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
# MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
2007-06-22 17:11:54 +00:00
|
|
|
BIN_FILES = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) ubsha1$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX)
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2008-09-10 20:48:01 +00:00
|
|
|
OBJ_LINKS = env_embedded.o crc32.o md5.o sha1.o image.o
|
2007-06-22 17:11:54 +00:00
|
|
|
OBJ_FILES = img2srec.o mkimage.o envcrc.o ubsha1.o gen_eth_addr.o bmp_logo.o
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2003-04-05 00:53:31 +00:00
|
|
|
ifeq ($(ARCH),mips)
|
2006-09-01 17:49:50 +00:00
|
|
|
BIN_FILES += inca-swap-bytes$(SFX)
|
|
|
|
OBJ_FILES += inca-swap-bytes.o
|
2003-04-05 00:53:31 +00:00
|
|
|
endif
|
|
|
|
|
2003-10-08 22:14:02 +00:00
|
|
|
# Don't build by default
|
|
|
|
#ifeq ($(ARCH),ppc)
|
2006-09-01 17:49:50 +00:00
|
|
|
#BIN_FILES += mpc86x_clk$(SFX)
|
|
|
|
#OBJ_FILES += mpc86x_clk.o
|
2003-10-08 22:14:02 +00:00
|
|
|
#endif
|
|
|
|
|
2008-03-26 20:05:43 +00:00
|
|
|
LIBFDT_OBJ_FILES = $(obj)fdt.o $(obj)fdt_ro.o $(obj)fdt_rw.o $(obj)fdt_strerror.o $(obj)fdt_wip.o
|
2008-02-29 15:00:24 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
LOGO_H = $(OBJTREE)/include/bmp_logo.h
|
2002-07-20 20:14:13 +00:00
|
|
|
|
|
|
|
ifeq ($(LOGO_BMP),)
|
|
|
|
LOGO_BMP= logos/denx.bmp
|
|
|
|
endif
|
2008-05-08 12:52:33 +00:00
|
|
|
ifeq ($(VENDOR),atmel)
|
|
|
|
LOGO_BMP= logos/atmel.bmp
|
|
|
|
endif
|
|
|
|
|
2002-07-20 20:14:13 +00:00
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
TOOLSUBDIRS =
|
|
|
|
|
|
|
|
#
|
|
|
|
# Mac OS X / Darwin's C preprocessor is Apple specific. It
|
|
|
|
# generates numerous errors and warnings. We want to bypass it
|
|
|
|
# and use GNU C's cpp. To do this we pass the -traditional-cpp
|
|
|
|
# option to the compiler. Note that the -traditional-cpp flag
|
|
|
|
# DOES NOT have the same semantics as GNU C's flag, all it does
|
|
|
|
# is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
|
|
|
|
#
|
|
|
|
# Apple's linker is similar, thanks to the new 2 stage linking
|
|
|
|
# multiple symbol definitions are treated as errors, hence the
|
|
|
|
# -multiply_defined suppress option to turn off this error.
|
|
|
|
#
|
|
|
|
ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc)
|
|
|
|
HOST_CFLAGS = -traditional-cpp -Wall
|
|
|
|
HOST_LDFLAGS =-multiply_defined suppress
|
2007-05-14 03:47:35 +00:00
|
|
|
HOST_ENVIRO_CFLAGS =
|
2002-07-20 20:14:13 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
ifeq ($(HOSTOS)-$(HOSTARCH),netbsd-ppc)
|
|
|
|
HOST_CFLAGS = -Wall -pedantic
|
|
|
|
HOST_LDFLAGS =
|
|
|
|
HOST_ENVIRO_CFLAGS =
|
|
|
|
|
|
|
|
#
|
|
|
|
# Everyone else
|
|
|
|
#
|
|
|
|
else
|
|
|
|
HOST_CFLAGS = -Wall -pedantic
|
|
|
|
HOST_LDFLAGS =
|
|
|
|
HOST_ENVIRO_CFLAGS =
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# Cygwin needs .exe files :-(
|
|
|
|
#
|
|
|
|
ifeq ($(HOSTOS),cygwin)
|
|
|
|
SFX = .exe
|
2007-12-14 02:23:28 +00:00
|
|
|
HOST_CFLAGS += -ansi
|
2002-07-20 20:14:13 +00:00
|
|
|
else
|
|
|
|
SFX =
|
|
|
|
endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# Include this after HOSTOS HOSTARCH check
|
|
|
|
# so that we can act intelligently.
|
|
|
|
#
|
|
|
|
include $(TOPDIR)/config.mk
|
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
# now $(obj) is defined
|
2006-10-08 22:42:01 +00:00
|
|
|
SRCS := $(addprefix $(obj),$(OBJ_LINKS:.o=.c)) $(OBJ_FILES:.o=.c)
|
2006-09-01 17:49:50 +00:00
|
|
|
BINS := $(addprefix $(obj),$(BIN_FILES))
|
|
|
|
|
2002-07-20 20:14:13 +00:00
|
|
|
#
|
|
|
|
# Use native tools and options
|
|
|
|
#
|
2006-09-01 17:49:50 +00:00
|
|
|
CPPFLAGS = -idirafter $(SRCTREE)/include \
|
|
|
|
-idirafter $(OBJTREE)/include2 \
|
|
|
|
-idirafter $(OBJTREE)/include \
|
|
|
|
-DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC
|
2002-07-20 20:14:13 +00:00
|
|
|
CFLAGS = $(HOST_CFLAGS) $(CPPFLAGS) -O
|
2008-02-29 15:00:24 +00:00
|
|
|
|
|
|
|
# No -pedantic switch to avoid libfdt compilation warnings
|
|
|
|
FIT_CFLAGS = -Wall $(CPPFLAGS) -O
|
|
|
|
|
2002-07-20 20:14:13 +00:00
|
|
|
AFLAGS = -D__ASSEMBLY__ $(CPPFLAGS)
|
|
|
|
CC = $(HOSTCC)
|
|
|
|
STRIP = $(HOSTSTRIP)
|
|
|
|
MAKEDEPEND = makedepend
|
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
all: $(obj).depend $(BINS) $(LOGO_H) subdirs
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2008-09-10 20:48:01 +00:00
|
|
|
$(obj)envcrc$(SFX): $(obj)envcrc.o $(obj)crc32.o $(obj)env_embedded.o $(obj)sha1.o
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) $(CFLAGS) -o $@ $^
|
2007-06-22 17:11:54 +00:00
|
|
|
|
|
|
|
$(obj)ubsha1$(SFX): $(obj)ubsha1.o $(obj)sha1.o
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) $(CFLAGS) -o $@ $^
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)img2srec$(SFX): $(obj)img2srec.o
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2009-03-13 23:54:33 +00:00
|
|
|
$(obj)mkimage$(SFX): $(obj)mkimage.o $(obj)crc32.o $(obj)image.o $(obj)md5.o \
|
|
|
|
$(obj)sha1.o $(LIBFDT_OBJ_FILES)
|
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)ncb$(SFX): $(obj)ncb.o
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2004-09-08 22:03:11 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)gen_eth_addr$(SFX): $(obj)gen_eth_addr.o
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)bmp_logo$(SFX): $(obj)bmp_logo.o
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)inca-swap-bytes$(SFX): $(obj)inca-swap-bytes.o
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2003-04-05 00:53:31 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)mpc86x_clk$(SFX): $(obj)mpc86x_clk.o
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2003-10-08 22:14:02 +00:00
|
|
|
|
2008-07-09 14:30:30 +00:00
|
|
|
$(obj)bin2header$(SFX): $(obj)bin2header.o
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2008-07-09 14:30:30 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)envcrc.o: $(src)envcrc.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(CFLAGS) -c -o $@ $<
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2007-06-22 17:11:54 +00:00
|
|
|
$(obj)ubsha1.o: $(src)ubsha1.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(CFLAGS) -c -o $@ $<
|
2007-06-22 17:11:54 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)crc32.o: $(obj)crc32.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(CFLAGS) -c -o $@ $<
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2008-03-14 15:22:34 +00:00
|
|
|
$(obj)md5.o: $(obj)md5.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(CFLAGS) -c -o $@ $<
|
2008-03-14 15:22:34 +00:00
|
|
|
|
2007-06-22 17:11:54 +00:00
|
|
|
$(obj)sha1.o: $(obj)sha1.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(CFLAGS) -c -o $@ $<
|
2007-06-22 17:11:54 +00:00
|
|
|
|
2008-01-08 17:14:09 +00:00
|
|
|
$(obj)image.o: $(obj)image.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
|
2008-01-08 17:14:09 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)mkimage.o: $(src)mkimage.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)ncb.o: $(src)ncb.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(CFLAGS) -c -o $@ $<
|
2004-09-08 22:03:11 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)gen_eth_addr.o: $(src)gen_eth_addr.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(CFLAGS) -c -o $@ $<
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)inca-swap-bytes.o: $(src)inca-swap-bytes.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(CFLAGS) -c -o $@ $<
|
2003-04-05 00:53:31 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)mpc86x_clk.o: $(src)mpc86x_clk.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(CFLAGS) -c -o $@ $<
|
2003-10-08 22:14:02 +00:00
|
|
|
|
2008-02-29 15:00:24 +00:00
|
|
|
$(obj)fdt.o: $(obj)fdt.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
|
2008-02-29 15:00:24 +00:00
|
|
|
|
|
|
|
$(obj)fdt_ro.o: $(obj)fdt_ro.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
|
2008-02-29 15:00:24 +00:00
|
|
|
|
|
|
|
$(obj)fdt_rw.o: $(obj)fdt_rw.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
|
2008-02-29 15:00:24 +00:00
|
|
|
|
|
|
|
$(obj)fdt_strerror.o: $(obj)fdt_strerror.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
|
2008-02-29 15:00:24 +00:00
|
|
|
|
|
|
|
$(obj)fdt_wip.o: $(obj)fdt_wip.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
|
2008-02-29 15:00:24 +00:00
|
|
|
|
2002-07-20 20:14:13 +00:00
|
|
|
subdirs:
|
2003-08-17 18:55:18 +00:00
|
|
|
ifeq ($(TOOLSUBDIRS),)
|
2009-03-13 23:54:33 +00:00
|
|
|
@:
|
2003-08-17 18:55:18 +00:00
|
|
|
else
|
2009-03-13 23:54:33 +00:00
|
|
|
@for dir in $(TOOLSUBDIRS) ; do \
|
|
|
|
$(MAKE) \
|
|
|
|
HOSTOS=$(HOSTOS) \
|
|
|
|
HOSTARCH=$(HOSTARCH) \
|
|
|
|
HOST_CFLAGS="$(HOST_CFLAGS)" \
|
|
|
|
HOST_LDFLAGS="$(HOST_LDFLAGS)" \
|
|
|
|
-C $$dir || exit 1 ; \
|
|
|
|
done
|
2003-08-17 18:55:18 +00:00
|
|
|
endif
|
|
|
|
|
2008-09-10 20:48:01 +00:00
|
|
|
$(obj)env_embedded.c:
|
2009-03-13 23:54:33 +00:00
|
|
|
@rm -f $(obj)env_embedded.c
|
|
|
|
ln -s $(src)../common/env_embedded.c $(obj)env_embedded.c
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2008-09-10 20:48:01 +00:00
|
|
|
$(obj)env_embedded.o: $(obj)env_embedded.c
|
2009-03-13 23:54:33 +00:00
|
|
|
$(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c -o $@ $<
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2008-03-31 15:02:01 +00:00
|
|
|
$(obj)zlib.h:
|
2009-03-13 23:54:33 +00:00
|
|
|
@rm -f $@
|
|
|
|
ln -s $(src)../include/zlib.h $@
|
2008-03-31 15:02:01 +00:00
|
|
|
|
|
|
|
$(obj)crc32.c: $(obj)zlib.h
|
2009-03-13 23:54:33 +00:00
|
|
|
@rm -f $(obj)crc32.c
|
|
|
|
ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2008-03-14 15:22:34 +00:00
|
|
|
$(obj)md5.c:
|
2009-03-13 23:54:33 +00:00
|
|
|
@rm -f $(obj)md5.c
|
|
|
|
ln -s $(src)../lib_generic/md5.c $(obj)md5.c
|
2008-03-14 15:22:34 +00:00
|
|
|
|
2007-06-22 17:11:54 +00:00
|
|
|
$(obj)sha1.c:
|
2009-03-13 23:54:33 +00:00
|
|
|
@rm -f $(obj)sha1.c
|
|
|
|
ln -s $(src)../lib_generic/sha1.c $(obj)sha1.c
|
2007-06-22 17:11:54 +00:00
|
|
|
|
2008-01-08 17:14:09 +00:00
|
|
|
$(obj)image.c:
|
2009-03-13 23:54:33 +00:00
|
|
|
@rm -f $(obj)image.c
|
|
|
|
ln -s $(src)../common/image.c $(obj)image.c
|
|
|
|
if [ ! -f $(obj)mkimage.h ] ; then \
|
|
|
|
ln -s $(src)../tools/mkimage.h $(obj)mkimage.h; \
|
|
|
|
fi
|
|
|
|
if [ ! -f $(obj)fdt_host.h ] ; then \
|
|
|
|
ln -s $(src)../tools/fdt_host.h $(obj)fdt_host.h; \
|
|
|
|
fi
|
2008-03-26 20:05:43 +00:00
|
|
|
|
|
|
|
$(obj)fdt.c: $(obj)libfdt_internal.h
|
2009-03-13 23:54:33 +00:00
|
|
|
@rm -f $(obj)fdt.c
|
|
|
|
ln -s $(src)../libfdt/fdt.c $(obj)fdt.c
|
2008-02-29 15:00:24 +00:00
|
|
|
|
2008-03-26 20:05:43 +00:00
|
|
|
$(obj)fdt_ro.c: $(obj)libfdt_internal.h
|
2009-03-13 23:54:33 +00:00
|
|
|
@rm -f $(obj)fdt_ro.c
|
|
|
|
ln -s $(src)../libfdt/fdt_ro.c $(obj)fdt_ro.c
|
2008-02-29 15:00:24 +00:00
|
|
|
|
2008-03-26 20:05:43 +00:00
|
|
|
$(obj)fdt_rw.c: $(obj)libfdt_internal.h
|
2009-03-13 23:54:33 +00:00
|
|
|
@rm -f $(obj)fdt_rw.c
|
|
|
|
ln -s $(src)../libfdt/fdt_rw.c $(obj)fdt_rw.c
|
2008-02-29 15:00:24 +00:00
|
|
|
|
2008-03-26 20:05:43 +00:00
|
|
|
$(obj)fdt_strerror.c: $(obj)libfdt_internal.h
|
2009-03-13 23:54:33 +00:00
|
|
|
@rm -f $(obj)fdt_strerror.c
|
|
|
|
ln -s $(src)../libfdt/fdt_strerror.c $(obj)fdt_strerror.c
|
2008-02-29 15:00:24 +00:00
|
|
|
|
2008-03-26 20:05:43 +00:00
|
|
|
$(obj)fdt_wip.c: $(obj)libfdt_internal.h
|
2009-03-13 23:54:33 +00:00
|
|
|
@rm -f $(obj)fdt_wip.c
|
|
|
|
ln -s $(src)../libfdt/fdt_wip.c $(obj)fdt_wip.c
|
2008-02-29 15:00:24 +00:00
|
|
|
|
|
|
|
$(obj)libfdt_internal.h:
|
2009-03-13 23:54:33 +00:00
|
|
|
@rm -f $(obj)libfdt_internal.h
|
|
|
|
ln -s $(src)../libfdt/libfdt_internal.h $(obj)libfdt_internal.h
|
2008-02-29 15:00:24 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(LOGO_H): $(obj)bmp_logo $(LOGO_BMP)
|
2009-03-13 23:54:33 +00:00
|
|
|
$(obj)./bmp_logo $(LOGO_BMP) >$@
|
2002-07-20 20:14:13 +00:00
|
|
|
|
|
|
|
#########################################################################
|
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
# defines $(obj).depend target
|
|
|
|
include $(SRCTREE)/rules.mk
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
sinclude $(obj).depend
|
2002-07-20 20:14:13 +00:00
|
|
|
|
|
|
|
#########################################################################
|