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)
  19else
  20# system emulator name
  21ifneq (,$(findstring -mwindows,$(libs_softmmu)))
  22# Terminate program name with a 'w' because the linker builds a windows executable.
  23QEMU_PROGW=qemu-system-$(TARGET_NAME)w$(EXESUF)
  24endif # windows executable
  25QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF)
  26endif
  27
  28PROGS=$(QEMU_PROG)
  29ifdef QEMU_PROGW
  30PROGS+=$(QEMU_PROGW)
  31endif
  32STPFILES=
  33
  34config-target.h: config-target.h-timestamp
  35config-target.h-timestamp: config-target.mak
  36
  37ifdef CONFIG_TRACE_SYSTEMTAP
  38stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp
  39
  40ifdef CONFIG_USER_ONLY
  41TARGET_TYPE=user
  42else
  43TARGET_TYPE=system
  44endif
  45
  46$(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events
  47        $(call quiet-command,$(TRACETOOL) \
  48                --format=stap \
  49                --backend=$(TRACE_BACKEND) \
  50                --binary=$(bindir)/$(QEMU_PROG) \
  51                --target-name=$(TARGET_NAME) \
  52                --target-type=$(TARGET_TYPE) \
  53                < $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp-installed")
  54
  55$(QEMU_PROG).stp: $(SRC_PATH)/trace-events
  56        $(call quiet-command,$(TRACETOOL) \
  57                --format=stap \
  58                --backend=$(TRACE_BACKEND) \
  59                --binary=$(realpath .)/$(QEMU_PROG) \
  60                --target-name=$(TARGET_NAME) \
  61                --target-type=$(TARGET_TYPE) \
  62                < $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp")
  63
  64else
  65stap:
  66endif
  67
  68all: $(PROGS) stap
  69
  70# Dummy command so that make thinks it has done something
  71        @true
  72
  73#########################################################
  74# cpu emulator library
  75obj-y = exec.o translate-all.o cpu-exec.o
  76obj-y += tcg/tcg.o tcg/optimize.o
  77obj-$(CONFIG_TCG_INTERPRETER) += tci.o
  78obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
  79obj-y += fpu/softfloat.o
  80obj-y += target-$(TARGET_BASE_ARCH)/
  81obj-y += disas.o
  82obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
  83obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
  84
  85#########################################################
  86# Linux user emulator target
  87
  88ifdef CONFIG_LINUX_USER
  89
  90QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
  91
  92obj-y += linux-user/
  93obj-y += gdbstub.o thunk.o user-exec.o
  94
  95endif #CONFIG_LINUX_USER
  96
  97#########################################################
  98# BSD user emulator target
  99
 100ifdef CONFIG_BSD_USER
 101
 102QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR)
 103
 104obj-y += bsd-user/
 105obj-y += gdbstub.o user-exec.o
 106
 107endif #CONFIG_BSD_USER
 108
 109#########################################################
 110# System emulator target
 111ifdef CONFIG_SOFTMMU
 112obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o
 113obj-y += qtest.o
 114obj-y += hw/
 115obj-$(CONFIG_FDT) += device_tree.o
 116obj-$(CONFIG_KVM) += kvm-all.o
 117obj-y += memory.o savevm.o cputlb.o
 118obj-y += memory_mapping.o
 119obj-y += dump.o
 120LIBS+=$(libs_softmmu)
 121
 122# xen support
 123obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o
 124obj-$(call lnot,$(CONFIG_XEN)) += xen-stub.o
 125
 126# Hardware support
 127ifeq ($(TARGET_NAME), sparc64)
 128obj-y += hw/sparc64/
 129else
 130obj-y += hw/$(TARGET_BASE_ARCH)/
 131endif
 132
 133main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
 134
 135GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
 136
 137endif # CONFIG_SOFTMMU
 138
 139# Workaround for http://gcc.gnu.org/PR55489, see configure.
 140%/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS)
 141
 142nested-vars += obj-y
 143
 144# This resolves all nested paths, so it must come last
 145include $(SRC_PATH)/Makefile.objs
 146
 147all-obj-y = $(obj-y)
 148all-obj-y += $(addprefix ../, $(common-obj-y))
 149
 150ifndef CONFIG_HAIKU
 151LIBS+=-lm
 152endif
 153
 154ifdef QEMU_PROGW
 155# The linker builds a windows executable. Make also a console executable.
 156$(QEMU_PROGW): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
 157        $(call LINK,$^)
 158$(QEMU_PROG): $(QEMU_PROGW)
 159        $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"  GEN   $(TARGET_DIR)$(QEMU_PROG)")
 160else
 161$(QEMU_PROG): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
 162        $(call LINK,$^)
 163endif
 164
 165gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
 166        $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
 167
 168hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
 169        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 170
 171qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
 172        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 173
 174clean:
 175        rm -f *.a *~ $(PROGS)
 176        rm -f $(shell find . -name '*.[od]')
 177        rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
 178ifdef CONFIG_TRACE_SYSTEMTAP
 179        rm -f *.stp
 180endif
 181
 182install: all
 183ifneq ($(PROGS),)
 184        $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
 185ifneq ($(STRIP),)
 186        $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
 187endif
 188endif
 189ifdef CONFIG_TRACE_SYSTEMTAP
 190        $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
 191        $(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp"
 192endif
 193
 194GENERATED_HEADERS += config-target.h
 195Makefile: $(GENERATED_HEADERS)
 196