aboutsummaryrefslogtreecommitdiffstats
path: root/diag/mbr/Makefile
blob: 79ff9f01d900086a90f89369ed7932e584da38f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
## -----------------------------------------------------------------------
##
##   Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
##   Copyright 2009 Intel Corporation; author: H. Peter Anvin
##
##   This program is free software; you can redistribute it and/or modify
##   it under the terms of the GNU General Public License as published by
##   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
##   Boston MA 02111-1307, USA; either version 2 of the License, or
##   (at your option) any later version; incorporated herein by reference.
##
## -----------------------------------------------------------------------

#
# Makefile for MBR
#

topdir = ../..
mbrdir = $(topdir)/mbr
MAKEDIR = $(topdir)/mk
include $(MAKEDIR)/embedded.mk

all:	handoff.bin

%.o: %.S
	$(CC) $(MAKEDEPS) $(SFLAGS) -Wa,-a=$*.lst -c -o $@ $<

.PRECIOUS: %.elf
%.elf: %.o $(mbrdir)/mbr.ld
	$(LD) $(LDFLAGS) -T $(mbrdir)/mbr.ld -e _start -o $@ $<

%.bin: %.elf $(mbrdir)/checksize.pl
	$(OBJCOPY) -O binary $< $@
	$(PERL) checksize.pl $@
	$(CHMOD) -x $@

handoff.bin: handoff.elf $(mbrdir)/checksize.pl
	$(OBJCOPY) -O binary $< $@
	$(PERL) $(mbrdir)/checksize.pl $@ 420
	$(CHMOD) -x $@

mbr_bin.c: mbr.bin

tidy dist:
	rm -f *.o *.elf *.lst .*.d

clean: tidy

spotless: clean
	rm -f *.bin

-include .*.d