blob: 7230a2f88abf2b597c747a682f909de7d32b0b09 [file] [log] [blame]
Wolfgang Denk4df0da52006-10-09 00:42:01 +02001#
Marian Balakowiczd62379d2006-09-01 19:49:50 +02002# (C) Copyright 2006
3# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Wolfgang Denk7b9bc3a2005-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
Sebastien Carliera8d426f2010-11-05 15:48:07 +010029LIB = $(obj)lib$(BOARD).o
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020030
Ladislav Michl6e9911c2009-03-31 13:43:10 +020031COBJS := netstar.o
Ladislav Michl9f7ee9d2010-02-08 14:15:47 -050032SOBJS := setup.o
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020033
Ladislav Michl9f7ee9d2010-02-08 14:15:47 -050034SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
Marian Balakowiczd62379d2006-09-01 19:49:50 +020035OBJS := $(addprefix $(obj),$(COBJS))
36SOBJS := $(addprefix $(obj),$(SOBJS))
37
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020038LOAD_ADDR = 0x10400000
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020039
Ladislav Michl9f7ee9d2010-02-08 14:15:47 -050040#########################################################################
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020041
Marian Balakowiczd62379d2006-09-01 19:49:50 +020042all: $(obj).depend $(LIB) $(obj)eeprom.srec $(obj)eeprom.bin \
43 $(obj)crcek.srec $(obj)crcek.bin $(obj)crcit
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020044
45$(LIB): $(OBJS) $(SOBJS)
Sebastien Carliera8d426f2010-11-05 15:48:07 +010046 $(call cmd_link_o_target, $^)
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020047
Ladislav Michl9f7ee9d2010-02-08 14:15:47 -050048$(obj)eeprom_start.o:
49 echo "b eeprom" | $(CC) $(AFLAGS) -c -x assembler -o $@ -
50
51$(obj)eeprom: $(obj)eeprom_start.o $(obj)eeprom.o
52 $(LD) -Ttext $(LOAD_ADDR) -e eeprom -o $@ $^ \
Wolfgang Denk85faf452009-07-22 23:53:23 +020053 -L$(obj)../../examples/standalone -lstubs \
Ladislav Michl9f7ee9d2010-02-08 14:15:47 -050054 $(PLATFORM_LIBS)
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020055
Ladislav Michl9f7ee9d2010-02-08 14:15:47 -050056$(obj)eeprom.srec: $(obj)eeprom
57 $(OBJCOPY) -S -O srec $(<:.o=) $@
58
59$(obj)eeprom.bin: $(obj)eeprom
60 $(OBJCOPY) -S -O binary $< $@
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020061
Marian Balakowiczd62379d2006-09-01 19:49:50 +020062$(obj)crcek.srec: $(obj)crcek.o
Ladislav Michl9f7ee9d2010-02-08 14:15:47 -050063 $(LD) -g -Ttext 0x00000000 -e crcek -o $(<:.o=) $^
64 $(OBJCOPY) -S -O srec $(<:.o=) $@
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020065
Marian Balakowiczd62379d2006-09-01 19:49:50 +020066$(obj)crcek.bin: $(obj)crcek.srec
Ladislav Michl9f7ee9d2010-02-08 14:15:47 -050067 $(OBJCOPY) -I srec -O binary $< $@
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020068
Marian Balakowiczd62379d2006-09-01 19:49:50 +020069$(obj)crcit: $(obj)crcit.o $(obj)crc32.o
Mike Frysinger00d5bfd2009-07-19 15:17:03 -040070 $(HOSTCC) $(HOSTCFLAGS) -o $@ $^
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020071
Ladislav Michl9f7ee9d2010-02-08 14:15:47 -050072$(obj)crcit.o: crcit.c
Mike Frysinger00d5bfd2009-07-19 15:17:03 -040073 $(HOSTCC) $(HOSTCFLAGS) -o $@ -c $<
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020074
Peter Tyser685b7f52010-04-12 22:28:05 -050075$(obj)crc32.o: $(SRCTREE)/lib/crc32.c
Ladislav Michl9f7ee9d2010-02-08 14:15:47 -050076 $(HOSTCC) $(HOSTCFLAGS) -DUSE_HOSTCC -I$(TOPDIR)/include \
77 -o $@ -c $<
Wolfgang Denk18d46c02009-08-17 14:00:53 +020078
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020079clean:
Ladislav Michl9f7ee9d2010-02-08 14:15:47 -050080 rm -f $(SOBJS) $(OBJS) \
81 $(obj)eeprom_start.o $(obj)eeprom.o \
82 $(obj)eeprom $(obj)eeprom.srec $(obj)eeprom.bin \
83 $(obj)crcek.o $(obj)crcek $(obj)crcek.srec $(obj)crcek.bin
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020084
85distclean: clean
Wolfgang Denk6140a022008-07-02 23:49:18 +020086 rm -f $(LIB) core *.bak $(obj).depend
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020087
88#########################################################################
89
Marian Balakowiczd62379d2006-09-01 19:49:50 +020090# defines $(obj).depend target
91include $(SRCTREE)/rules.mk
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020092
Marian Balakowiczd62379d2006-09-01 19:49:50 +020093sinclude $(obj).depend
Wolfgang Denk7b9bc3a2005-09-14 23:53:32 +020094
95#########################################################################