qemu/Makefile.target
<<
>>
Prefs
   1# -*- Mode: makefile -*-
   2
   3include ../config-host.mak
   4include config-target.mak
   5include config-devices.mak
   6include $(SRC_PATH)/rules.mak
   7
   8$(call set-vpath, $(SRC_PATH))
   9ifdef CONFIG_LINUX
  10QEMU_CFLAGS += -I../linux-headers
  11endif
  12QEMU_CFLAGS += -I.. -I$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -DNEED_CPU_H
  13
  14QEMU_CFLAGS+=-I$(SRC_PATH)/include
  15
  16ifdef CONFIG_USER_ONLY
  17# user emulator name
  18QEMU_PROG=qemu-$(TARGET_NAME)
  19QEMU_PROG_BUILD = $(QEMU_PROG)
  20else
  21# system emulator name
  22QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF)
  23ifneq (,$(findstring -mwindows,$(libs_softmmu)))
  24# Terminate program name with a 'w' because the linker builds a windows executable.
  25QEMU_PROGW=qemu-system-$(TARGET_NAME)w$(EXESUF)
  26$(QEMU_PROG): $(QEMU_PROGW)
  27        $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"  GEN   $(TARGET_DIR)$(QEMU_PROG)")
  28QEMU_PROG_BUILD = $(QEMU_PROGW)
  29else
  30QEMU_PROG_BUILD = $(QEMU_PROG)
  31endif
  32endif
  33
  34PROGS=$(QEMU_PROG) $(QEMU_PROGW)
  35STPFILES=
  36
  37config-target.h: config-target.h-timestamp
  38config-target.h-timestamp: config-target.mak
  39
  40ifdef CONFIG_TRACE_SYSTEMTAP
  41stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp
  42
  43ifdef CONFIG_USER_ONLY
  44TARGET_TYPE=user
  45else
  46TARGET_TYPE=system
  47endif
  48
  49$(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events
  50        $(call quiet-command,$(TRACETOOL) \
  51                --format=stap \
  52                --backends=$(TRACE_BACKENDS) \
  53                --binary=$(bindir)/$(QEMU_PROG) \
  54                --target-name=$(TARGET_NAME) \
  55                --target-type=$(TARGET_TYPE) \
  56                < $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp-installed")
  57
  58$(QEMU_PROG).stp: $(SRC_PATH)/trace-events
  59        $(call quiet-command,$(TRACETOOL) \
  60                --format=stap \
  61                --backends=$(TRACE_BACKENDS) \
  62                --binary=$(realpath .)/$(QEMU_PROG) \
  63                --target-name=$(TARGET_NAME) \
  64                --target-type=$(TARGET_TYPE) \
  65                < $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp")
  66
  67$(QEMU_PROG)-simpletrace.stp: $(SRC_PATH)/trace-events
  68        $(call quiet-command,$(TRACETOOL) \
  69                --format=simpletrace-stap \
  70                --backends=$(TRACE_BACKENDS) \
  71                --probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
  72                < $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp")
  73
  74else
  75stap:
  76endif
  77
  78all: $(PROGS) stap
  79
  80# Dummy command so that make thinks it has done something
  81        @true
  82
  83#########################################################
  84# cpu emulator library
  85obj-y = exec.o translate-all.o cpu-exec.o
  86obj-y += tcg/tcg.o tcg/tcg-op.o tcg/optimize.o
  87obj-$(CONFIG_TCG_INTERPRETER) += tci.o
  88obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
  89obj-y += fpu/softfloat.o
  90obj-y += target-$(TARGET_BASE_ARCH)/
  91obj-y += disas.o
  92obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
  93obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
  94
  95obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/decContext.o
  96obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/decNumber.o
  97obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/dpd/decimal32.o
  98obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/dpd/decimal64.o
  99obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/dpd/decimal128.o
 100
 101#########################################################
 102# Linux user emulator target
 103
 104ifdef CONFIG_LINUX_USER
 105
 106QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
 107
 108obj-y += linux-user/
 109obj-y += gdbstub.o thunk.o user-exec.o
 110
 111endif #CONFIG_LINUX_USER
 112
 113#########################################################
 114# BSD user emulator target
 115
 116ifdef CONFIG_BSD_USER
 117
 118QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \
 119                         -I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR)
 120
 121obj-y += bsd-user/
 122obj-y += gdbstub.o user-exec.o
 123
 124endif #CONFIG_BSD_USER
 125
 126#########################################################
 127# System emulator target
 128ifdef CONFIG_SOFTMMU
 129obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o numa.o
 130obj-y += qtest.o bootdevice.o
 131obj-y += hw/
 132obj-$(CONFIG_FDT) += device_tree.o
 133obj-$(CONFIG_KVM) += kvm-all.o
 134obj-y += memory.o savevm.o cputlb.o
 135obj-y += memory_mapping.o
 136obj-y += dump.o
 137LIBS+=$(libs_softmmu)
 138
 139# xen support
 140obj-$(CONFIG_XEN) += xen-common.o
 141obj-$(CONFIG_XEN_I386) += xen-hvm.o xen-mapcache.o
 142obj-$(call lnot,$(CONFIG_XEN)) += xen-common-stub.o
 143obj-$(call lnot,$(CONFIG_XEN_I386)) += xen-hvm-stub.o
 144
 145# Hardware support
 146ifeq ($(TARGET_NAME), sparc64)
 147obj-y += hw/sparc64/
 148else
 149obj-y += hw/$(TARGET_BASE_ARCH)/
 150endif
 151
 152GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
 153
 154endif # CONFIG_SOFTMMU
 155
 156# Workaround for http://gcc.gnu.org/PR55489, see configure.
 157%/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS)
 158
 159dummy := $(call unnest-vars,,obj-y)
 160all-obj-y := $(obj-y)
 161
 162target-obj-y :=
 163block-obj-y :=
 164common-obj-y :=
 165include $(SRC_PATH)/Makefile.objs
 166dummy := $(call unnest-vars,,target-obj-y)
 167target-obj-y-save := $(target-obj-y)
 168dummy := $(call unnest-vars,.., \
 169               block-obj-y \
 170               block-obj-m \
 171               common-obj-y \
 172               common-obj-m)
 173target-obj-y := $(target-obj-y-save)
 174all-obj-y += $(common-obj-y)
 175all-obj-y += $(target-obj-y)
 176all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
 177
 178$(QEMU_PROG_BUILD): config-devices.mak
 179
 180# build either PROG or PROGW
 181$(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
 182        $(call LINK, $(filter-out %.mak, $^))
 183
 184gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
 185        $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
 186
 187hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
 188        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 189
 190qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
 191        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 192
 193clean:
 194        rm -f *.a *~ $(PROGS)
 195        rm -f $(shell find . -name '*.[od]')
 196        rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
 197ifdef CONFIG_TRACE_SYSTEMTAP
 198        rm -f *.stp
 199endif
 200
 201install: all
 202ifneq ($(PROGS),)
 203        $(call install-prog,$(PROGS),$(DESTDIR)$(bindir))
 204endif
 205ifdef CONFIG_TRACE_SYSTEMTAP
 206        $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
 207        $(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp"
 208        $(INSTALL_DATA) $(QEMU_PROG)-simpletrace.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-simpletrace.stp"
 209endif
 210
 211GENERATED_HEADERS += config-target.h
 212Makefile: $(GENERATED_HEADERS)
 213