fix mingw gcc error (#1238)

* fix finding python path which only has python3.

* read deps from files of qemu, fixed library deps.

* cleanup code of get objs, restore old qemu/Makefile.

* update some target name, remove dup empty line.

* update .PHONY targets.

* compatible with mingw-gcc compler.

* move part of CC to head.

* restore part of CC. use uname -s to detect mingw.
This commit is contained in:
Chen Huitao 2020-04-21 20:12:57 +08:00 committed by GitHub
parent b0fb37921b
commit d13609d49d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 24 deletions

View File

@ -17,29 +17,6 @@ UNAME_S := $(shell uname -s)
# If you want to use 16 job threads, use "-j16". # If you want to use 16 job threads, use "-j16".
SMP_MFLAGS := -j4 SMP_MFLAGS := -j4
ifeq ($(UNICORN_ASAN),yes)
CC = clang -fsanitize=address -fno-omit-frame-pointer
CXX = clang++ -fsanitize=address -fno-omit-frame-pointer
AR = llvm-ar
LDFLAGS := -fsanitize=address ${LDFLAGS}
endif
ifeq ($(CROSS),)
CC ?= cc
AR ?= ar
RANLIB ?= ranlib
STRIP ?= strip
else
CC = $(CROSS)-gcc
AR = $(CROSS)-ar
RANLIB = $(CROSS)-ranlib
STRIP = $(CROSS)-strip
endif
IS_WIN32 = $(shell $(CC) -dM -E - < /dev/null | grep '_WIN32'; \
if [ $$? = 0 ]; then echo yes; \
else echo no; fi)
UC_GET_OBJ = $(shell for i in \ UC_GET_OBJ = $(shell for i in \
$$(grep '$(1)' $(2) | \ $$(grep '$(1)' $(2) | \
grep '\.o' | cut -d '=' -f 2); do \ grep '\.o' | cut -d '=' -f 2); do \
@ -54,7 +31,7 @@ UC_TARGET_OBJ += $(call UC_GET_OBJ,obj-,qemu/qapi/Makefile.objs, qemu/qapi/)
UC_TARGET_OBJ += $(call UC_GET_OBJ,obj-,qemu/qobject/Makefile.objs, qemu/qobject/) UC_TARGET_OBJ += $(call UC_GET_OBJ,obj-,qemu/qobject/Makefile.objs, qemu/qobject/)
UC_TARGET_OBJ += $(call UC_GET_OBJ,obj-,qemu/qom/Makefile.objs, qemu/qom/) UC_TARGET_OBJ += $(call UC_GET_OBJ,obj-,qemu/qom/Makefile.objs, qemu/qom/)
UC_TARGET_OBJ += $(call UC_GET_OBJ,obj-y,qemu/util/Makefile.objs, qemu/util/) UC_TARGET_OBJ += $(call UC_GET_OBJ,obj-y,qemu/util/Makefile.objs, qemu/util/)
ifeq ($(IS_WIN32),yes) ifneq ($(filter MINGW%,$(UNAME_S)),)
UC_TARGET_OBJ += $(call UC_GET_OBJ,obj-$$(CONFIG_WIN32),qemu/util/Makefile.objs, qemu/util/) UC_TARGET_OBJ += $(call UC_GET_OBJ,obj-$$(CONFIG_WIN32),qemu/util/Makefile.objs, qemu/util/)
else else
UC_TARGET_OBJ += $(call UC_GET_OBJ,obj-$$(CONFIG_POSIX),qemu/util/Makefile.objs, qemu/util/) UC_TARGET_OBJ += $(call UC_GET_OBJ,obj-$$(CONFIG_POSIX),qemu/util/Makefile.objs, qemu/util/)
@ -169,6 +146,25 @@ CFLAGS += -O3
UNICORN_QEMU_FLAGS += --disable-debug-info UNICORN_QEMU_FLAGS += --disable-debug-info
endif endif
ifeq ($(UNICORN_ASAN),yes)
CC = clang -fsanitize=address -fno-omit-frame-pointer
CXX = clang++ -fsanitize=address -fno-omit-frame-pointer
AR = llvm-ar
LDFLAGS := -fsanitize=address ${LDFLAGS}
endif
ifeq ($(CROSS),)
CC ?= cc
AR ?= ar
RANLIB ?= ranlib
STRIP ?= strip
else
CC = $(CROSS)-gcc
AR = $(CROSS)-ar
RANLIB = $(CROSS)-ranlib
STRIP = $(CROSS)-strip
endif
ifeq ($(PKG_EXTRA),) ifeq ($(PKG_EXTRA),)
PKG_VERSION = $(PKG_MAJOR).$(PKG_MINOR) PKG_VERSION = $(PKG_MAJOR).$(PKG_MINOR)
else else