Makefile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #
  2. # (C) Copyright 2006
  3. # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. #
  5. # (C) Copyright 2005
  6. # Ladislav Michl, 2N Telekomunikace, michl@2n.cz
  7. #
  8. # See file CREDITS for list of people who contributed to this
  9. # project.
  10. #
  11. # This program is free software; you can redistribute it and/or
  12. # modify it under the terms of the GNU General Public License as
  13. # published by the Free Software Foundation; either version 2 of
  14. # the License, or (at your option) any later version.
  15. #
  16. # This program is distributed in the hope that it will be useful,
  17. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. # GNU General Public License for more details.
  20. #
  21. # You should have received a copy of the GNU General Public License
  22. # along with this program; if not, write to the Free Software
  23. # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  24. # MA 02111-1307 USA
  25. #
  26. include $(TOPDIR)/config.mk
  27. LIB = $(obj)lib$(BOARD).a
  28. COBJS := netstar.o
  29. SOBJS := setup.o crcek.o
  30. SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) eeprom.c \
  31. eeprom_start.S
  32. OBJS := $(addprefix $(obj),$(COBJS))
  33. SOBJS := $(addprefix $(obj),$(SOBJS))
  34. gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
  35. LOAD_ADDR = 0x10400000
  36. LDSCRIPT = $(TOPDIR)/board/$(BOARDDIR)/eeprom.lds
  37. lnk = $(if $(obj),$(obj),.)
  38. HOST_CFLAGS = -Wall -pedantic -I$(TOPDIR)/include
  39. all: $(obj).depend $(LIB) $(obj)eeprom.srec $(obj)eeprom.bin \
  40. $(obj)crcek.srec $(obj)crcek.bin $(obj)crcit
  41. $(LIB): $(OBJS) $(SOBJS)
  42. $(AR) $(ARFLAGS) $@ $^
  43. $(obj)eeprom.srec: $(obj)eeprom.o $(obj)eeprom_start.o
  44. cd $(lnk) && $(LD) -T $(LDSCRIPT) -g -Ttext $(LOAD_ADDR) \
  45. -o $(<:.o=) -e eeprom eeprom.o eeprom_start.o \
  46. -L$(obj)../../examples -lstubs \
  47. -L$(obj)../../lib_generic -lgeneric \
  48. -L$(gcclibdir) -lgcc
  49. $(OBJCOPY) -O srec $(<:.o=) $@
  50. $(obj)eeprom.bin: $(obj)eeprom.srec
  51. $(OBJCOPY) -I srec -O binary $< $@ 2>/dev/null
  52. $(obj)crcek.srec: $(obj)crcek.o
  53. $(LD) -g -Ttext 0x00000000 \
  54. -o $(<:.o=) -e crcek $^
  55. $(OBJCOPY) -O srec $(<:.o=) $@
  56. $(obj)crcek.bin: $(obj)crcek.srec
  57. $(OBJCOPY) -I srec -O binary $< $@ 2>/dev/null
  58. $(obj)crcit: $(obj)crcit.o $(obj)crc32.o
  59. $(HOSTCC) $(HOST_CFLAGS) -o $@ $^
  60. $(obj)crcit.o: crcit.c
  61. $(HOSTCC) $(HOST_CFLAGS) -o $@ -c $<
  62. $(obj)crc32.o: $(SRCTREE)/lib_generic/crc32.c
  63. $(HOSTCC) $(HOST_CFLAGS) -DUSE_HOSTCC -o $@ -c $<
  64. clean:
  65. rm -f $(SOBJS) $(OBJS) $(obj)eeprom $(obj)eeprom.srec \
  66. $(obj)eeprom.bin $(obj)crcek $(obj)crcek.srec \
  67. $(obj)crcek.bin
  68. distclean: clean
  69. rm -f $(LIB) core *.bak $(obj).depend
  70. #########################################################################
  71. # defines $(obj).depend target
  72. include $(SRCTREE)/rules.mk
  73. sinclude $(obj).depend
  74. #########################################################################