ia64/xen-unstable

view stubdom/Makefile @ 17588:892ae66ed82f

minios: drop volatile qualifier from some status variables
since we already use memory barriers as approriate to prevent
concurrent access with event handlers.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue May 06 16:35:44 2008 +0100 (2008-05-06)
parents edfd0c343b13
children 460f72ca97b6
line source
1 XEN_ROOT = ..
3 export XEN_OS=MiniOS
5 include $(XEN_ROOT)/Config.mk
6 export stubdom=y
7 export debug=y
9 IOEMU_OPTIONS=--disable-vnc-tls
10 BINUTILS_VERSION=2.18
11 GCC_VERSION=4.2.2
12 ZLIB_VERSION=1.2.3
13 LIBPCI_VERSION=2.2.9
14 NEWLIB_DATE=2008-01-01
15 LWIP_DATE=2008-02-08
17 WGET=wget -c
19 GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH)
20 ifeq ($(XEN_TARGET_ARCH),x86_32)
21 GNU_TARGET_ARCH:=i686
22 endif
24 ifeq ($(GNU_TARGET_ARCH), i686)
25 TARGET_CFLAGS=
26 endif
27 ifeq ($(GNU_TARGET_ARCH), x86_64)
28 TARGET_CFLAGS=-mno-red-zone
29 endif
30 ifeq ($(GNU_TARGET_ARCH), ia64)
31 TARGET_CFLAGS=-mconstant-gp
32 endif
34 CROSS_ROOT=cross-root-$(GNU_TARGET_ARCH)
35 CROSS_PREFIX=$(CURDIR)/$(CROSS_ROOT)
36 export CROSS_COMPILE=$(GNU_TARGET_ARCH)-xen-elf-
37 export PATH:=$(CROSS_PREFIX)/bin:$(PATH)
39 .PHONY: all
40 all: qemu-stubdom
42 ################
43 # Cross-binutils
44 ################
46 binutils-$(BINUTILS_VERSION).tar.bz2:
47 $(WGET) http://ftp.gnu.org/gnu/binutils/$@
48 binutils-$(BINUTILS_VERSION): binutils-$(BINUTILS_VERSION).tar.bz2
49 tar xjf $@.tar.bz2
50 ( cd binutils-$(BINUTILS_VERSION) && patch -p1 < ../binutils.patch )
51 touch $@
53 BINUTILS_STAMPFILE=$(CROSS_ROOT)/bin/$(GNU_TARGET_ARCH)-xen-elf-ar
54 .PHONY: cross-binutils
55 cross-binutils: $(BINUTILS_STAMPFILE)
56 $(BINUTILS_STAMPFILE): binutils-$(BINUTILS_VERSION)
57 mkdir -p binutils-build
58 ( cd binutils-build && \
59 ../binutils-$(BINUTILS_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf && \
60 $(MAKE) && \
61 $(MAKE) check && \
62 $(MAKE) install )
64 ###########
65 # Cross-gcc
66 ###########
68 gcc-$(GCC_VERSION).tar.bz2:
69 $(WGET) http://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)/gcc-$(GCC_VERSION).tar.bz2
70 gcc-$(GCC_VERSION): gcc-$(GCC_VERSION).tar.bz2
71 tar xjf gcc-$(GCC_VERSION).tar.bz2
72 ( cd gcc-$(GCC_VERSION) && patch -p1 < ../gcc.patch )
73 touch $@
75 GCC_STAMPFILE=$(CROSS_ROOT)/bin/$(GNU_TARGET_ARCH)-xen-elf-gcc-$(GCC_VERSION)
76 .PHONY: cross-gcc
77 cross-gcc: $(GCC_STAMPFILE)
78 $(GCC_STAMPFILE): gcc-$(GCC_VERSION) $(BINUTILS_STAMPFILE)
79 mkdir -p gcc-build
80 ( cd gcc-build && \
81 ../gcc-$(GCC_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf --enable-languages=c --disable-libssp --with-gnu-as --with-gnu-ld && \
82 $(MAKE) GCC_FOR_TARGET='$$$$r/gcc/xgcc -B$$$$r/gcc/ '"$(TARGET_CFLAGS)"' $$(FLAGS_FOR_TARGET)' && \
83 $(MAKE) install )
85 ##############
86 # Cross-newlib
87 ##############
89 newlib-cvs:
90 cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/src co -D $(NEWLIB_DATE) newlib
91 mv src newlib-cvs
92 ( cd newlib-cvs && patch -p0 < ../newlib.patch)
94 NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a
95 .PHONY: cross-newlib
96 cross-newlib: $(NEWLIB_STAMPFILE)
97 $(NEWLIB_STAMPFILE): newlib-cvs $(GCC_STAMPFILE)
98 mkdir -p newlib-build
99 ( cd newlib-build && \
100 CC_FOR_TARGET="$(GNU_TARGET_ARCH)-xen-elf-gcc $(TARGET_CFLAGS)" ../newlib-cvs/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf --enable-newlib-io-long-long && \
101 $(MAKE) && \
102 $(MAKE) install )
104 ############
105 # Cross-zlib
106 ############
108 zlib-$(ZLIB_VERSION).tar.gz:
109 $(WGET) http://www.zlib.net/zlib-$(ZLIB_VERSION).tar.gz
111 ZLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libz.a
112 .PHONY: cross-zlib
113 cross-zlib: $(ZLIB_STAMPFILE)
114 $(ZLIB_STAMPFILE): zlib-$(ZLIB_VERSION).tar.gz $(NEWLIB_STAMPFILE)
115 tar xzf $<
116 ( cd zlib-$(ZLIB_VERSION) && \
117 CFLAGS="$(TARGET_CFLAGS)" CC=$(GNU_TARGET_ARCH)-xen-elf-gcc ./configure --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf && \
118 $(MAKE) libz.a && \
119 $(MAKE) install )
121 ##############
122 # Cross-libpci
123 ##############
125 pciutils-$(LIBPCI_VERSION).tar.bz2:
126 $(WGET) http://www.kernel.org/pub/software/utils/pciutils/pciutils-$(LIBPCI_VERSION).tar.bz2
128 LIBPCI_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libpci.a
129 .PHONY: cross-libpci
130 cross-libpci: $(LIBPCI_STAMPFILE)
131 $(LIBPCI_STAMPFILE): pciutils-$(LIBPCI_VERSION).tar.bz2 $(NEWLIB_STAMPFILE) $(ZLIB_STAMPFILE)
132 tar xjf $<
133 ( cd pciutils-$(LIBPCI_VERSION) && \
134 cp ../libpci.config.h lib/config.h && \
135 echo '#define PCILIB_VERSION "$(LIBPCI_VERSION)"' >> lib/config.h && \
136 cp ../libpci.config.mak lib/config.mk && \
137 $(MAKE) CC="$(GNU_TARGET_ARCH)-xen-elf-gcc $(TARGET_CFLAGS)" lib/libpci.a && \
138 $(INSTALL_DATA) lib/libpci.a $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/ && \
139 $(INSTALL_DIR) $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci && \
140 $(INSTALL_DATA) lib/{config,header,pci,types}.h $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci/ \
141 )
143 ######
144 # lwIP
145 ######
147 lwip-cvs:
148 cvs -z 9 -d :pserver:anonymous@cvs.savannah.nongnu.org:/sources/lwip co -D $(LWIP_DATE) lwip
149 mv lwip lwip-cvs
151 #######
152 # Links
153 #######
155 .PHONY: $(CROSS_ROOT)
156 $(CROSS_ROOT): cross-newlib cross-zlib cross-libpci
158 .PHONY: mk-symlinks
159 mk-symlinks:
160 [ -h include ] || ln -sf ../tools/include .
161 mkdir -p libxc
162 [ -h libxc/Makefile ] || ( cd libxc && \
163 ln -sf ../../tools/libxc/*.h . && \
164 ln -sf ../../tools/libxc/*.c . && \
165 ln -sf ../../tools/libxc/Makefile . )
166 mkdir -p libxc/$(XEN_TARGET_ARCH)
167 [ -h libxc/$(XEN_TARGET_ARCH) ] || ( cd libxc/$(XEN_TARGET_ARCH) && \
168 ln -sf ../../tools/libxc/$(XEN_TARGET_ARCH)/*.c . && \
169 ln -sf ../../tools/libxc/$(XEN_TARGET_ARCH)/*.h . && \
170 ln -sf ../../tools/libxc/$(XEN_TARGET_ARCH)/Makefile . )
171 mkdir -p ioemu
172 [ -h ioemu/Makefile ] || ( cd ioemu && \
173 ln -sf ../../tools/ioemu/* . && \
174 ([ ! -h config-host.h ] || rm -f config-host.h) && \
175 ([ ! -h config-host.mak ] || rm -f config-host.mak) )
176 [ -h mini-os ] || ln -sf ../extras/mini-os .
178 #######
179 # libxc
180 #######
182 .PHONY: libxc
183 libxc: cross-zlib mk-symlinks
184 $(MAKE) -C $@
186 #######
187 # ioemu
188 #######
190 .PHONY: ioemu
191 ioemu: cross-zlib cross-libpci mk-symlinks libxc
192 [ -f ioemu/config-host.mak ] || \
193 ( cd ioemu ; XEN_TARGET_ARCH=$(XEN_TARGET_ARCH) sh configure --prefix=/usr --enable-stubdom $(IOEMU_OPTIONS))
194 $(MAKE) -C ioemu LWIPDIR=$(CURDIR)/lwip-cvs
196 ######
197 # caml
198 ######
200 .PHONY: caml
201 caml:
202 $(MAKE) -C $@
204 ###
205 # C
206 ###
208 .PHONY: c
209 c:
210 $(MAKE) -C $@
212 ########
213 # minios
214 ########
216 .PHONY: qemu-stubdom
217 qemu-stubdom: mk-symlinks lwip-cvs libxc ioemu
218 $(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs QEMUDIR=$(CURDIR)/ioemu
220 .PHONY: caml-stubdom
221 caml-stubdom: mk-symlinks lwip-cvs libxc cross-libpci caml
222 $(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs CAMLDIR=$(CURDIR)/caml
224 .PHONY: c-stubdom
225 c-stubdom: mk-symlinks lwip-cvs libxc cross-libpci c
226 $(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs CDIR=$(CURDIR)/c
228 #########
229 # install
230 #########
232 install: mini-os/mini-os.gz
233 $(INSTALL_PROG) stubdom-dm "$(DESTDIR)/usr/lib/xen/bin"
234 $(INSTALL_PROG) mini-os/mini-os.gz "$(DESTDIR)/usr/lib/xen/boot/stubdom.gz"
236 #######
237 # clean
238 #######
240 # Only clean the libxc/ioemu/mini-os part
241 .PHONY: clean
242 clean:
243 -$(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs clean
244 $(MAKE) -C caml clean
245 rm -fr libxc ioemu mini-os include
247 # clean the cross-compilation result
248 .PHONY: crossclean
249 crossclean: clean
250 rm -fr $(CROSS_ROOT)
251 rm -fr binutils-build gcc-build newlib-build
252 rm -fr zlib-$(ZLIB_VERSION) pciutils-$(LIBPCI_VERSION)
254 # clean patched sources
255 .PHONY: patchclean
256 patchclean: crossclean
257 rm -fr binutils-$(BINUTILS_VERSION)
258 rm -fr gcc-$(GCC_VERSION)
259 rm -fr newlib-cvs
260 rm -fr lwip-cvs
262 # clean downloads
263 .PHONY: downloadclean
264 downloadclean: patchclean
265 rm -f binutils-$(BINUTILS_VERSION).tar.bz2
266 rm -f gcc-$(GCC_VERSION).tar.bz2
267 rm -f zlib-$(ZLIB_VERSION).tar.gz
268 rm -f pciutils-$(LIBPCI_VERSION).tar.bz2
270 .PHONY: distclean
271 distclean: downloadclean