blob: 88da2b948385fe1b454b962abb2114cc79350092 [file] [log] [blame]
Wolfgang Denk511d0c72006-10-09 00:42:01 +02001#
Marian Balakowiczf9328632006-09-01 19:49:50 +02002# (C) Copyright 2006
3# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +02004#
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
27include $(TOPDIR)/config.mk
28
Marian Balakowiczf9328632006-09-01 19:49:50 +020029LIB = $(obj)lib$(BOARD).a
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020030
Marian Balakowiczf9328632006-09-01 19:49:50 +020031COBJS := netstar.o flash.o nand.o
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020032SOBJS := setup.o crcek.o
33
Marian Balakowiczf9328632006-09-01 19:49:50 +020034SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) eeprom.c \
35 eeprom_start.S
36OBJS := $(addprefix $(obj),$(COBJS))
37SOBJS := $(addprefix $(obj),$(SOBJS))
38
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020039gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
40
41LOAD_ADDR = 0x10400000
42LDSCRIPT = $(TOPDIR)/board/$(BOARDDIR)/eeprom.lds
Marian Balakowiczf9328632006-09-01 19:49:50 +020043lnk = $(if $(obj),$(obj),.)
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020044
45HOST_CFLAGS = -Wall -pedantic -I$(TOPDIR)/include
46
Marian Balakowiczf9328632006-09-01 19:49:50 +020047all: $(obj).depend $(LIB) $(obj)eeprom.srec $(obj)eeprom.bin \
48 $(obj)crcek.srec $(obj)crcek.bin $(obj)crcit
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020049
50$(LIB): $(OBJS) $(SOBJS)
Wolfgang Denk2b208f52006-10-09 01:02:05 +020051 $(AR) $(ARFLAGS) $@ $^
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020052
Marian Balakowiczf9328632006-09-01 19:49:50 +020053$(obj)eeprom.srec: $(obj)eeprom.o $(obj)eeprom_start.o
54 cd $(lnk) && $(LD) -T $(LDSCRIPT) -g -Ttext $(LOAD_ADDR) \
55 -o $(<:.o=) -e eeprom eeprom.o eeprom_start.o \
56 -L$(obj)../../examples -lstubs \
57 -L$(obj)../../lib_generic -lgeneric \
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020058 -L$(gcclibdir) -lgcc
59 $(OBJCOPY) -O srec $(<:.o=) $@
60
Marian Balakowiczf9328632006-09-01 19:49:50 +020061$(obj)eeprom.bin: $(obj)eeprom.srec
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020062 $(OBJCOPY) -I srec -O binary $< $@ 2>/dev/null
63
Marian Balakowiczf9328632006-09-01 19:49:50 +020064$(obj)crcek.srec: $(obj)crcek.o
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020065 $(LD) -g -Ttext 0x00000000 \
Marian Balakowiczf9328632006-09-01 19:49:50 +020066 -o $(<:.o=) -e crcek $^
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020067 $(OBJCOPY) -O srec $(<:.o=) $@
68
Marian Balakowiczf9328632006-09-01 19:49:50 +020069$(obj)crcek.bin: $(obj)crcek.srec
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020070 $(OBJCOPY) -I srec -O binary $< $@ 2>/dev/null
71
Marian Balakowiczf9328632006-09-01 19:49:50 +020072$(obj)crcit: $(obj)crcit.o $(obj)crc32.o
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020073 $(HOSTCC) $(HOST_CFLAGS) -o $@ $^
74
Marian Balakowiczf9328632006-09-01 19:49:50 +020075$(obj)crcit.o: crcit.c
76 $(HOSTCC) $(HOST_CFLAGS) -o $@ -c $<
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020077
Marian Balakowiczf9328632006-09-01 19:49:50 +020078$(obj)crc32.o: $(OBJTREE)/tools/crc32.c
79 $(HOSTCC) $(HOST_CFLAGS) -DUSE_HOSTCC -o $@ -c $<
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020080
81clean:
Marian Balakowiczf9328632006-09-01 19:49:50 +020082 rm -f $(SOBJS) $(OBJS) $(obj)eeprom $(obj)eeprom.srec \
83 $(obj)eeprom.bin $(obj)crcek $(obj)crcek.srec \
84 $(obj)crcek.bin
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020085
86distclean: clean
87 rm -f $(LIB) core *.bak .depend
88
89#########################################################################
90
Marian Balakowiczf9328632006-09-01 19:49:50 +020091# defines $(obj).depend target
92include $(SRCTREE)/rules.mk
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020093
Marian Balakowiczf9328632006-09-01 19:49:50 +020094sinclude $(obj).depend
Wolfgang Denkac7eb8a2005-09-14 23:53:32 +020095
96#########################################################################