diff --git a/Makefile b/Makefile index 37585dfc2a..18ea3094fc 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,7 @@ CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM endif CFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch)) +LDFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch)) PREFIX ?= /usr DESTDIR ?= @@ -418,23 +419,9 @@ define create-archive endef -ifeq ($(LIBARCHS),) define create-library $(CC) $(LDFLAGS) $($(LIBNAME)_LDFLAGS) $(LIBOBJ) -o $(LIBRARY) endef -else -ifeq ($(call words,$(LIBARCHS)),1) -define create-library - $(CC) -arch $(LIBARCHS) $(LDFLAGS) $($(LIBNAME)_LDFLAGS) $(LIBOBJ) -o $(LIBRARY) -endef -else -define create-library - $(foreach arch,$(LIBARCHS),$(CC) -arch $(arch) $(LDFLAGS) $($(LIBNAME)_LDFLAGS) $(LIBOBJ) -o $(LIBRARY).$(arch);) - lipo -create $(foreach arch,$(LIBARCHS),$(LIBRARY).$(arch)) -output $(LIBRARY) - rm $(foreach arch,$(LIBARCHS),$(LIBRARY).$(arch)) -endef -endif -endif define generate-pkgcfg diff --git a/tests/Makefile b/tests/Makefile index 845a155e3c..6794eae2b0 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -26,9 +26,11 @@ endif CFLAGS += -O3 -Wall -I$(INCDIR) -CFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch)) LDFLAGS += -L$(LIBDIR) +CFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch)) +LDFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch)) + LIBNAME = capstone BIN_EXT = @@ -128,23 +130,9 @@ else endif -ifeq ($(LIBARCHS),) define link-dynamic $(CC) $(LDFLAGS) $< -l$(LIBNAME) -o $@ endef -else -ifeq ($(call words,$(LIBARCHS)),1) -define link-dynamic - $(CC) -arch $(LIBARCHS) $(LDFLAGS) $< -l$(LIBNAME) -o $@ -endef -else -define link-dynamic - $(foreach arch,$(LIBARCHS),$(CC) -arch $(arch) $(LDFLAGS) $< -l$(LIBNAME) -o $(@).$(arch);) - lipo -create $(foreach arch,$(LIBARCHS),$(@).$(arch)) -output $@ - rm $(foreach arch,$(LIBARCHS),$(@).$(arch)) -endef -endif -endif define link-static