You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile.target 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. # -*- Mode: makefile -*-
  2. BUILD_DIR?=$(CURDIR)/..
  3. include ../config-host.mak
  4. include config-target.mak
  5. include $(SRC_PATH)/rules.mak
  6. ifdef CONFIG_SOFTMMU
  7. include config-devices.mak
  8. endif
  9. $(call set-vpath, $(SRC_PATH):$(BUILD_DIR))
  10. ifdef CONFIG_LINUX
  11. QEMU_CFLAGS += -I../linux-headers
  12. endif
  13. QEMU_CFLAGS += -iquote .. -iquote $(SRC_PATH)/target/$(TARGET_BASE_ARCH) -DNEED_CPU_H
  14. QEMU_CFLAGS+=-iquote $(SRC_PATH)/include
  15. ifdef CONFIG_USER_ONLY
  16. # user emulator name
  17. QEMU_PROG=qemu-$(TARGET_NAME)
  18. QEMU_PROG_BUILD = $(QEMU_PROG)
  19. else
  20. # system emulator name
  21. QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF)
  22. ifneq (,$(findstring -mwindows,$(SDL_LIBS)))
  23. # Terminate program name with a 'w' because the linker builds a windows executable.
  24. QEMU_PROGW=qemu-system-$(TARGET_NAME)w$(EXESUF)
  25. $(QEMU_PROG): $(QEMU_PROGW)
  26. $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"GEN","$(TARGET_DIR)$(QEMU_PROG)")
  27. QEMU_PROG_BUILD = $(QEMU_PROGW)
  28. else
  29. QEMU_PROG_BUILD = $(QEMU_PROG)
  30. endif
  31. endif
  32. PROGS=$(QEMU_PROG) $(QEMU_PROGW)
  33. STPFILES=
  34. config-target.h: config-target.h-timestamp
  35. config-target.h-timestamp: config-target.mak
  36. config-devices.h: config-devices.h-timestamp
  37. config-devices.h-timestamp: config-devices.mak
  38. ifdef CONFIG_TRACE_SYSTEMTAP
  39. stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp $(QEMU_PROG)-log.stp
  40. ifdef CONFIG_USER_ONLY
  41. TARGET_TYPE=user
  42. else
  43. TARGET_TYPE=system
  44. endif
  45. tracetool-y = $(SRC_PATH)/scripts/tracetool.py
  46. tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
  47. $(QEMU_PROG).stp-installed: $(BUILD_DIR)/trace-events-all $(tracetool-y)
  48. $(call quiet-command,$(TRACETOOL) \
  49. --group=all \
  50. --format=stap \
  51. --backends=$(TRACE_BACKENDS) \
  52. --binary=$(bindir)/$(QEMU_PROG) \
  53. --target-name=$(TARGET_NAME) \
  54. --target-type=$(TARGET_TYPE) \
  55. $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp-installed")
  56. $(QEMU_PROG).stp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
  57. $(call quiet-command,$(TRACETOOL) \
  58. --group=all \
  59. --format=stap \
  60. --backends=$(TRACE_BACKENDS) \
  61. --binary=$(realpath .)/$(QEMU_PROG) \
  62. --target-name=$(TARGET_NAME) \
  63. --target-type=$(TARGET_TYPE) \
  64. $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp")
  65. $(QEMU_PROG)-simpletrace.stp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
  66. $(call quiet-command,$(TRACETOOL) \
  67. --group=all \
  68. --format=simpletrace-stap \
  69. --backends=$(TRACE_BACKENDS) \
  70. --probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
  71. $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp")
  72. $(QEMU_PROG)-log.stp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
  73. $(call quiet-command,$(TRACETOOL) \
  74. --group=all \
  75. --format=log-stap \
  76. --backends=$(TRACE_BACKENDS) \
  77. --probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
  78. $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-log.stp")
  79. else
  80. stap:
  81. endif
  82. .PHONY: stap
  83. all: $(PROGS) stap
  84. # Dummy command so that make thinks it has done something
  85. @true
  86. obj-y += trace/
  87. #########################################################
  88. # cpu emulator library
  89. obj-y += exec.o
  90. obj-y += accel/
  91. obj-$(CONFIG_TCG) += tcg/tcg.o tcg/tcg-op.o tcg/tcg-op-vec.o tcg/tcg-op-gvec.o
  92. obj-$(CONFIG_TCG) += tcg/tcg-common.o tcg/optimize.o
  93. obj-$(CONFIG_TCG_INTERPRETER) += tcg/tci.o
  94. obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
  95. obj-$(CONFIG_TCG) += fpu/softfloat.o
  96. obj-y += target/$(TARGET_BASE_ARCH)/
  97. obj-y += disas.o
  98. obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
  99. LIBS := $(libs_cpu) $(LIBS)
  100. #########################################################
  101. # Linux user emulator target
  102. ifdef CONFIG_LINUX_USER
  103. QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) \
  104. -I$(SRC_PATH)/linux-user/host/$(ARCH) \
  105. -I$(SRC_PATH)/linux-user
  106. obj-y += linux-user/
  107. obj-y += gdbstub.o thunk.o
  108. endif #CONFIG_LINUX_USER
  109. #########################################################
  110. # BSD user emulator target
  111. ifdef CONFIG_BSD_USER
  112. QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \
  113. -I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR)
  114. obj-y += bsd-user/
  115. obj-y += gdbstub.o
  116. endif #CONFIG_BSD_USER
  117. #########################################################
  118. # System emulator target
  119. ifdef CONFIG_SOFTMMU
  120. obj-y += arch_init.o cpus.o gdbstub.o balloon.o ioport.o
  121. obj-y += qtest.o
  122. obj-y += dump/
  123. obj-y += hw/
  124. obj-y += monitor/
  125. obj-y += qapi/
  126. obj-y += memory.o
  127. obj-y += memory_mapping.o
  128. obj-y += migration/ram.o
  129. LIBS := $(libs_softmmu) $(LIBS)
  130. # Hardware support
  131. ifeq ($(TARGET_NAME), sparc64)
  132. obj-y += hw/sparc64/
  133. else
  134. obj-y += hw/$(TARGET_BASE_ARCH)/
  135. endif
  136. generated-files-y += hmp-commands.h hmp-commands-info.h
  137. generated-files-y += config-devices.h
  138. endif # CONFIG_SOFTMMU
  139. dummy := $(call unnest-vars,,obj-y)
  140. all-obj-y := $(obj-y)
  141. include $(SRC_PATH)/Makefile.objs
  142. dummy := $(call unnest-vars,.., \
  143. authz-obj-y \
  144. block-obj-y \
  145. block-obj-m \
  146. chardev-obj-y \
  147. crypto-obj-y \
  148. crypto-user-obj-y \
  149. qom-obj-y \
  150. io-obj-y \
  151. common-obj-y \
  152. common-obj-m)
  153. all-obj-y += $(common-obj-y)
  154. all-obj-y += $(qom-obj-y)
  155. all-obj-$(CONFIG_SOFTMMU) += $(authz-obj-y)
  156. all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y) $(chardev-obj-y)
  157. all-obj-$(CONFIG_USER_ONLY) += $(crypto-user-obj-y)
  158. all-obj-$(CONFIG_SOFTMMU) += $(crypto-obj-y)
  159. all-obj-$(CONFIG_SOFTMMU) += $(io-obj-y)
  160. ifdef CONFIG_SOFTMMU
  161. $(QEMU_PROG_BUILD): config-devices.mak
  162. endif
  163. COMMON_LDADDS = ../libqemuutil.a
  164. # build either PROG or PROGW
  165. $(QEMU_PROG_BUILD): $(all-obj-y) $(COMMON_LDADDS)
  166. $(call LINK, $(filter-out %.mak, $^))
  167. ifdef CONFIG_DARWIN
  168. $(call quiet-command,Rez -append $(SRC_PATH)/pc-bios/qemu.rsrc -o $@,"REZ","$(TARGET_DIR)$@")
  169. $(call quiet-command,SetFile -a C $@,"SETFILE","$(TARGET_DIR)$@")
  170. endif
  171. gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
  172. $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"GEN","$(TARGET_DIR)$@")
  173. hmp-commands.h: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
  174. $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$(TARGET_DIR)$@")
  175. hmp-commands-info.h: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
  176. $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$(TARGET_DIR)$@")
  177. clean: clean-target
  178. rm -f *.a *~ $(PROGS)
  179. rm -f $(shell find . -name '*.[od]')
  180. rm -f hmp-commands.h gdbstub-xml.c
  181. rm -f trace/generated-helpers.c trace/generated-helpers.c-timestamp
  182. ifdef CONFIG_TRACE_SYSTEMTAP
  183. rm -f *.stp
  184. endif
  185. install: all
  186. ifneq ($(PROGS),)
  187. $(call install-prog,$(PROGS),$(DESTDIR)$(bindir))
  188. endif
  189. ifdef 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"
  192. $(INSTALL_DATA) $(QEMU_PROG)-simpletrace.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-simpletrace.stp"
  193. $(INSTALL_DATA) $(QEMU_PROG)-log.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-log.stp"
  194. endif
  195. generated-files-y += config-target.h
  196. Makefile: $(generated-files-y)
  197. # Reports/Analysis
  198. #
  199. # The target specific coverage report only cares about target specific
  200. # blobs and not the shared code.
  201. #
  202. %/coverage-report.html:
  203. @mkdir -p $*
  204. $(call quiet-command,\
  205. gcovr -r $(SRC_PATH) --object-directory $(CURDIR) \
  206. -p --html --html-details -o $@, \
  207. "GEN", "coverage-report.html")
  208. .PHONY: coverage-report
  209. coverage-report: $(CURDIR)/reports/coverage/coverage-report.html