blob: b9b9427376e9047c6e21b2933167e3a2fd943aba [file] [log] [blame]
Rusty Russell8ca47e02007-07-19 01:49:29 -07001# This creates the demonstration utility "lguest" which runs a Linux guest.
2
3# For those people that have a separate object dir, look there for .config
4KBUILD_OUTPUT := ../..
5ifdef O
6 ifeq ("$(origin O)", "command line")
7 KBUILD_OUTPUT := $(O)
8 endif
9endif
10# We rely on CONFIG_PAGE_OFFSET to know where to put lguest binary.
11include $(KBUILD_OUTPUT)/.config
12LGUEST_GUEST_TOP := ($(CONFIG_PAGE_OFFSET) - 0x08000000)
13
14CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 \
15 -static -DLGUEST_GUEST_TOP="$(LGUEST_GUEST_TOP)" -Wl,-T,lguest.lds
16LDLIBS:=-lz
17
18all: lguest.lds lguest
19
20# The linker script on x86 is so complex the only way of creating one
21# which will link our binary in the right place is to mangle the
22# default one.
23lguest.lds:
24 $(LD) --verbose | awk '/^==========/ { PRINT=1; next; } /SIZEOF_HEADERS/ { gsub(/0x[0-9A-F]*/, "$(LGUEST_GUEST_TOP)") } { if (PRINT) print $$0; }' > $@
25
26clean:
27 rm -f lguest.lds lguest