Makefile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #
  2. # (C) Copyright 2005
  3. # Ladislav Michl, 2N Telekomunikace, michl@2n.cz
  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. include $(TOPDIR)/config.mk
  24. LIB = lib$(BOARD).a
  25. OBJS := netstar.o flash.o nand.o
  26. SOBJS := setup.o crcek.o
  27. gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
  28. LOAD_ADDR = 0x10400000
  29. LDSCRIPT = $(TOPDIR)/board/$(BOARDDIR)/eeprom.lds
  30. HOST_CFLAGS = -Wall -pedantic -I$(TOPDIR)/include
  31. all: $(LIB) eeprom.srec eeprom.bin crcek.srec crcek.bin crcit
  32. $(LIB): $(OBJS) $(SOBJS)
  33. $(AR) crv $@ $^
  34. eeprom.srec: eeprom.o eeprom_start.o
  35. $(LD) -T $(LDSCRIPT) -g -Ttext $(LOAD_ADDR) \
  36. -o $(<:.o=) -e $(<:.o=) $^ \
  37. -L../../examples -lstubs \
  38. -L../../lib_generic -lgeneric \
  39. -L$(gcclibdir) -lgcc
  40. $(OBJCOPY) -O srec $(<:.o=) $@
  41. eeprom.bin: eeprom.srec
  42. $(OBJCOPY) -I srec -O binary $< $@ 2>/dev/null
  43. crcek.srec: crcek.o
  44. $(LD) -g -Ttext 0x00000000 \
  45. -o $(<:.o=) -e $(<:.o=) $^
  46. $(OBJCOPY) -O srec $(<:.o=) $@
  47. crcek.bin: crcek.srec
  48. $(OBJCOPY) -I srec -O binary $< $@ 2>/dev/null
  49. crcit: crcit.o crc32.o
  50. $(HOSTCC) $(HOST_CFLAGS) -o $@ $^
  51. crcit.o: crcit.c
  52. $(HOSTCC) $(HOST_CFLAGS) -c $<
  53. crc32.o: $(TOPDIR)/tools/crc32.c
  54. $(HOSTCC) $(HOST_CFLAGS) -DUSE_HOSTCC -c $<
  55. clean:
  56. rm -f $(SOBJS) $(OBJS) eeprom eeprom.srec eeprom.bin \
  57. crcek crcek.srec crcek.bin
  58. distclean: clean
  59. rm -f $(LIB) core *.bak .depend
  60. #########################################################################
  61. .depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
  62. $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
  63. -include .depend
  64. #########################################################################