1## -----------------------------------------------------------------------
2##
3##   Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
4##   Copyright 2009 Intel Corporation; author: H. Peter Anvin
5##
6##   This program is free software; you can redistribute it and/or modify
7##   it under the terms of the GNU General Public License as published by
8##   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9##   Boston MA 02111-1307, USA; either version 2 of the License, or
10##   (at your option) any later version; incorporated herein by reference.
11##
12## -----------------------------------------------------------------------
13
14#
15# Makefile for MBR
16#
17
18mbrdir = $(topdir)/mbr
19include $(MAKEDIR)/embedded.mk
20VPATH = $(SRC)
21
22all:	handoff.bin
23
24%.o: %.S
25	$(CC) $(MAKEDEPS) $(SFLAGS) -Wa,-a=$*.lst -c -o $@ $<
26
27.PRECIOUS: %.elf
28%.elf: %.o $(mbrdir)/mbr.ld
29	$(LD) $(LDFLAGS) -T $(mbrdir)/$(ARCH)/mbr.ld -e _start -o $@ $<
30
31%.bin: %.elf $(mbrdir)/checksize.pl
32	$(OBJCOPY) -O binary $< $@
33	$(PERL) checksize.pl $@
34	$(CHMOD) -x $@
35
36handoff.bin: handoff.elf $(mbrdir)/checksize.pl
37	$(OBJCOPY) -O binary $< $@
38	$(PERL) $(mbrdir)/checksize.pl $@ 420
39	$(CHMOD) -x $@
40
41mbr_bin.c: mbr.bin
42
43tidy dist:
44	rm -f *.o *.elf *.lst .*.d
45
46clean: tidy
47
48spotless: clean
49	rm -f *.bin
50
51-include .*.d
52