Makefile 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #
  2. # (C) Copyright 2000
  3. # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. #
  5. # See file CREDITS for list of people who contributed to this
  6. # project.
  7. #
  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.
  12. #
  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.
  17. #
  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,
  21. # MA 02111-1307 USA
  22. #
  23. LOAD_ADDR = 0x40000
  24. include $(TOPDIR)/config.mk
  25. PROG = updater
  26. IMAGE = updater.image
  27. SRC = update.c flash.c flash_hw.c utils.c cmd_flash.c string.c ctype.c dummy.c
  28. ASRC = ppcstring.S
  29. OBJS = $(SRC:.c=.o) $(ASRC:.S=.o)
  30. LIB = $(TOPDIR)/examples/libstubs.a
  31. LIBAOBJS=
  32. LIBCOBJS= $(TOPDIR)/examples/stubs.o
  33. LIBOBJS = $(LIBAOBJS) $(LIBCOBJS)
  34. CPPFLAGS += -I$(TOPDIR) -I$(TOPDIR)/board/MAI/AmigaOneG3SE
  35. CFLAGS += -I$(TOPDIR)/board/MAI/AmigaOneG3SE
  36. all: .depend $(LIB) $(PROG)
  37. #########################################################################
  38. $(LIB): .depend $(LIBOBJS)
  39. $(AR) crv $@ $(LIBOBJS)
  40. %.srec: %.o $(LIB)
  41. $(LD) -g -Ttext $(LOAD_ADDR) -o $(<:.o=) -e $(<:.o=) $< $(LIB)
  42. $(OBJCOPY) -O srec $(<:.o=) $@
  43. %.o: %.c
  44. $(CC) $(CPPFLAGS) -c $<
  45. %.o: %.S
  46. $(CC) $(CPPFLAGS) -c $<
  47. #########################################################################
  48. updater: $(OBJS) $(LIB) $(TOPDIR)/board/MAI/AmigaOneG3SE/memio.o
  49. $(LD) -g -Ttext $(LOAD_ADDR) -o updater -e _main $(OBJS) $(LIB) \
  50. $(TOPDIR)/board/MAI/AmigaOneG3SE/memio.o
  51. $(OBJCOPY) -O binary updater updater.bin
  52. updater.image: updater $(TOPDIR)/u-boot.bin
  53. cat >/tmp/tempimage updater.bin junk $(TOPDIR)/u-boot.bin
  54. $(TOPDIR)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \
  55. -e `ppc-elf32-nm updater | grep _main | cut --bytes=0-8` \
  56. -n "Firmware Updater" -d /tmp/tempimage updater.image
  57. rm /tmp/tempimage
  58. cp updater.image /tftpboot
  59. updater.image2: updater $(TOPDIR)/u-boot.bin
  60. cat >/tmp/tempimage updater.bin junk ../../create_image/image
  61. $(TOPDIR)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \
  62. -e `ppc-elf32-nm updater | grep _main | cut --bytes=0-8` \
  63. -n "Firmware Updater" -d /tmp/tempimage updater.image
  64. rm /tmp/tempimage
  65. cp updater.image /tftpboot
  66. .depend: Makefile $(SRC) $(ASRC) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
  67. $(CC) -M $(CFLAGS) $(SRC) $(ASRC) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S) > $@
  68. sinclude .depend
  69. #########################################################################