blob: 8ef21893ee748f530be5c220f5d16950784db9fe [file] [log] [blame]
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +02001#
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
24include $(TOPDIR)/config.mk
25
26LIB = lib$(BOARD).a
27
28OBJS := netstar.o flash.o nand.o
29SOBJS := setup.o crcek.o
30
31gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
32
33LOAD_ADDR = 0x10400000
34LDSCRIPT = $(TOPDIR)/board/$(BOARDDIR)/eeprom.lds
35
36HOST_CFLAGS = -Wall -pedantic -I$(TOPDIR)/include
37
38all: $(LIB) eeprom.srec eeprom.bin crcek.srec crcek.bin crcit
39
40$(LIB): $(OBJS) $(SOBJS)
41 $(AR) crv $@ $^
42
43eeprom.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
51eeprom.bin: eeprom.srec
52 $(OBJCOPY) -I srec -O binary $< $@ 2>/dev/null
53
54crcek.srec: crcek.o
55 $(LD) -g -Ttext 0x00000000 \
56 -o $(<:.o=) -e $(<:.o=) $^
57 $(OBJCOPY) -O srec $(<:.o=) $@
58
59crcek.bin: crcek.srec
60 $(OBJCOPY) -I srec -O binary $< $@ 2>/dev/null
61
62crcit: crcit.o crc32.o
63 $(HOSTCC) $(HOST_CFLAGS) -o $@ $^
64
65crcit.o: crcit.c
66 $(HOSTCC) $(HOST_CFLAGS) -c $<
67
68crc32.o: $(TOPDIR)/tools/crc32.c
69 $(HOSTCC) $(HOST_CFLAGS) -DUSE_HOSTCC -c $<
70
71clean:
72 rm -f $(SOBJS) $(OBJS) eeprom eeprom.srec eeprom.bin \
73 crcek crcek.srec crcek.bin
74
75distclean: 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#########################################################################