Fix 32-bit overflow in parallels image support
[qemu-kvm/fedora.git] / kvm / bios / Makefile
blob434d64e8bfcb83111d157254b754d4918d462440
1 # Copyright (C) 2001 MandrakeSoft S.A.
3 # MandrakeSoft S.A.
4 # 43, rue d'Aboukir
5 # 75002 Paris - France
6 # http://www.linux-mandrake.com/
7 # http://www.mandrakesoft.com/
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2 of the License, or (at your option) any later version.
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with this library; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 # Makefile for the BIOS component of bochs
26 .SUFFIXES: .cc
28 srcdir = .
31 SHELL = /bin/sh
33 CXX = g++
34 CXXFLAGS = -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
36 # cc-option, copied from user/Makefile
37 # Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
39 cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \
40 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
42 CFLAGS = -m32
43 CFLAGS += $(call cc-option, -fno-stack-protector, "")
44 CFLAGS += $(call cc-option, -fno-stack-protector-all, "")
46 LDFLAGS =
47 LIBS = -lm
48 RANLIB = ranlib
50 BCC = bcc
51 GCC = gcc $(CFLAGS)
52 HOST_CC = gcc
53 AS86 = as86
55 BX_INCDIRS = -I.. -I$(srcdir)/.. -I../iodev -I$(srcdir)/../iodev
56 LOCAL_CXXFLAGS =
58 BUILDDATE = `date '+%m/%d/%y'`
59 BIOS_BUILD_DATE = "-DBIOS_BUILD_DATE=\"$(BUILDDATE)\""
61 # -------- end configurable options --------------------------
65 .cc.o:
66 $(CXX) -c $(BX_INCDIRS) $(CXXFLAGS) $(LOCAL_CXXFLAGS) $< -o $@
69 bios: biossums BIOS-bochs-latest BIOS-bochs-legacy
71 clean:
72 rm -f *.o *.a *.s _rombios*_.c rombios*.txt rombios*.sym
73 rm -f usage biossums rombios16.bin
74 rm -f rombios32.bin rombios32.out acpi-dsdt.hex acpi-ssdt.hex
76 dist-clean: clean
77 rm -f Makefile
79 bios-clean:
80 rm -f BIOS-bochs-*
82 BIOS-bochs-legacy: rombios.c apmbios.S biossums rombios.h
83 $(GCC) $(BIOS_BUILD_DATE) -DLEGACY -E -P $< > _rombiosl_.c
84 $(BCC) -o rombiosl.s -C-c -D__i86__ -0 -S _rombiosl_.c
85 sed -e 's/^\.text//' -e 's/^\.data//' rombiosl.s > _rombiosl_.s
86 $(AS86) _rombiosl_.s -b tmpl.bin -u- -w- -g -0 -j -O -l rombiosl.txt
87 -perl ${srcdir}/makesym.perl < rombiosl.txt > rombiosl.sym
88 mv tmpl.bin $@
89 ./biossums $@
90 rm -f _rombiosl_.s
93 rombios16.bin: rombios.c apmbios.S biossums rombios.h
94 $(GCC) $(BIOS_BUILD_DATE) -E -P $< > _rombios_.c
95 $(BCC) -o rombios.s -C-c -D__i86__ -0 -S _rombios_.c
96 sed -e 's/^\.text//' -e 's/^\.data//' rombios.s > _rombios_.s
97 $(AS86) _rombios_.s -b tmp.bin -u- -w- -g -0 -j -O -l rombios.txt
98 -perl ${srcdir}/makesym.perl < rombios.txt > rombios.sym
99 mv tmp.bin rombios16.bin
100 ./biossums rombios16.bin
101 rm -f _rombios_.s
104 rombios32.bin: rombios32.out rombios.h
105 objcopy -O binary $< $@
106 ./biossums -pad $@
108 rombios32.out: rombios32start.o rombios32.o vapic.o rombios32.ld
109 ld -o $@ -T rombios32.ld rombios32start.o vapic.o rombios32.o
111 rombios32.o: rombios32.c acpi-dsdt.hex acpi-ssdt.hex
112 $(GCC) -m32 -O2 -Wall -c -o $@ $<
114 acpi-dsdt.hex: acpi-dsdt.dsl
115 cpp -P $< $<.i
116 iasl -tc -p $@ $<.i
117 sed -i -e's/^unsigned char AmlCode/const unsigned char DSDTCode/' $@
118 rm $<.i
120 acpi-ssdt.hex: acpi-ssdt.dsl
121 cpp -P $< $<.i
122 iasl -tc -p $@ $<.i
123 sed -i -e's/^unsigned char AmlCode/const unsigned char SSDTCode/' $@
124 rm $<.i
126 rombios32start.o: rombios32start.S
127 $(GCC) -m32 -c -o $@ $<
129 vapic.o: vapic.S
130 $(GCC) -m32 -c -o $@ $<
132 BIOS-bochs-latest: rombios16.bin rombios32.bin
133 cat rombios32.bin rombios16.bin > $@
135 biossums: biossums.c
136 $(HOST_CC) -o biossums biossums.c