2002-07-21 05:14:13 +09:00
|
|
|
#
|
2006-09-02 02:49:50 +09:00
|
|
|
# (C) Copyright 2000-2006
|
2002-07-21 05:14:13 +09: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
|
|
|
|
#
|
|
|
|
|
|
|
|
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.
|
|
|
|
#
|
|
|
|
|
2009-03-14 08:54:50 +09:00
|
|
|
HOST_CFLAGS = -Wall
|
2002-07-21 05:14:13 +09:00
|
|
|
HOST_LDFLAGS =
|
|
|
|
|
2009-03-14 08:54:50 +09:00
|
|
|
ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc)
|
|
|
|
HOST_CFLAGS += -traditional-cpp
|
|
|
|
HOST_LDFLAGS += -multiply_defined suppress
|
2002-07-21 05:14:13 +09:00
|
|
|
else
|
2009-03-14 08:54:50 +09:00
|
|
|
HOST_CFLAGS += -pedantic
|
2002-07-21 05:14:13 +09:00
|
|
|
endif
|
|
|
|
|
2009-03-14 08:54:51 +09:00
|
|
|
ifeq ($(HOSTOS),cygwin)
|
|
|
|
HOST_CFLAGS += -ansi
|
|
|
|
endif
|
|
|
|
|
2002-07-21 05:14:13 +09:00
|
|
|
#
|
2009-03-14 08:54:51 +09:00
|
|
|
# toolchains targeting win32 generate .exe files
|
2002-07-21 05:14:13 +09:00
|
|
|
#
|
2009-03-14 08:54:51 +09:00
|
|
|
ifneq (,$(findstring WIN32 ,$(shell $(HOSTCC) -E -dM -xc /dev/null)))
|
2002-07-21 05:14:13 +09:00
|
|
|
SFX = .exe
|
|
|
|
else
|
|
|
|
SFX =
|
|
|
|
endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# Include this after HOSTOS HOSTARCH check
|
|
|
|
# so that we can act intelligently.
|
|
|
|
#
|
|
|
|
include $(TOPDIR)/config.mk
|
|
|
|
|
2009-03-14 08:54:34 +09:00
|
|
|
# Generated executable files
|
2009-03-14 08:54:36 +09:00
|
|
|
BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX)
|
2009-03-14 08:54:34 +09:00
|
|
|
BIN_FILES-y += mkimage$(SFX)
|
2009-03-14 08:54:39 +09:00
|
|
|
BIN_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc$(SFX)
|
2009-04-04 23:10:40 +09:00
|
|
|
BIN_FILES-$(CONFIG_ENV_IS_IN_FLASH) += envcrc$(SFX)
|
2009-03-14 08:54:37 +09:00
|
|
|
BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
|
2009-03-14 08:54:40 +09:00
|
|
|
BIN_FILES-$(CONFIG_CMD_NET) += gen_eth_addr$(SFX)
|
2009-03-14 08:54:35 +09:00
|
|
|
BIN_FILES-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX)
|
|
|
|
BIN_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo$(SFX)
|
2009-03-14 08:54:38 +09:00
|
|
|
BIN_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes$(SFX)
|
2009-03-14 08:54:41 +09:00
|
|
|
BIN_FILES-$(CONFIG_NETCONSOLE) += ncb$(SFX)
|
2009-03-14 08:54:34 +09:00
|
|
|
|
2009-03-14 08:54:47 +09:00
|
|
|
# Source files which exist outside the tools directory
|
|
|
|
EXT_OBJ_FILES-y += common/env_embedded.o
|
|
|
|
EXT_OBJ_FILES-y += lib_generic/crc32.o
|
|
|
|
EXT_OBJ_FILES-y += lib_generic/md5.o
|
|
|
|
EXT_OBJ_FILES-y += lib_generic/sha1.o
|
|
|
|
EXT_OBJ_FILES-y += common/image.o
|
2009-03-14 08:54:34 +09:00
|
|
|
|
|
|
|
# Source files located in the tools directory
|
2009-03-14 08:54:36 +09:00
|
|
|
OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
|
2009-03-14 08:54:34 +09:00
|
|
|
OBJ_FILES-y += mkimage.o
|
2009-03-14 08:54:39 +09:00
|
|
|
OBJ_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc.o
|
2009-03-14 08:54:37 +09:00
|
|
|
OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o
|
2009-03-14 08:54:40 +09:00
|
|
|
OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
|
2009-03-14 08:54:35 +09:00
|
|
|
OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
|
|
|
|
OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o
|
2009-03-14 08:54:38 +09:00
|
|
|
OBJ_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes.o
|
2009-03-14 08:54:41 +09:00
|
|
|
OBJ_FILES-$(CONFIG_NETCONSOLE) += ncb.o
|
2009-03-14 08:54:51 +09:00
|
|
|
OBJ_FILES-y += os_support.o
|
2009-03-14 08:54:34 +09:00
|
|
|
|
|
|
|
# Don't build by default
|
|
|
|
#ifeq ($(ARCH),ppc)
|
|
|
|
#BIN_FILES-y += mpc86x_clk$(SFX)
|
|
|
|
#OBJ_FILES-y += mpc86x_clk.o
|
|
|
|
#endif
|
|
|
|
|
|
|
|
# Flattened device tree objects
|
|
|
|
LIBFDT_OBJ_FILES-y += fdt.o
|
|
|
|
LIBFDT_OBJ_FILES-y += fdt_ro.o
|
|
|
|
LIBFDT_OBJ_FILES-y += fdt_rw.o
|
|
|
|
LIBFDT_OBJ_FILES-y += fdt_strerror.o
|
|
|
|
LIBFDT_OBJ_FILES-y += fdt_wip.o
|
|
|
|
|
2009-03-14 08:54:35 +09:00
|
|
|
# Generated LCD/video logo
|
2009-03-14 08:54:34 +09:00
|
|
|
LOGO_H = $(OBJTREE)/include/bmp_logo.h
|
2009-03-14 08:54:35 +09:00
|
|
|
LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_H)
|
|
|
|
LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H)
|
2009-03-14 08:54:34 +09:00
|
|
|
|
|
|
|
ifeq ($(LOGO_BMP),)
|
|
|
|
LOGO_BMP= logos/denx.bmp
|
|
|
|
endif
|
|
|
|
ifeq ($(VENDOR),atmel)
|
|
|
|
LOGO_BMP= logos/atmel.bmp
|
|
|
|
endif
|
|
|
|
|
2006-09-02 02:49:50 +09:00
|
|
|
# now $(obj) is defined
|
2009-03-14 08:54:47 +09:00
|
|
|
SRCS += $(addprefix $(SRCTREE)/,$(EXT_OBJ_FILES-y:.o=.c))
|
2009-03-14 08:54:49 +09:00
|
|
|
SRCS += $(addprefix $(SRCTREE)/tools/,$(OBJ_FILES-y:.o=.c))
|
2009-03-14 08:54:46 +09:00
|
|
|
SRCS += $(addprefix $(SRCTREE)/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c))
|
2009-04-04 23:10:40 +09:00
|
|
|
BINS := $(addprefix $(obj),$(sort $(BIN_FILES-y)))
|
2009-03-14 08:54:34 +09:00
|
|
|
LIBFDT_OBJS := $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y))
|
2006-09-02 02:49:50 +09:00
|
|
|
|
2002-07-21 05:14:13 +09:00
|
|
|
#
|
|
|
|
# Use native tools and options
|
2009-03-14 08:54:51 +09:00
|
|
|
# Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
|
2002-07-21 05:14:13 +09:00
|
|
|
#
|
2006-09-02 02:49:50 +09:00
|
|
|
CPPFLAGS = -idirafter $(SRCTREE)/include \
|
|
|
|
-idirafter $(OBJTREE)/include2 \
|
|
|
|
-idirafter $(OBJTREE)/include \
|
2009-03-14 08:54:44 +09:00
|
|
|
-I $(SRCTREE)/libfdt \
|
2009-03-14 08:54:42 +09:00
|
|
|
-I $(SRCTREE)/tools \
|
2009-03-14 08:54:51 +09:00
|
|
|
-DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC \
|
|
|
|
-D__KERNEL_STRICT_NAMES
|
2002-07-21 05:14:13 +09:00
|
|
|
CFLAGS = $(HOST_CFLAGS) $(CPPFLAGS) -O
|
2008-03-01 00:00:24 +09:00
|
|
|
|
|
|
|
# No -pedantic switch to avoid libfdt compilation warnings
|
|
|
|
FIT_CFLAGS = -Wall $(CPPFLAGS) -O
|
|
|
|
|
2002-07-21 05:14:13 +09:00
|
|
|
AFLAGS = -D__ASSEMBLY__ $(CPPFLAGS)
|
|
|
|
CC = $(HOSTCC)
|
|
|
|
STRIP = $(HOSTSTRIP)
|
|
|
|
MAKEDEPEND = makedepend
|
|
|
|
|
2009-03-14 08:54:35 +09:00
|
|
|
all: $(obj).depend $(BINS) $(LOGO-y) subdirs
|
2002-07-21 05:14:13 +09:00
|
|
|
|
2008-09-11 05:48:01 +09:00
|
|
|
$(obj)envcrc$(SFX): $(obj)envcrc.o $(obj)crc32.o $(obj)env_embedded.o $(obj)sha1.o
|
2009-03-14 08:54:33 +09:00
|
|
|
$(CC) $(CFLAGS) -o $@ $^
|
2007-06-23 02:11:54 +09:00
|
|
|
|
2009-03-14 08:54:51 +09:00
|
|
|
$(obj)ubsha1$(SFX): $(obj)ubsha1.o $(obj)sha1.o $(obj)os_support.o
|
2009-03-14 08:54:33 +09:00
|
|
|
$(CC) $(CFLAGS) -o $@ $^
|
2002-07-21 05:14:13 +09:00
|
|
|
|
2006-09-02 02:49:50 +09:00
|
|
|
$(obj)img2srec$(SFX): $(obj)img2srec.o
|
2009-03-14 08:54:33 +09:00
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2002-07-21 05:14:13 +09:00
|
|
|
|
2009-03-14 08:54:33 +09:00
|
|
|
$(obj)mkimage$(SFX): $(obj)mkimage.o $(obj)crc32.o $(obj)image.o $(obj)md5.o \
|
2009-03-14 08:54:51 +09:00
|
|
|
$(obj)sha1.o $(LIBFDT_OBJS) $(obj)os_support.o
|
2009-03-14 08:54:33 +09:00
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2002-07-21 05:14:13 +09:00
|
|
|
|
2006-09-02 02:49:50 +09:00
|
|
|
$(obj)ncb$(SFX): $(obj)ncb.o
|
2009-03-14 08:54:33 +09:00
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2004-09-09 07:03:11 +09:00
|
|
|
|
2006-09-02 02:49:50 +09:00
|
|
|
$(obj)gen_eth_addr$(SFX): $(obj)gen_eth_addr.o
|
2009-03-14 08:54:33 +09:00
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2002-07-21 05:14:13 +09:00
|
|
|
|
2006-09-02 02:49:50 +09:00
|
|
|
$(obj)bmp_logo$(SFX): $(obj)bmp_logo.o
|
2009-03-14 08:54:33 +09:00
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2002-07-21 05:14:13 +09:00
|
|
|
|
2006-09-02 02:49:50 +09:00
|
|
|
$(obj)inca-swap-bytes$(SFX): $(obj)inca-swap-bytes.o
|
2009-03-14 08:54:33 +09:00
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2003-04-05 09:53:31 +09:00
|
|
|
|
2006-09-02 02:49:50 +09:00
|
|
|
$(obj)mpc86x_clk$(SFX): $(obj)mpc86x_clk.o
|
2009-03-14 08:54:33 +09:00
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2003-10-09 07:14:02 +09:00
|
|
|
|
2008-07-09 23:30:30 +09:00
|
|
|
$(obj)bin2header$(SFX): $(obj)bin2header.o
|
2009-03-14 08:54:33 +09:00
|
|
|
$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
|
|
|
|
$(STRIP) $@
|
2008-07-09 23:30:30 +09:00
|
|
|
|
2009-03-14 08:54:51 +09:00
|
|
|
# Some files complain if compiled with -pedantic, use FIT_CFLAGS
|
2009-04-04 19:46:31 +09:00
|
|
|
$(obj)image.o: $(SRCTREE)/common/image.c
|
2009-03-14 08:54:33 +09:00
|
|
|
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
|
2008-01-09 02:14:09 +09:00
|
|
|
|
2009-03-14 08:54:49 +09:00
|
|
|
$(obj)mkimage.o: $(SRCTREE)/tools/mkimage.c
|
2009-03-14 08:54:33 +09:00
|
|
|
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
|
2002-07-21 05:14:13 +09:00
|
|
|
|
2009-03-14 08:54:51 +09:00
|
|
|
$(obj)os_support.o: $(SRCTREE)/tools/os_support.c
|
|
|
|
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
|
|
|
|
|
2009-03-14 08:54:49 +09:00
|
|
|
# Some of the tool objects need to be accessed from outside the tools directory
|
|
|
|
$(obj)%.o: $(SRCTREE)/common/%.c
|
2009-03-14 08:54:33 +09:00
|
|
|
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
|
2008-03-01 00:00:24 +09:00
|
|
|
|
2009-03-14 08:54:49 +09:00
|
|
|
$(obj)%.o: $(SRCTREE)/lib_generic/%.c
|
|
|
|
$(CC) -g $(CFLAGS) -c -o $@ $<
|
2008-03-01 00:00:24 +09:00
|
|
|
|
2009-03-14 08:54:49 +09:00
|
|
|
$(LIBFDT_OBJS):
|
2009-03-14 08:54:33 +09:00
|
|
|
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
|
2008-03-01 00:00:24 +09:00
|
|
|
|
2002-07-21 05:14:13 +09:00
|
|
|
subdirs:
|
2003-08-18 03:55:18 +09:00
|
|
|
ifeq ($(TOOLSUBDIRS),)
|
2009-03-14 08:54:33 +09:00
|
|
|
@:
|
2003-08-18 03:55:18 +09:00
|
|
|
else
|
2009-03-14 08:54:33 +09: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-18 03:55:18 +09:00
|
|
|
endif
|
|
|
|
|
2006-09-02 02:49:50 +09:00
|
|
|
$(LOGO_H): $(obj)bmp_logo $(LOGO_BMP)
|
2009-03-14 08:54:33 +09:00
|
|
|
$(obj)./bmp_logo $(LOGO_BMP) >$@
|
2002-07-21 05:14:13 +09:00
|
|
|
|
|
|
|
#########################################################################
|
|
|
|
|
2006-09-02 02:49:50 +09:00
|
|
|
# defines $(obj).depend target
|
|
|
|
include $(SRCTREE)/rules.mk
|
2002-07-21 05:14:13 +09:00
|
|
|
|
2006-09-02 02:49:50 +09:00
|
|
|
sinclude $(obj).depend
|
2002-07-21 05:14:13 +09:00
|
|
|
|
|
|
|
#########################################################################
|