diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile | 98 | ||||
-rw-r--r-- | tools/env/Makefile | 27 | ||||
-rw-r--r-- | tools/gdb/Makefile | 23 | ||||
-rw-r--r-- | tools/updater/Makefile | 93 |
4 files changed, 139 insertions, 102 deletions
diff --git a/tools/Makefile b/tools/Makefile index d3dcc7d..606f024 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,5 +1,5 @@ # -# (C) Copyright 2000-2003 +# (C) Copyright 2000-2006 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # # See file CREDITS for list of people who contributed to this @@ -21,22 +21,23 @@ # MA 02111-1307 USA # -BINS = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX) +BIN_FILES = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX) -OBJS = environment.o img2srec.o mkimage.o crc32.o envcrc.o gen_eth_addr.o bmp_logo.o +OBJ_LINKS = environment.o crc32.o +OBJ_FILES = img2srec.o mkimage.o envcrc.o gen_eth_addr.o bmp_logo.o ifeq ($(ARCH),mips) -BINS += inca-swap-bytes$(SFX) -OBJS += inca-swap-bytes.o +BIN_FILES += inca-swap-bytes$(SFX) +OBJ_FILES += inca-swap-bytes.o endif # Don't build by default #ifeq ($(ARCH),ppc) -#BINS += mpc86x_clk$(SFX) -#OBJS += mpc86x_clk.o +#BIN_FILES += mpc86x_clk$(SFX) +#OBJ_FILES += mpc86x_clk.o #endif -LOGO_H = $(TOPDIR)/include/bmp_logo.h +LOGO_H = $(OBJTREE)/include/bmp_logo.h ifeq ($(LOGO_BMP),) LOGO_BMP= logos/denx.bmp @@ -106,69 +107,76 @@ endif # include $(TOPDIR)/config.mk +# now $(obj) is defined +SRCS := $(addprefix $(obj),$(OBJ_LINKS:.o=.c)) $(OBJ_FILES:.o=.c) +BINS := $(addprefix $(obj),$(BIN_FILES)) + # # Use native tools and options # -CPPFLAGS = -idirafter ../include -DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC +CPPFLAGS = -idirafter $(SRCTREE)/include \ + -idirafter $(OBJTREE)/include2 \ + -idirafter $(OBJTREE)/include \ + -DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC CFLAGS = $(HOST_CFLAGS) $(CPPFLAGS) -O AFLAGS = -D__ASSEMBLY__ $(CPPFLAGS) CC = $(HOSTCC) STRIP = $(HOSTSTRIP) MAKEDEPEND = makedepend -all: .depend $(BINS) $(LOGO_H) subdirs +all: $(obj).depend $(BINS) $(LOGO_H) subdirs -envcrc$(SFX): envcrc.o crc32.o environment.o +$(obj)envcrc$(SFX): $(obj)envcrc.o $(obj)crc32.o $(obj)environment.o $(CC) $(CFLAGS) -o $@ $^ -img2srec$(SFX): img2srec.o +$(obj)img2srec$(SFX): $(obj)img2srec.o $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ $(STRIP) $@ -mkimage$(SFX): mkimage.o crc32.o +$(obj)mkimage$(SFX): $(obj)mkimage.o $(obj)crc32.o $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ $(STRIP) $@ -ncb$(SFX): ncb.o +$(obj)ncb$(SFX): $(obj)ncb.o $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ $(STRIP) $@ -gen_eth_addr$(SFX): gen_eth_addr.o +$(obj)gen_eth_addr$(SFX): $(obj)gen_eth_addr.o $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ $(STRIP) $@ -bmp_logo$(SFX): bmp_logo.o +$(obj)bmp_logo$(SFX): $(obj)bmp_logo.o $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ $(STRIP) $@ -inca-swap-bytes$(SFX): inca-swap-bytes.o +$(obj)inca-swap-bytes$(SFX): $(obj)inca-swap-bytes.o $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ $(STRIP) $@ -mpc86x_clk$(SFX): mpc86x_clk.o +$(obj)mpc86x_clk$(SFX): $(obj)mpc86x_clk.o $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ $(STRIP) $@ -envcrc.o: envcrc.c - $(CC) -g $(CFLAGS) -c $< +$(obj)envcrc.o: $(src)envcrc.c + $(CC) -g $(CFLAGS) -c -o $@ $< -crc32.o: crc32.c - $(CC) -g $(CFLAGS) -c $< +$(obj)crc32.o: $(obj)crc32.c + $(CC) -g $(CFLAGS) -c -o $@ $< -mkimage.o: mkimage.c - $(CC) -g $(CFLAGS) -c $< +$(obj)mkimage.o: $(src)mkimage.c + $(CC) -g $(CFLAGS) -c -o $@ $< -ncb.o: ncb.c - $(CC) -g $(CFLAGS) -c $< +$(obj)ncb.o: $(src)ncb.c + $(CC) -g $(CFLAGS) -c -o $@ $< -gen_eth_addr.o: gen_eth_addr.c - $(CC) -g $(CFLAGS) -c $< +$(obj)gen_eth_addr.o: $(src)gen_eth_addr.c + $(CC) -g $(CFLAGS) -c -o $@ $< -inca-swap-bytes.o: inca-swap-bytes.c - $(CC) -g $(CFLAGS) -c $< +$(obj)inca-swap-bytes.o: $(src)inca-swap-bytes.c + $(CC) -g $(CFLAGS) -c -o $@ $< -mpc86x_clk.o: mpc86x_clk.c - $(CC) -g $(CFLAGS) -c $< +$(obj)mpc86x_clk.o: $(src)mpc86x_clk.c + $(CC) -g $(CFLAGS) -c -o $@ $< subdirs: ifeq ($(TOOLSUBDIRS),) @@ -184,25 +192,25 @@ else done endif -environment.c: - @rm -f environment.c - ln -s ../common/environment.c environment.c +$(obj)environment.c: + @rm -f $(obj)environment.c + ln -s $(src)../common/environment.c $(obj)environment.c -environment.o: environment.c - $(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c $< +$(obj)environment.o: $(obj)environment.c + $(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c -o $@ $< -crc32.c: - @rm -f crc32.c - ln -s ../lib_generic/crc32.c crc32.c +$(obj)crc32.c: + @rm -f $(obj)crc32.c + ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c -$(LOGO_H): bmp_logo $(LOGO_BMP) - ./bmp_logo $(LOGO_BMP) >$@ +$(LOGO_H): $(obj)bmp_logo $(LOGO_BMP) + $(obj)./bmp_logo $(LOGO_BMP) >$@ ######################################################################### -.depend: Makefile $(OBJS:.o=.c) - $(CC) -M $(HOST_CFLAGS) $(CPPFLAGS) $(OBJS:.o=.c) > $@ +# defines $(obj).depend target +include $(SRCTREE)/rules.mk -sinclude .depend +sinclude $(obj).depend ######################################################################### diff --git a/tools/env/Makefile b/tools/env/Makefile index 9ce477c..1f16768 100644 --- a/tools/env/Makefile +++ b/tools/env/Makefile @@ -1,5 +1,5 @@ # -# (C) Copyright 2002 +# (C) Copyright 2002-2006 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # # See file CREDITS for list of people who contributed to this @@ -21,25 +21,28 @@ # MA 02111-1307 USA # -SOURCES := crc32.c fw_env.c fw_env_main.c -HEADERS := fw_env.h +include $(TOPDIR)/config.mk -all: fw_printenv +SRCS := $(obj)crc32.c fw_env.c fw_env_main.c +HEADERS := fw_env.h -fw_printenv: $(SOURCES) $(HEADERS) - $(CROSS_COMPILE)gcc -Wall -DUSE_HOSTCC $(SOURCES) -o fw_printenv +CPPFLAGS := -Wall -DUSE_HOSTCC + +all: $(obj)fw_printenv + +$(obj)fw_printenv: $(SRCS) $(HEADERS) + $(CROSS_COMPILE)gcc $(CPPFLAGS) $(SRCS) -o $(obj)fw_printenv clean: - rm -f fw_printenv crc32.c + rm -f $(obj)fw_printenv $(obj)crc32.c -crc32.c: - ln -s ../../lib_generic/crc32.c crc32.c +$(obj)crc32.c: + ln -s $(src)../../lib_generic/crc32.c $(obj)crc32.c ######################################################################### -.depend: Makefile $(SOURCES) - $(CC) -M $(HOST_CFLAGS) $(CPPFLAGS) -DUSE_HOSTCC $(SOURCES) > $@ +include $(TOPDIR)/rules.mk -sinclude .depend +sinclude $(obj).depend ######################################################################### diff --git a/tools/gdb/Makefile b/tools/gdb/Makefile index e7618b7..dbcb91f 100644 --- a/tools/gdb/Makefile +++ b/tools/gdb/Makefile @@ -1,4 +1,7 @@ # +# (C) Copyright 2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# # (C) Copyright 2000 # Murray Jensen <Murray.Jensen@csiro.au> # @@ -25,7 +28,11 @@ include $(TOPDIR)/config.mk BINS = gdbsend gdbcont -OBJS = gdbsend.o gdbcont.o error.o remote.o serial.o +COBJS = gdbsend.o gdbcont.o error.o remote.o serial.o + +OBJS := $(addprefix $(obj),$(COBJS)) +SRCS := $(COBJS:.o=.c) +BINS := $(addprefix $(obj),$(BINS)) # # Use native tools and options @@ -44,26 +51,26 @@ all: else # ! CYGWIN -all: $(BINS) +all: $(obj).depend $(BINS) -gdbsend: gdbsend.o error.o remote.o serial.o +$(obj)gdbsend: $(obj)gdbsend.o $(obj)error.o $(obj)remote.o $(obj)serial.o $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ -gdbcont: gdbcont.o error.o remote.o serial.o +$(obj)gdbcont: $(obj)gdbcont.o $(obj)error.o $(obj)remote.o $(obj)serial.o $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ clean: rm -f $(OBJS) distclean: clean - rm -f $(BINS) core *.bak .depend + rm -f $(BINS) $(obj)core $(obj)*.bak $(obj).depend ######################################################################### -.depend: Makefile $(OBJS:.o=.c) - $(CC) -M $(CPPFLAGS) -I../include $(OBJS:.o=.c) > $@ +# defines $(obj).depend target +include $(SRCTREE)/rules.mk --include .depend +sinclude $(obj).depend ######################################################################### diff --git a/tools/updater/Makefile b/tools/updater/Makefile index 3fa1912..e9684cb 100644 --- a/tools/updater/Makefile +++ b/tools/updater/Makefile @@ -1,5 +1,5 @@ # -# (C) Copyright 2000 +# (C) Copyright 2000-2006 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # # See file CREDITS for list of people who contributed to this @@ -25,62 +25,81 @@ LOAD_ADDR = 0x40000 include $(TOPDIR)/config.mk -PROG = updater -IMAGE = updater.image -SRC = update.c flash.c flash_hw.c utils.c cmd_flash.c string.c ctype.c dummy.c -ASRC = ppcstring.S -OBJS = $(SRC:.c=.o) $(ASRC:.S=.o) +PROG = $(obj)updater +IMAGE = $(obj)updater.image -LIB = $(TOPDIR)/examples/libstubs.a -LIBAOBJS= -LIBCOBJS= $(TOPDIR)/examples/stubs.o -LIBOBJS = $(LIBAOBJS) $(LIBCOBJS) +COBJS = update.o flash.o flash_hw.o utils.o cmd_flash.o string.o ctype.o dummy.o +COBJS_LINKS = stubs.o +AOBJS = ppcstring.o +AOBJS_LINKS = memio.o + +OBJS := $(addprefix $(obj),$(COBJS) $(COBJS_LINKS) $(AOBJS) $(AOBJS_LINKS)) +SRCS := $(COBJS:.o=.c) $(AOBJS:.o=.S) $(addprefix $(obj), $(COBJS_LINKS:.o:.c) $(AOBJS_LINKS:.o:.S)) CPPFLAGS += -I$(TOPDIR) -I$(TOPDIR)/board/MAI/AmigaOneG3SE CFLAGS += -I$(TOPDIR)/board/MAI/AmigaOneG3SE +AFLAGS += -I$(TOPDIR)/board/MAI/AmigaOneG3SE + +DEPS = $(OBJTREE)/u-boot.bin $(OBJTREE)/tools/mkimage +ifneq ($(DEPS),$(wildcard $(DEPS))) +$(error "updater: Missing required objects, please run regular build first") +endif -all: .depend $(LIB) $(PROG) +all: $(obj).depend $(PROG) $(IMAGE) ######################################################################### -$(LIB): .depend $(LIBOBJS) - $(AR) crv $@ $(LIBOBJS) -%.srec: %.o $(LIB) +$(obj)%.srec: %.o $(LIB) $(LD) -g -Ttext $(LOAD_ADDR) -o $(<:.o=) -e $(<:.o=) $< $(LIB) $(OBJCOPY) -O srec $(<:.o=) $@ -%.o: %.c - $(CC) $(CPPFLAGS) -c $< +$(obj)%.o: %.c + $(CC) $(CFLAGS) -c -o $@ $< + +$(obj)%.o: %.S + $(CC) $(AFLAGS) -c -o $@ $< + +$(obj)memio.o: $(obj)memio.S + $(CC) $(AFLAGS) -c -o $@ $< -%.o: %.S - $(CC) $(CPPFLAGS) -c $< +$(obj)memio.S: + rm -f $(obj)memio.c + ln -s $(SRCTREE)/board/MAI/AmigaOneG3SE/memio.S $(obj)memio.S + +$(obj)stubs.o: $(obj)stubs.c + $(CC) $(CFLAGS) -c -o $@ $< + +$(obj)stubs.c: + rm -f $(obj)stubs.c + ln -s $(SRCTREE)/examples/stubs.c $(obj)stubs.c ######################################################################### -updater: $(OBJS) $(LIB) $(TOPDIR)/board/MAI/AmigaOneG3SE/memio.o - $(LD) -g -Ttext $(LOAD_ADDR) -o updater -e _main $(OBJS) $(LIB) \ - $(TOPDIR)/board/MAI/AmigaOneG3SE/memio.o - $(OBJCOPY) -O binary updater updater.bin +$(obj)updater: $(OBJS) + $(LD) -g -Ttext $(LOAD_ADDR) -o $(obj)updater -e _main $(OBJS) + $(OBJCOPY) -O binary $(obj)updater $(obj)updater.bin -updater.image: updater $(TOPDIR)/u-boot.bin - cat >/tmp/tempimage updater.bin junk $(TOPDIR)/u-boot.bin - $(TOPDIR)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \ - -e `ppc-elf32-nm updater | grep _main | cut --bytes=0-8` \ - -n "Firmware Updater" -d /tmp/tempimage updater.image +$(obj)updater.image: $(obj)updater $(OBJTREE)/u-boot.bin + cat >/tmp/tempimage $(obj)updater.bin junk $(OBJTREE)/u-boot.bin + $(OBJTREE)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \ + -e `$(NM) $(obj)updater | grep _main | cut --bytes=0-8` \ + -n "Firmware Updater" -d /tmp/tempimage $(obj)updater.image rm /tmp/tempimage - cp updater.image /tftpboot + cp $(obj)updater.image /tftpboot -updater.image2: updater $(TOPDIR)/u-boot.bin - cat >/tmp/tempimage updater.bin junk ../../create_image/image - $(TOPDIR)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \ - -e `ppc-elf32-nm updater | grep _main | cut --bytes=0-8` \ - -n "Firmware Updater" -d /tmp/tempimage updater.image +(obj)updater.image2: $(obj)updater $(OBJTREE)/u-boot.bin + cat >/tmp/tempimage $(obj)updater.bin junk ../../create_image/image + $(OBJTREE)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \ + -e `$(NM) $(obj)updater | grep _main | cut --bytes=0-8` \ + -n "Firmware Updater" -d /tmp/tempimage $(obj)updater.image rm /tmp/tempimage - cp updater.image /tftpboot + cp $(obj)updater.image /tftpboot + +######################################################################### -.depend: Makefile $(SRC) $(ASRC) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S) - $(CC) -M $(CFLAGS) $(SRC) $(ASRC) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S) > $@ +# defines $(obj).depend target +include $(SRCTREE)/rules.mk -sinclude .depend +sinclude $(obj).depend ######################################################################### |