1# 2# Makefile 3# 4# Leendert van Doorn, leendert@watson.ibm.com 5# Copyright (c) 2005, International Business Machines Corporation. 6# 7# This program is free software; you can redistribute it and/or modify it 8# under the terms and conditions of the GNU General Public License, 9# version 2, as published by the Free Software Foundation. 10# 11# This program is distributed in the hope it will be useful, but WITHOUT 12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14# more details. 15# 16# You should have received a copy of the GNU General Public License along with 17# this program; If not, see <http://www.gnu.org/licenses/>. 18# 19 20XEN_ROOT = $(CURDIR)/../../.. 21include $(XEN_ROOT)/tools/firmware/Rules.mk 22 23# SMBIOS spec requires format mm/dd/yyyy 24SMBIOS_REL_DATE ?= $(shell date +%m/%d/%Y) 25 26CFLAGS += $(CFLAGS_xeninclude) 27 28# We mustn't use tools-only public interfaces. 29CFLAGS += -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ 30 31OBJS = hvmloader.o mp_tables.o util.o smbios.o 32OBJS += smp.o cacheattr.o xenbus.o vnuma.o 33OBJS += e820.o pci.o pir.o ctype.o 34OBJS += hvm_param.o 35OBJS += ovmf.o seabios.o 36ifeq ($(debug),y) 37OBJS += tests.o 38endif 39 40CIRRUSVGA_DEBUG ?= n 41 42ROMBIOS_DIR := ../rombios 43 44ifeq ($(CONFIG_ROMBIOS),y) 45STDVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.bin 46ifeq ($(CIRRUSVGA_DEBUG),y) 47CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.debug.bin 48else 49CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin 50endif 51endif 52 53ROMS := 54 55ifeq ($(CONFIG_ROMBIOS),y) 56OBJS += optionroms.o 32bitbios_support.o rombios.o 57CFLAGS += -DENABLE_ROMBIOS 58ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest 59ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) 60endif 61 62.PHONY: all 63all: acpi subdirs-all 64 $(MAKE) hvmloader 65 66.PHONY: acpi 67acpi: 68 $(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) DSDT_FILES="$(DSDT_FILES)" 69 70rombios.o: roms.inc 71smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(SMBIOS_REL_DATE)\"" 72 73ACPI_PATH = ../../libacpi 74DSDT_FILES = dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c 75ACPI_OBJS = $(patsubst %.c,%.o,$(DSDT_FILES)) build.o static_tables.o 76$(ACPI_OBJS): CFLAGS += -I. -DLIBACPI_STDUTILS=\"$(CURDIR)/util.h\" 77CFLAGS += -I$(ACPI_PATH) 78vpath build.c $(ACPI_PATH) 79vpath static_tables.c $(ACPI_PATH) 80OBJS += $(ACPI_OBJS) 81 82hvmloader: $(OBJS) hvmloader.lds 83 $(LD) $(LDFLAGS_DIRECT) -N -T hvmloader.lds -o $@ $(OBJS) 84 85roms.inc: $(ROMS) 86 echo "/* Autogenerated file. DO NOT EDIT */" > $@.new 87 88ifneq ($(ROMBIOS_ROM),) 89 echo "#ifdef ROM_INCLUDE_ROMBIOS" >> $@.new 90 sh ../../misc/mkhex rombios $(ROMBIOS_ROM) >> $@.new 91 echo "#endif" >> $@.new 92endif 93 94ifneq ($(STDVGA_ROM),) 95 echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new 96 sh ../../misc/mkhex vgabios_stdvga $(STDVGA_ROM) >> $@.new 97 echo "#endif" >> $@.new 98endif 99ifneq ($(CIRRUSVGA_ROM),) 100 echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new 101 sh ../../misc/mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new 102 echo "#endif" >> $@.new 103endif 104 mv $@.new $@ 105 106.PHONY: clean 107clean: subdirs-clean 108 rm -f roms.inc roms.inc.new acpi.h 109 rm -f hvmloader hvmloader.tmp *.o $(DEPS_RM) 110 $(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) clean 111 112.PHONY: distclean 113distclean: clean 114 115-include $(DEPS_INCLUDE) 116