Wolfgang Denk | ac7eb8a | 2005-09-14 23:53:32 +0200 | [diff] [blame^] | 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 | |
| 24 | include $(TOPDIR)/config.mk |
| 25 | |
| 26 | LIB = lib$(BOARD).a |
| 27 | |
| 28 | OBJS := netstar.o flash.o nand.o |
| 29 | SOBJS := setup.o crcek.o |
| 30 | |
| 31 | gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) |
| 32 | |
| 33 | LOAD_ADDR = 0x10400000 |
| 34 | LDSCRIPT = $(TOPDIR)/board/$(BOARDDIR)/eeprom.lds |
| 35 | |
| 36 | HOST_CFLAGS = -Wall -pedantic -I$(TOPDIR)/include |
| 37 | |
| 38 | all: $(LIB) eeprom.srec eeprom.bin crcek.srec crcek.bin crcit |
| 39 | |
| 40 | $(LIB): $(OBJS) $(SOBJS) |
| 41 | $(AR) crv $@ $^ |
| 42 | |
| 43 | eeprom.srec: eeprom.o eeprom_start.o |
| 44 | $(LD) -T $(LDSCRIPT) -g -Ttext $(LOAD_ADDR) \ |
| 45 | -o $(<:.o=) -e $(<:.o=) $^ \ |
| 46 | -L../../examples -lstubs \ |
| 47 | -L../../lib_generic -lgeneric \ |
| 48 | -L$(gcclibdir) -lgcc |
| 49 | $(OBJCOPY) -O srec $(<:.o=) $@ |
| 50 | |
| 51 | eeprom.bin: eeprom.srec |
| 52 | $(OBJCOPY) -I srec -O binary $< $@ 2>/dev/null |
| 53 | |
| 54 | crcek.srec: crcek.o |
| 55 | $(LD) -g -Ttext 0x00000000 \ |
| 56 | -o $(<:.o=) -e $(<:.o=) $^ |
| 57 | $(OBJCOPY) -O srec $(<:.o=) $@ |
| 58 | |
| 59 | crcek.bin: crcek.srec |
| 60 | $(OBJCOPY) -I srec -O binary $< $@ 2>/dev/null |
| 61 | |
| 62 | crcit: crcit.o crc32.o |
| 63 | $(HOSTCC) $(HOST_CFLAGS) -o $@ $^ |
| 64 | |
| 65 | crcit.o: crcit.c |
| 66 | $(HOSTCC) $(HOST_CFLAGS) -c $< |
| 67 | |
| 68 | crc32.o: $(TOPDIR)/tools/crc32.c |
| 69 | $(HOSTCC) $(HOST_CFLAGS) -DUSE_HOSTCC -c $< |
| 70 | |
| 71 | clean: |
| 72 | rm -f $(SOBJS) $(OBJS) eeprom eeprom.srec eeprom.bin \ |
| 73 | crcek crcek.srec crcek.bin |
| 74 | |
| 75 | distclean: clean |
| 76 | rm -f $(LIB) core *.bak .depend |
| 77 | |
| 78 | ######################################################################### |
| 79 | |
| 80 | .depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) |
| 81 | $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@ |
| 82 | |
| 83 | -include .depend |
| 84 | |
| 85 | ######################################################################### |