Wolfgang Denk | 4df0da5 | 2006-10-09 00:42:01 +0200 | [diff] [blame] | 1 | # |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 2 | # (C) Copyright 2006 |
| 3 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 4 | # |
| 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 | |
| 27 | include $(TOPDIR)/config.mk |
| 28 | |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 29 | LIB = $(obj)lib$(BOARD).a |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 30 | |
Ladislav Michl | 6e9911c | 2009-03-31 13:43:10 +0200 | [diff] [blame] | 31 | COBJS := netstar.o |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 32 | SOBJS := setup.o crcek.o |
| 33 | |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 34 | SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) eeprom.c \ |
| 35 | eeprom_start.S |
| 36 | OBJS := $(addprefix $(obj),$(COBJS)) |
| 37 | SOBJS := $(addprefix $(obj),$(SOBJS)) |
| 38 | |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 39 | gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) |
| 40 | |
| 41 | LOAD_ADDR = 0x10400000 |
| 42 | LDSCRIPT = $(TOPDIR)/board/$(BOARDDIR)/eeprom.lds |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 43 | lnk = $(if $(obj),$(obj),.) |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 44 | |
Mike Frysinger | 00d5bfd | 2009-07-19 15:17:03 -0400 | [diff] [blame] | 45 | HOSTCFLAGS = -Wall -pedantic -I$(TOPDIR)/include |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 46 | |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 47 | all: $(obj).depend $(LIB) $(obj)eeprom.srec $(obj)eeprom.bin \ |
| 48 | $(obj)crcek.srec $(obj)crcek.bin $(obj)crcit |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 49 | |
| 50 | $(LIB): $(OBJS) $(SOBJS) |
Wolfgang Denk | 6a65e42 | 2006-10-09 01:02:05 +0200 | [diff] [blame] | 51 | $(AR) $(ARFLAGS) $@ $^ |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 52 | |
Wolfgang Denk | 18d46c0 | 2009-08-17 14:00:53 +0200 | [diff] [blame] | 53 | $(obj)eeprom.srec: $(obj)eeprom.o $(obj)eeprom_start.o $(obj)u-boot.lds |
| 54 | cd $(lnk) && $(LD) -T $(obj)u-boot.lds -g -Ttext $(LOAD_ADDR) \ |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 55 | -o $(<:.o=) -e eeprom eeprom.o eeprom_start.o \ |
Wolfgang Denk | 85faf45 | 2009-07-22 23:53:23 +0200 | [diff] [blame] | 56 | -L$(obj)../../examples/standalone -lstubs \ |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 57 | -L$(obj)../../lib_generic -lgeneric \ |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 58 | -L$(gcclibdir) -lgcc |
| 59 | $(OBJCOPY) -O srec $(<:.o=) $@ |
| 60 | |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 61 | $(obj)eeprom.bin: $(obj)eeprom.srec |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 62 | $(OBJCOPY) -I srec -O binary $< $@ 2>/dev/null |
| 63 | |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 64 | $(obj)crcek.srec: $(obj)crcek.o |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 65 | $(LD) -g -Ttext 0x00000000 \ |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 66 | -o $(<:.o=) -e crcek $^ |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 67 | $(OBJCOPY) -O srec $(<:.o=) $@ |
| 68 | |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 69 | $(obj)crcek.bin: $(obj)crcek.srec |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 70 | $(OBJCOPY) -I srec -O binary $< $@ 2>/dev/null |
| 71 | |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 72 | $(obj)crcit: $(obj)crcit.o $(obj)crc32.o |
Mike Frysinger | 00d5bfd | 2009-07-19 15:17:03 -0400 | [diff] [blame] | 73 | $(HOSTCC) $(HOSTCFLAGS) -o $@ $^ |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 74 | |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 75 | $(obj)crcit.o: crcit.c |
Mike Frysinger | 00d5bfd | 2009-07-19 15:17:03 -0400 | [diff] [blame] | 76 | $(HOSTCC) $(HOSTCFLAGS) -o $@ -c $< |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 77 | |
Jean-Christophe PLAGNIOL-VILLARD | 9c10001 | 2009-04-04 19:15:40 +0200 | [diff] [blame] | 78 | $(obj)crc32.o: $(SRCTREE)/lib_generic/crc32.c |
Mike Frysinger | 00d5bfd | 2009-07-19 15:17:03 -0400 | [diff] [blame] | 79 | $(HOSTCC) $(HOSTCFLAGS) -DUSE_HOSTCC -o $@ -c $< |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 80 | |
Wolfgang Denk | 18d46c0 | 2009-08-17 14:00:53 +0200 | [diff] [blame] | 81 | $(obj)u-boot.lds: $(LDSCRIPT) |
| 82 | $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ |
| 83 | |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 84 | clean: |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 85 | rm -f $(SOBJS) $(OBJS) $(obj)eeprom $(obj)eeprom.srec \ |
| 86 | $(obj)eeprom.bin $(obj)crcek $(obj)crcek.srec \ |
Wolfgang Denk | 18d46c0 | 2009-08-17 14:00:53 +0200 | [diff] [blame] | 87 | $(obj)crcek.bin $(obj)u-boot.lds |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 88 | |
| 89 | distclean: clean |
Wolfgang Denk | 6140a02 | 2008-07-02 23:49:18 +0200 | [diff] [blame] | 90 | rm -f $(LIB) core *.bak $(obj).depend |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 91 | |
| 92 | ######################################################################### |
| 93 | |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 94 | # defines $(obj).depend target |
| 95 | include $(SRCTREE)/rules.mk |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 96 | |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 97 | sinclude $(obj).depend |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 98 | |
| 99 | ######################################################################### |