From d13609d49d48c98bd2a8d99d9b21eb90ae43d465 Mon Sep 17 00:00:00 2001 From: Chen Huitao Date: Tue, 21 Apr 2020 20:12:57 +0800 Subject: [PATCH] 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. --- Makefile | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index c329c023..9268ac81 100644 --- a/Makefile +++ b/Makefile @@ -17,29 +17,6 @@ UNAME_S := $(shell uname -s) # If you want to use 16 job threads, use "-j16". 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 \ $$(grep '$(1)' $(2) | \ 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/qom/Makefile.objs, qemu/qom/) 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/) else 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 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),) PKG_VERSION = $(PKG_MAJOR).$(PKG_MINOR) else