From: Viktor Szakats Date: Mon, 4 Jul 2022 10:26:30 +0000 (+0000) Subject: makefile.m32: add support for custom ARCH [ci skip] X-Git-Tag: curl-7_85_0~202 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8ef0f35a044e1f5b46978c9049df9bf9b1b9776c;p=thirdparty%2Fcurl.git makefile.m32: add support for custom ARCH [ci skip] When building curl for target platform other than x64 and x86, it is now possible to pass `ARCH=custom`, that will omit all hardcoded logic for setting up CFLAGS/LDFLAGS/RCFLAGS for these platforms, and let these be customized via `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, and a newly added one for the resource compiler: `CURL_RCFLAG_EXTRAS`. This makes it possible to use `makefile.m32` to build for ARM64 for example. Reviewed-by: Daniel Stenberg Closes #9092 --- diff --git a/docs/examples/Makefile.m32 b/docs/examples/Makefile.m32 index 4948253ab7..6ff03a6a1a 100644 --- a/docs/examples/Makefile.m32 +++ b/docs/examples/Makefile.m32 @@ -118,7 +118,7 @@ CC = $(CURL_CC) CFLAGS = -O3 $(CURL_CFLAG_EXTRAS) -W -Wall LDFLAGS = $(CURL_LDFLAG_EXTRAS) $(CURL_LDFLAG_EXTRAS_EXE) RC = $(CROSSPREFIX)windres -RCFLAGS = --include-dir=$(PROOT)/include -O coff +RCFLAGS = --include-dir=$(PROOT)/include -O coff $(CURL_RCFLAG_EXTRAS) # Set environment var ARCH to your architecture to override autodetection. ifndef ARCH @@ -129,6 +129,7 @@ ARCH = w32 endif endif +ifneq ($(ARCH),custom) ifeq ($(ARCH),w64) CFLAGS += -m64 LDFLAGS += -m64 @@ -138,6 +139,7 @@ CFLAGS += -m32 LDFLAGS += -m32 RCFLAGS += -F pe-i386 endif +endif # Platform-dependent helper tool macros ifeq ($(findstring /sh,$(SHELL)),/sh) diff --git a/lib/Makefile.m32 b/lib/Makefile.m32 index ec04cb0cec..3311a89eab 100644 --- a/lib/Makefile.m32 +++ b/lib/Makefile.m32 @@ -115,7 +115,7 @@ LDFLAGS = $(CURL_LDFLAG_EXTRAS) $(CURL_LDFLAG_EXTRAS_DLL) AR = $(CURL_AR) RANLIB = $(CURL_RANLIB) RC = $(CROSSPREFIX)windres -RCFLAGS = --include-dir=$(PROOT)/include -O coff +RCFLAGS = --include-dir=$(PROOT)/include -O coff $(CURL_RCFLAG_EXTRAS) STRIP = $(CROSSPREFIX)strip -g # Set environment var ARCH to your architecture to override autodetection. @@ -127,6 +127,7 @@ ARCH = w32 endif endif +ifneq ($(ARCH),custom) ifeq ($(ARCH),w64) CFLAGS += -m64 LDFLAGS += -m64 @@ -136,6 +137,7 @@ CFLAGS += -m32 LDFLAGS += -m32 RCFLAGS += -F pe-i386 endif +endif # Platform-dependent helper tool macros ifeq ($(findstring /sh,$(SHELL)),/sh) diff --git a/src/Makefile.m32 b/src/Makefile.m32 index c24e15a66d..8d57debec8 100644 --- a/src/Makefile.m32 +++ b/src/Makefile.m32 @@ -119,7 +119,7 @@ CFLAGS = -O3 $(CURL_CFLAG_EXTRAS) -W -Wall LDFLAGS = $(CURL_LDFLAG_EXTRAS) $(CURL_LDFLAG_EXTRAS_EXE) AR = $(CURL_AR) RC = $(CROSSPREFIX)windres -RCFLAGS = --include-dir=$(PROOT)/include -O coff -DCURL_EMBED_MANIFEST +RCFLAGS = --include-dir=$(PROOT)/include -O coff -DCURL_EMBED_MANIFEST $(CURL_RCFLAG_EXTRAS) STRIP = $(CROSSPREFIX)strip -g # We may need these someday @@ -135,6 +135,7 @@ ARCH = w32 endif endif +ifneq ($(ARCH),custom) ifeq ($(ARCH),w64) CFLAGS += -m64 LDFLAGS += -m64 @@ -144,6 +145,7 @@ CFLAGS += -m32 LDFLAGS += -m32 RCFLAGS += -F pe-i386 endif +endif # Platform-dependent helper tool macros ifeq ($(findstring /sh,$(SHELL)),/sh)