debuggers.hg

annotate stubdom/Makefile @ 21887:8f5c50120366

stubdom: correct handling DESTDIR during build

The stubdom/Makefile expects components to install themselves to
stubdom/$(CROSS_ROOT) and passes the appropriate configure and make
variables to make this happen.

However if the top-level build uses DESTDIR then this not only effects
the installation targets in stubdom/Makefile but is also propagated to
the individual components' build causing them to install into an
unexpected location and breaking the build.

In other words "make -C stubdom DESTDIR=/tmp/a-dest-dir" fails due to missing
headers because they had been installed into /tmp/a-dest-dir instead of
stubdom/$(CROSS_ROOT).

The existing attempt to clear DESTDIR for the newlib install phase was
insufficient.

Define a CROSS_MAKE variable which should be used to recurse into the
cross compiled components and which clears DESTDIR.

Also move the definition of the genpath target to after the first
"all" target so that the default target is all.

I have confirmed that with this fix only the Xen build system outputs end up in
/tmp/a-dest-dir.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Ian Campbell <ian.campbell@citrix.com>
date Wed Jul 21 16:36:19 2010 +0100 (2010-07-21)
parents 0e0fa50e663b
children 2b768d52bc7f
rev   line source
keir@18447 1 XEN_ROOT = ..
keir@17905 2 MINI_OS = $(XEN_ROOT)/extras/mini-os
keir@17066 3
keir@17070 4 export XEN_OS=MiniOS
keir@17070 5
keir@17066 6 export stubdom=y
keir@17066 7 export debug=y
keir@18007 8 include $(XEN_ROOT)/Config.mk
keir@17066 9
keir@19007 10 #ZLIB_URL?=http://www.zlib.net
keir@19007 11 ZLIB_URL=$(XEN_EXTFILES_URL)
keir@17066 12 ZLIB_VERSION=1.2.3
keir@19007 13
keir@19007 14 #LIBPCI_URL?=http://www.kernel.org/pub/software/utils/pciutils
keir@19007 15 LIBPCI_URL?=$(XEN_EXTFILES_URL)
keir@17066 16 LIBPCI_VERSION=2.2.9
keir@19007 17
keir@19007 18 #NEWLIB_URL?=ftp://sources.redhat.com/pub/newlib
keir@19007 19 NEWLIB_URL?=$(XEN_EXTFILES_URL)
keir@18034 20 NEWLIB_VERSION=1.16.0
keir@19007 21
keir@19007 22 #LWIP_URL?=http://download.savannah.gnu.org/releases/lwip
keir@19007 23 LWIP_URL?=$(XEN_EXTFILES_URL)
keir@18114 24 LWIP_VERSION=1.3.0
keir@19007 25
keir@19007 26 #GRUB_URL?=http://alpha.gnu.org/gnu/grub
keir@19007 27 GRUB_URL?=$(XEN_EXTFILES_URL)
keir@18113 28 GRUB_VERSION=0.97
keir@17066 29
keir@19661 30 #OCAML_URL?=$(XEN_EXTFILES_URL)
keir@19661 31 OCAML_URL?=http://caml.inria.fr/pub/distrib/ocaml-3.11
keir@19661 32 OCAML_VERSION=3.11.0
keir@19661 33
keir@17066 34 WGET=wget -c
keir@17066 35
keir@17066 36 GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH)
keir@17066 37 ifeq ($(XEN_TARGET_ARCH),x86_32)
keir@17066 38 GNU_TARGET_ARCH:=i686
keir@17066 39 endif
keir@17066 40
keir@17066 41 ifeq ($(GNU_TARGET_ARCH), i686)
keir@17066 42 TARGET_CFLAGS=
keir@17830 43 NEWLIB_CFLAGS+=-D_I386MACH_ALLOW_HW_INTERRUPTS
keir@18034 44 STUBDOM_SUPPORTED=1
keir@17066 45 endif
keir@17066 46 ifeq ($(GNU_TARGET_ARCH), x86_64)
keir@17066 47 TARGET_CFLAGS=-mno-red-zone
keir@17830 48 NEWLIB_CFLAGS+=-D_I386MACH_ALLOW_HW_INTERRUPTS
keir@18034 49 STUBDOM_SUPPORTED=1
keir@17066 50 endif
keir@17066 51 ifeq ($(GNU_TARGET_ARCH), ia64)
keir@17066 52 TARGET_CFLAGS=-mconstant-gp
keir@17066 53 endif
keir@17066 54
keir@17066 55 CROSS_ROOT=cross-root-$(GNU_TARGET_ARCH)
keir@17066 56 CROSS_PREFIX=$(CURDIR)/$(CROSS_ROOT)
keir@18007 57
keir@18007 58 # Disable PIE/SSP if GCC supports them. They can break us.
keir@18007 59 TARGET_CFLAGS += $(CFLAGS)
keir@18007 60 TARGET_CPPFLAGS += $(CPPFLAGS)
keir@18007 61 TARGET_CFLAGS += $(call cc-option,$(CC),-nopie,)
keir@18007 62 TARGET_CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
keir@18007 63 TARGET_CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
keir@18007 64
keir@18007 65 # Do not use host headers and libs
keir@18430 66 GCC_INSTALL = $(shell LANG=C gcc -print-search-dirs | sed -n -e 's/install: \(.*\)/\1/p')
keir@18007 67 TARGET_CPPFLAGS += -U __linux__ -U __FreeBSD__ -U __sun__
keir@18055 68 TARGET_CPPFLAGS += -nostdinc
keir@18069 69 TARGET_CPPFLAGS += -isystem $(CURDIR)/$(MINI_OS)/include/posix
keir@18007 70 TARGET_CPPFLAGS += -isystem $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include
keir@18007 71 TARGET_CPPFLAGS += -isystem $(GCC_INSTALL)include
keir@18510 72 TARGET_CPPFLAGS += -isystem $(CURDIR)/lwip-$(XEN_TARGET_ARCH)/src/include
keir@18510 73 TARGET_CPPFLAGS += -isystem $(CURDIR)/lwip-$(XEN_TARGET_ARCH)/src/include/ipv4
keir@18044 74 TARGET_CPPFLAGS += -I$(CURDIR)/include
keir@20085 75 TARGET_CPPFLAGS += -I$(XEN_ROOT)/xen/include
keir@18007 76
keir@18007 77 TARGET_LDFLAGS += -nostdlib -L$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib
keir@17066 78
keir@17909 79 TARGETS=ioemu c caml grub
keir@17905 80
ian@21887 81 CROSS_MAKE := $(MAKE) DESTDIR=
keir@19856 82
keir@17066 83 .PHONY: all
keir@19972 84 all: build
keir@18034 85 ifeq ($(STUBDOM_SUPPORTED),1)
keir@19972 86 build: genpath ioemu-stubdom c-stubdom pv-grub
keir@18034 87 else
keir@19972 88 build: genpath
keir@18034 89 endif
keir@17066 90
ian@21887 91 STUBDOMPATH="stubdompath.sh"
ian@21887 92 genpath-target = $(call buildmakevars2file,$(STUBDOMPATH))
ian@21887 93 $(eval $(genpath-target))
ian@21887 94
keir@17066 95 ##############
keir@17066 96 # Cross-newlib
keir@17066 97 ##############
keir@17066 98
keir@18034 99 newlib-$(NEWLIB_VERSION).tar.gz:
keir@18281 100 $(WGET) $(NEWLIB_URL)/$@
keir@18034 101
keir@18034 102 newlib-$(NEWLIB_VERSION): newlib-$(NEWLIB_VERSION).tar.gz
keir@18034 103 tar xzf $<
keir@17905 104 patch -d $@ -p0 < newlib.patch
keir@19490 105 patch -d $@ -p0 < newlib-chk.patch
keir@20161 106 patch -d $@ -p1 < newlib-stdint-size_max-fix-from-1.17.0.patch
keir@21525 107 find $@ -type f | xargs perl -i.bak \
keir@21525 108 -pe 's/\b_(tzname|daylight|timezone)\b/$$1/g'
keir@18034 109 touch $@
keir@17066 110
keir@17066 111 NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a
keir@17066 112 .PHONY: cross-newlib
keir@17066 113 cross-newlib: $(NEWLIB_STAMPFILE)
keir@18368 114 $(NEWLIB_STAMPFILE): mk-headers-$(XEN_TARGET_ARCH) newlib-$(NEWLIB_VERSION)
keir@18368 115 mkdir -p newlib-$(XEN_TARGET_ARCH)
keir@18368 116 ( cd newlib-$(XEN_TARGET_ARCH) && \
keir@18034 117 CC_FOR_TARGET="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS)" AR_FOR_TARGET=$(AR) LD_FOR_TARGET=$(LD) RANLIB_FOR_TARGET=$(RANLIB) ../newlib-$(NEWLIB_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf --enable-newlib-io-long-long --disable-multilib && \
ian@21887 118 $(CROSS_MAKE) && \
ian@21887 119 $(CROSS_MAKE) install )
keir@17066 120
keir@17066 121 ############
keir@17066 122 # Cross-zlib
keir@17066 123 ############
keir@17066 124
keir@17066 125 zlib-$(ZLIB_VERSION).tar.gz:
keir@18281 126 $(WGET) $(ZLIB_URL)/$@
keir@17066 127
keir@18368 128 zlib-$(XEN_TARGET_ARCH): zlib-$(ZLIB_VERSION).tar.gz
keir@18368 129 tar xzf $<
keir@18368 130 mv zlib-$(ZLIB_VERSION) $@
keir@18368 131
keir@17066 132 ZLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libz.a
keir@17066 133 .PHONY: cross-zlib
keir@17066 134 cross-zlib: $(ZLIB_STAMPFILE)
keir@18368 135 $(ZLIB_STAMPFILE): zlib-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
keir@18368 136 ( cd $< && \
keir@18007 137 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" CC=$(CC) ./configure --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf && \
ian@21887 138 $(CROSS_MAKE) libz.a && \
ian@21887 139 $(CROSS_MAKE) install )
keir@17066 140
keir@17066 141 ##############
keir@17066 142 # Cross-libpci
keir@17066 143 ##############
keir@17066 144
keir@17066 145 pciutils-$(LIBPCI_VERSION).tar.bz2:
keir@18281 146 $(WGET) $(LIBPCI_URL)/$@
keir@17066 147
keir@18368 148 pciutils-$(XEN_TARGET_ARCH): pciutils-$(LIBPCI_VERSION).tar.bz2
keir@17984 149 tar xjf $<
keir@18368 150 mv pciutils-$(LIBPCI_VERSION) $@
keir@17984 151 patch -d $@ -p1 < pciutils.patch
keir@17984 152 touch $@
keir@17984 153
keir@17066 154 LIBPCI_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libpci.a
keir@17066 155 .PHONY: cross-libpci
keir@17066 156 cross-libpci: $(LIBPCI_STAMPFILE)
keir@18368 157 $(LIBPCI_STAMPFILE): pciutils-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE) $(ZLIB_STAMPFILE)
keir@18368 158 ( cd $< && \
keir@17066 159 cp ../libpci.config.h lib/config.h && \
keir@17066 160 echo '#define PCILIB_VERSION "$(LIBPCI_VERSION)"' >> lib/config.h && \
keir@17066 161 cp ../libpci.config.mak lib/config.mk && \
ian@21887 162 $(CROSS_MAKE) CC="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -I$(realpath $(MINI_OS)/include)" lib/libpci.a && \
keir@17066 163 $(INSTALL_DATA) lib/libpci.a $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/ && \
keir@17066 164 $(INSTALL_DIR) $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci && \
keir@18259 165 $(INSTALL_DATA) lib/config.h lib/header.h lib/pci.h lib/types.h $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci/ \
keir@17066 166 )
keir@17066 167
keir@17066 168 ######
keir@17066 169 # lwIP
keir@17066 170 ######
keir@17066 171
keir@18114 172 lwip-$(LWIP_VERSION).tar.gz:
keir@18281 173 $(WGET) $(LWIP_URL)/$@
keir@18114 174
keir@18368 175 lwip-$(XEN_TARGET_ARCH): lwip-$(LWIP_VERSION).tar.gz
keir@18114 176 tar xzf $<
keir@18368 177 mv lwip $@
keir@18114 178 patch -d $@ -p0 < lwip.patch-cvs
keir@18114 179 touch $@
keir@17066 180
keir@19661 181 #############
keir@19661 182 # Cross-ocaml
keir@19661 183 #############
keir@19661 184
keir@19661 185 CAMLLIB = $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/ocaml
keir@19661 186 OCAML_STAMPFILE=$(CAMLLIB)/.dirstamp
keir@19661 187
keir@19661 188 ocaml-$(OCAML_VERSION).tar.gz:
keir@19661 189 $(WGET) $(OCAML_URL)/$@
keir@19661 190
keir@19661 191 ocaml-$(XEN_TARGET_ARCH)/.dirstamp: ocaml-$(OCAML_VERSION).tar.gz ocaml.patch
keir@19661 192 tar xzf $<
keir@19661 193 cd ocaml-$(OCAML_VERSION) && patch -p0 < ../ocaml.patch
keir@19661 194 rm -rf ocaml-$(XEN_TARGET_ARCH)
keir@19661 195 mv ocaml-$(OCAML_VERSION) ocaml-$(XEN_TARGET_ARCH)
keir@19661 196 touch $@
keir@19661 197
keir@19661 198 MINIOS_HASNOT=IPV6 INET_ATON
keir@19661 199
keir@19661 200 .PHONY: cross-ocaml
keir@19661 201 cross-ocaml: $(OCAML_STAMPFILE)
keir@19661 202 $(OCAML_STAMPFILE): ocaml-$(XEN_TARGET_ARCH)/.dirstamp
keir@19661 203 cd ocaml-$(XEN_TARGET_ARCH) && ./configure -prefix $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf \
keir@19661 204 -no-pthread -no-shared-libs -no-tk -no-curses \
keir@19661 205 -cc "$(CC) -U_FORTIFY_SOURCE -fno-stack-protector"
keir@19661 206 $(foreach i,$(MINIOS_HASNOT),sed -i 's,^\(#define HAS_$(i)\),//\1,' ocaml-$(XEN_TARGET_ARCH)/config/s.h ; )
ian@21887 207 $(CROSS_MAKE) -C ocaml-$(XEN_TARGET_ARCH) world
ian@21887 208 $(CROSS_MAKE) -C ocaml-$(XEN_TARGET_ARCH) opt
keir@19661 209 $(MAKE) -C ocaml-$(XEN_TARGET_ARCH) install
keir@19661 210 touch $@
keir@19661 211
keir@17066 212 #######
keir@17066 213 # Links
keir@17066 214 #######
keir@17066 215
keir@17066 216 .PHONY: $(CROSS_ROOT)
keir@17066 217 $(CROSS_ROOT): cross-newlib cross-zlib cross-libpci
keir@17066 218
keir@18510 219 $(XEN_ROOT)/tools/ioemu-dir:
ian@21887 220 $(CROSS_MAKE) -C $(XEN_ROOT)/tools ioemu-dir-find
keir@18510 221
keir@18522 222 ioemu/linkfarm.stamp: $(XEN_ROOT)/tools/ioemu-dir
keir@18522 223 mkdir -p ioemu
keir@18522 224 set -e; \
keir@18522 225 $(absolutify_xen_root); \
keir@18522 226 cd ioemu; \
keir@18522 227 src="$$XEN_ROOT/tools/ioemu-dir"; export src; \
keir@18522 228 (cd $$src && find * -type d -print) | xargs mkdir -p; \
keir@18522 229 (cd $$src && find * ! -type l -type f $(addprefix ! -name , \
keir@18522 230 '*.[oda1]' 'config-*' config.mak qemu-dm qemu-img-xen \
keir@18522 231 '*.html' '*.pod' \
keir@18522 232 )) | \
keir@18522 233 while read f; do rm -f "$$f"; ln -s "$$src/$$f" "$$f"; done
keir@18522 234 touch ioemu/linkfarm.stamp
keir@18522 235
keir@18522 236 mk-headers-$(XEN_TARGET_ARCH): ioemu/linkfarm.stamp
keir@18044 237 mkdir -p include/xen && \
keir@18044 238 ln -sf $(addprefix ../../,$(wildcard $(XEN_ROOT)/xen/include/public/*.h)) include/xen && \
keir@18055 239 ln -sf $(addprefix ../../$(XEN_ROOT)/xen/include/public/,arch-ia64 arch-x86 hvm io xsm) include/xen && \
keir@18044 240 ( [ -h include/xen/sys ] || ln -sf ../../$(XEN_ROOT)/tools/include/xen-sys/MiniOS include/xen/sys ) && \
keir@19062 241 ( [ -h include/xen/libelf ] || ln -sf ../../$(XEN_ROOT)/tools/include/xen/libelf include/xen/libelf ) && \
keir@18044 242 mkdir -p include/xen-foreign && \
keir@18044 243 ln -sf $(addprefix ../../,$(wildcard $(XEN_ROOT)/tools/include/xen-foreign/*)) include/xen-foreign/ && \
ian@21887 244 $(CROSS_MAKE) -C include/xen-foreign/ && \
keir@18044 245 ( [ -h include/xen/foreign ] || ln -sf ../xen-foreign include/xen/foreign )
keir@18368 246 mkdir -p libxc-$(XEN_TARGET_ARCH)
keir@18368 247 [ -h libxc-$(XEN_TARGET_ARCH)/Makefile ] || ( cd libxc-$(XEN_TARGET_ARCH) && \
keir@17905 248 ln -sf ../$(XEN_ROOT)/tools/libxc/*.h . && \
keir@17905 249 ln -sf ../$(XEN_ROOT)/tools/libxc/*.c . && \
keir@17905 250 ln -sf ../$(XEN_ROOT)/tools/libxc/Makefile . )
keir@18368 251 mkdir -p libxc-$(XEN_TARGET_ARCH)/$(XEN_TARGET_ARCH)
keir@18368 252 [ -h libxc-$(XEN_TARGET_ARCH)/$(XEN_TARGET_ARCH) ] || ( cd libxc-$(XEN_TARGET_ARCH)/$(XEN_TARGET_ARCH) && \
keir@17905 253 ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.c . && \
keir@17905 254 ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.h . && \
keir@17905 255 ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/Makefile . )
ian@21887 256 $(CROSS_MAKE) -C $(MINI_OS) links
keir@18368 257 touch mk-headers-$(XEN_TARGET_ARCH)
keir@17905 258
keir@18368 259 TARGETS_MINIOS=$(addprefix mini-os-$(XEN_TARGET_ARCH)-,$(TARGETS))
keir@17905 260 $(TARGETS_MINIOS): mini-os-%:
keir@17905 261 [ -d $@ ] || \
keir@17905 262 for i in $$(cd $(MINI_OS) ; find . -type d) ; do \
keir@17905 263 mkdir -p $@/$$i ; \
keir@17905 264 done
keir@17066 265
keir@17066 266 #######
keir@17066 267 # libxc
keir@17066 268 #######
keir@17066 269
keir@17066 270 .PHONY: libxc
keir@18368 271 libxc: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a libxc-$(XEN_TARGET_ARCH)/libxenguest.a
keir@21049 272 libxc-$(XEN_TARGET_ARCH)/libxenctrl.a: cross-zlib
ian@21887 273 CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C libxc-$(XEN_TARGET_ARCH)
keir@17066 274
keir@21049 275 libxc-$(XEN_TARGET_ARCH)/libxenguest.a: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a
keir@21049 276
keir@17066 277 #######
keir@17066 278 # ioemu
keir@17066 279 #######
keir@17066 280
keir@17066 281 .PHONY: ioemu
keir@18126 282 ioemu: cross-zlib cross-libpci libxc
keir@18055 283 [ -f ioemu/config-host.mak ] || \
keir@18512 284 ( $(absolutify_xen_root); \
keir@19856 285 $(buildmakevars2shellvars); \
keir@18512 286 cd ioemu ; \
keir@19427 287 LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) \
keir@19427 288 TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)" \
keir@19427 289 TARGET_CFLAGS="$(TARGET_CFLAGS)" \
keir@19427 290 TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
keir@19427 291 ./xen-setup-stubdom )
ian@21887 292 $(CROSS_MAKE) -C ioemu
keir@17066 293
keir@17066 294 ######
keir@17066 295 # caml
keir@17066 296 ######
keir@17066 297
keir@17066 298 .PHONY: caml
keir@18127 299 caml: $(CROSS_ROOT)
ian@21887 300 CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) OCAMLC_CROSS_PREFIX=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/bin/
keir@17066 301
keir@17299 302 ###
keir@17299 303 # C
keir@17299 304 ###
keir@17299 305
keir@17299 306 .PHONY: c
keir@18127 307 c: $(CROSS_ROOT)
ian@21887 308 CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH)
keir@17299 309
keir@17909 310 ######
keir@17909 311 # Grub
keir@17909 312 ######
keir@17909 313
keir@18113 314 grub-$(GRUB_VERSION).tar.gz:
keir@18281 315 $(WGET) $(GRUB_URL)/$@
keir@18113 316
keir@18113 317 grub-upstream: grub-$(GRUB_VERSION).tar.gz
keir@18113 318 tar xzf $<
keir@18113 319 mv grub-$(GRUB_VERSION) $@
keir@17909 320 for i in grub.patches/* ; do \
keir@17909 321 patch -d $@ -p1 < $$i ; \
keir@17909 322 done
keir@17909 323
keir@17909 324 .PHONY: grub
keir@18127 325 grub: grub-upstream $(CROSS_ROOT)
keir@18368 326 mkdir -p grub-$(XEN_TARGET_ARCH)
ian@21887 327 CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ OBJ_DIR=$(CURDIR)/grub-$(XEN_TARGET_ARCH)
keir@17909 328
keir@17066 329 ########
keir@17066 330 # minios
keir@17066 331 ########
keir@17066 332
keir@17778 333 .PHONY: ioemu-stubdom
keir@18055 334 ioemu-stubdom: APP_OBJS=$(CURDIR)/ioemu/i386-stubdom/qemu.a $(CURDIR)/ioemu/i386-stubdom/libqemu.a $(CURDIR)/ioemu/libqemu_common.a
keir@18368 335 ioemu-stubdom: mini-os-$(XEN_TARGET_ARCH)-ioemu lwip-$(XEN_TARGET_ARCH) libxc ioemu
ian@21887 336 DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_QEMU $(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(APP_OBJS)"
keir@17066 337
keir@17066 338 .PHONY: caml-stubdom
keir@18368 339 caml-stubdom: mini-os-$(XEN_TARGET_ARCH)-caml lwip-$(XEN_TARGET_ARCH) libxc caml
ian@21887 340 DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_CAML $(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(CURDIR)/caml/main-caml.o $(CURDIR)/caml/caml.o $(CAMLLIB)/libasmrun.a"
keir@17299 341
keir@17299 342 .PHONY: c-stubdom
keir@18368 343 c-stubdom: mini-os-$(XEN_TARGET_ARCH)-c lwip-$(XEN_TARGET_ARCH) libxc c
ian@21887 344 DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_C $(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS=$(CURDIR)/c/main.a
keir@17909 345
keir@17909 346 .PHONY: pv-grub
keir@18368 347 pv-grub: mini-os-$(XEN_TARGET_ARCH)-grub libxc grub
ian@21887 348 DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_GRUB $(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
keir@17066 349
keir@17066 350 #########
keir@17066 351 # install
keir@17066 352 #########
keir@17066 353
keir@18034 354 ifeq ($(STUBDOM_SUPPORTED),1)
keir@19972 355 install: genpath install-readme install-ioemu install-grub
keir@18034 356 else
keir@19972 357 install: genpath
keir@18034 358 endif
keir@17909 359
keir@18282 360 install-readme:
keir@18282 361 $(INSTALL_DIR) $(DESTDIR)$(DOCDIR)
keir@18282 362 $(INSTALL_DATA) README $(DESTDIR)$(DOCDIR)/README.stubdom
keir@18282 363
keir@18034 364 install-ioemu: ioemu-stubdom
keir@19437 365 $(INSTALL_DIR) "$(DESTDIR)$(LIBEXEC)"
keir@19972 366 $(INSTALL_PROG) stubdompath.sh stubdom-dm "$(DESTDIR)$(LIBEXEC)"
keir@19878 367 $(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)"
keir@19878 368 $(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-ioemu/mini-os.gz "$(DESTDIR)$(XENFIRMWAREDIR)/ioemu-stubdom.gz"
keir@17909 369
keir@18034 370 install-grub: pv-grub
keir@19878 371 $(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)"
keir@19878 372 $(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-grub/mini-os.gz "$(DESTDIR)$(XENFIRMWAREDIR)/pv-grub-$(XEN_TARGET_ARCH).gz"
keir@17066 373
keir@17066 374 #######
keir@17066 375 # clean
keir@17066 376 #######
keir@17066 377
keir@17066 378 # Only clean the libxc/ioemu/mini-os part
keir@17066 379 .PHONY: clean
keir@17066 380 clean:
keir@18368 381 rm -fr mini-os-$(XEN_TARGET_ARCH)-ioemu
keir@18368 382 rm -fr mini-os-$(XEN_TARGET_ARCH)-c
keir@18368 383 rm -fr mini-os-$(XEN_TARGET_ARCH)-caml
keir@18368 384 rm -fr mini-os-$(XEN_TARGET_ARCH)-grub
ian@21887 385 $(CROSS_MAKE) -C caml clean
ian@21887 386 $(CROSS_MAKE) -C c clean
keir@18368 387 rm -fr grub-$(XEN_TARGET_ARCH)
keir@19856 388 rm -f $(STUBDOMPATH)
ian@21887 389 [ ! -d libxc-$(XEN_TARGET_ARCH) ] || $(CROSS_MAKE) -C libxc-$(XEN_TARGET_ARCH) clean
ian@21887 390 -[ ! -d ioemu ] || $(CROSS_MAKE) -C ioemu clean
keir@17066 391
keir@17066 392 # clean the cross-compilation result
keir@17066 393 .PHONY: crossclean
keir@17066 394 crossclean: clean
keir@17066 395 rm -fr $(CROSS_ROOT)
keir@18368 396 rm -fr newlib-$(XEN_TARGET_ARCH)
keir@18368 397 rm -fr zlib-$(XEN_TARGET_ARCH) pciutils-$(XEN_TARGET_ARCH)
keir@18368 398 rm -fr libxc-$(XEN_TARGET_ARCH) ioemu
keir@18368 399 rm -f mk-headers-$(XEN_TARGET_ARCH)
keir@19661 400 rm -fr ocaml-$(XEN_TARGET_ARCH)
keir@19979 401 rm -fr include
keir@17066 402
keir@17066 403 # clean patched sources
keir@17066 404 .PHONY: patchclean
keir@17066 405 patchclean: crossclean
keir@18034 406 rm -fr newlib-$(NEWLIB_VERSION)
keir@18368 407 rm -fr lwip-$(XEN_TARGET_ARCH)
keir@18113 408 rm -fr grub-upstream
keir@17066 409
keir@17066 410 # clean downloads
keir@17066 411 .PHONY: downloadclean
keir@17066 412 downloadclean: patchclean
keir@18055 413 rm -f newlib-$(NEWLIB_VERSION).tar.gz
keir@17066 414 rm -f zlib-$(ZLIB_VERSION).tar.gz
keir@17066 415 rm -f pciutils-$(LIBPCI_VERSION).tar.bz2
keir@18114 416 rm -f grub-$(GRUB_VERSION).tar.gz
keir@18114 417 rm -f lwip-$(LWIP_VERSION).tar.gz
keir@19661 418 rm -f ocaml-$(OCAML_VERSION).tar.gz
keir@17066 419
keir@17066 420 .PHONY: distclean
keir@17066 421 distclean: downloadclean