aboutsummaryrefslogtreecommitdiffstats
path: root/tools/misc/mbootpack/Makefile
blob: 18116688f3219439254361e78332de81bb507473 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#
#  Makefile for mbootpack
#
INSTALL		= install
INSTALL_PROG	= $(INSTALL) -m0755
INSTALL_DIR	= $(INSTALL) -d -m0755

XEN_ROOT=../../..
include $(XEN_ROOT)/tools/Rules.mk

.PHONY: all
all: build

.PHONY: build
build: mbootpack

.PHONY: install
install: build
	$(INSTALL_PROG) mbootpack $(DESTDIR)/usr/bin

#  Tools etc.
RM 	:= rm -f
GDB	:= gdb
INCS	:= -I. -I-
DEFS	:= 
LDFLAGS	:= 
CFLAGS	+= -Wpointer-arith -Wcast-qual -Wno-unused -Wno-format
CFLAGS	+= -Wmissing-prototypes -pipe

#  What object files need building for the program
OBJS	:= mbootpack.o buildimage.o

# Get gcc to generate the dependencies for us.
DEPFLAGS = -Wp,-MD,.$(@F).d
DEPS     = .*.d

mbootpack: $(OBJS)
	$(HOSTCC) -o $@ $(filter-out %.a, $^)

.PHONY: clean
clean:
	$(RM) mbootpack *.o $(DEPS) bootsect setup bzimage_header.c bin2c

bootsect: bootsect.S
	$(CC) $(CFLAGS) $(INCS) $(DEFS) -D__MB_ASM -c bootsect.S -o bootsect.o
	$(LD) -m elf_i386 -Ttext 0x0 -s --oformat binary bootsect.o -o $@

setup: setup.S
	$(CC) $(CFLAGS) $(INCS) $(DEFS) -D__MB_ASM -c setup.S -o setup.o
	$(LD) -m elf_i386 -Ttext 0x0 -s --oformat binary setup.o -o $@

bin2c: bin2c.o 
	$(HOSTCC) -o $@ $^ 

bzimage_header.c: bootsect setup bin2c
	./bin2c -n 8 -b1 -a bzimage_bootsect bootsect > bzimage_header.c
	./bin2c -n 8 -b1 -a bzimage_setup setup >> bzimage_header.c

buildimage.c: bzimage_header.c
	@

%.o: %.S
	$(HOSTCC) $(DEPFLAGS) $(CFLAGS) $(INCS) $(DEFS) -c $< -o $@

%.o: %.c
	$(HOSTCC) $(DEPFLAGS) $(CFLAGS) $(INCS) $(DEFS) -c $< -o $@

.PRECIOUS: $(OBJS) $(OBJS:.o=.c) $(DEPS)
.SUFFIXES: 

-include $(DEPS)

#
#  EOF
#