Makefile.mk: drop Windows support

And DLL-support with it. This leaves `Makefile.mk` for MS-DOS and Amiga.

We recommend CMake instead. With unity mode it's much faster, and about
the same without.

Ref: https://github.com/curl/curl/pull/12221#issuecomment-1783761806
Reviewed-by: Daniel Stenberg
Closes #12224
This commit is contained in:
Viktor Szakats 2023-10-28 09:48:19 +00:00
parent 67211e9540
commit ba8752e556
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
6 changed files with 52 additions and 260 deletions

1
.github/labeler.yml vendored
View File

@ -481,7 +481,6 @@ Windows:
- all: - all:
- changed-files: - changed-files:
- any-glob-to-all-files: - any-glob-to-all-files:
- '**/Makefile.mk'
- 'appveyor.yml' - 'appveyor.yml'
- 'CMake/Platforms/WindowsCache.cmake' - 'CMake/Platforms/WindowsCache.cmake'
- 'lib/*win32*' - 'lib/*win32*'

View File

@ -30,27 +30,6 @@ ssl:
./configure --with-openssl ./configure --with-openssl
make make
mingw32:
$(MAKE) -C lib -f Makefile.mk
$(MAKE) -C src -f Makefile.mk
mingw32-clean:
$(MAKE) -C lib -f Makefile.mk clean
$(MAKE) -C src -f Makefile.mk clean
$(MAKE) -C docs/examples -f Makefile.mk clean
mingw32-vclean mingw32-distclean:
$(MAKE) -C lib -f Makefile.mk vclean
$(MAKE) -C src -f Makefile.mk vclean
$(MAKE) -C docs/examples -f Makefile.mk vclean
mingw32-examples%:
$(MAKE) -C docs/examples -f Makefile.mk CFG=$@
mingw32%:
$(MAKE) -C lib -f Makefile.mk CFG=$@
$(MAKE) -C src -f Makefile.mk CFG=$@
vc: vc:
cd winbuild cd winbuild
nmake /f Makefile.vc MACHINE=x86 nmake /f Makefile.vc MACHINE=x86

View File

@ -185,54 +185,6 @@ multi-threaded dynamic C runtime.
If you get linkage errors read section 5.7 of the FAQ document. If you get linkage errors read section 5.7 of the FAQ document.
## mingw-w64
Make sure that mingw-w64's bin directory is in the search path, for example:
```cmd
set PATH=c:\mingw-w64\bin;%PATH%
```
then run `mingw32-make mingw32` in the root dir. There are other
make targets available to build libcurl with more features, use:
- `mingw32-make mingw32-zlib` to build with Zlib support;
- `mingw32-make mingw32-ssl-zlib` to build with SSL and Zlib enabled;
- `mingw32-make mingw32-ssh2-ssl-zlib` to build with SSH2, SSL, Zlib;
- `mingw32-make mingw32-ssh2-ssl-sspi-zlib` to build with SSH2, SSL, Zlib
and SSPI support.
If you have any problems linking libraries or finding header files, be sure
to verify that the provided `Makefile.mk` files use the proper paths, and
adjust as necessary. It is also possible to override these paths with
environment variables, for example:
```cmd
set ZLIB_PATH=c:\zlib-1.2.12
set OPENSSL_PATH=c:\openssl-3.0.5
set LIBSSH2_PATH=c:\libssh2-1.10.0
```
It is also possible to build with other LDAP installations than MS LDAP;
currently it is possible to build with native Win32 OpenLDAP, or with the
*Novell CLDAP* SDK. If you want to use these you need to set these vars:
```cmd
set CPPFLAGS=-Ic:/openldap/include -DCURL_HAS_OPENLDAP_LDAPSDK
set LDFLAGS=-Lc:/openldap/lib
set LIBS=-lldap -llber
```
or for using the Novell SDK:
```cmd
set CPPFLAGS=-Ic:/openldapsdk/inc -DCURL_HAS_NOVELL_LDAPSDK
set LDFLAGS=-Lc:/openldapsdk/lib/mscvc
set LIBS=-lldapsdk -lldapssl -lldapx
```
If you want to enable LDAPS support then append `-ldaps` to the make target.
## Cygwin ## Cygwin
Almost identical to the Unix installation. Run the configure script in the Almost identical to the Unix installation. Run the configure script in the

View File

@ -26,10 +26,6 @@
PROOT := ../.. PROOT := ../..
ifeq ($(findstring -static,$(CFG)),)
DYN := 1
endif
### Common ### Common
include $(PROOT)/lib/Makefile.mk include $(PROOT)/lib/Makefile.mk
@ -40,35 +36,17 @@ CPPFLAGS += -DCURL_NO_OLDIES
LDFLAGS += -L$(PROOT)/lib LDFLAGS += -L$(PROOT)/lib
LIBS := -lcurl $(LIBS) LIBS := -lcurl $(LIBS)
ifdef DYN
curl_DEPENDENCIES += $(PROOT)/lib/libcurl.dll.a
else
curl_DEPENDENCIES := $(PROOT)/lib/libcurl.a
ifdef WIN32
CPPFLAGS += -DCURL_STATICLIB
LDFLAGS += -static
endif
endif
ifdef WIN32
LIBS += -lws2_32
endif
### Sources and targets ### Sources and targets
# Provides check_PROGRAMS # Provides check_PROGRAMS
include Makefile.inc include Makefile.inc
ifdef WIN32
check_PROGRAMS += synctime
endif
TARGETS := $(patsubst %,%$(BIN_EXT),$(strip $(check_PROGRAMS))) TARGETS := $(patsubst %,%$(BIN_EXT),$(strip $(check_PROGRAMS)))
TOCLEAN := $(TARGETS) TOCLEAN := $(TARGETS)
### Rules ### Rules
%$(BIN_EXT): %.c $(curl_DEPENDENCIES) %$(BIN_EXT): %.c $(PROOT)/lib/libcurl.a
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(CURL_LDFLAGS_BIN) $< -o $@ $(LIBS) $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< -o $@ $(LIBS)
all: $(TARGETS) all: $(TARGETS)

View File

@ -24,8 +24,8 @@
# Makefile to build curl parts with GCC-like toolchains and optional features. # Makefile to build curl parts with GCC-like toolchains and optional features.
# #
# Usage: [mingw32-]make -f Makefile.mk CFG=-feat1[-feat2][-feat3][...] # Usage: make -f Makefile.mk CFG=-feat1[-feat2][-feat3][...]
# Example: [mingw32-]make -f Makefile.mk CFG=-zlib-ssl-libssh2-ipv6 # Example: make -f Makefile.mk CFG=-zlib-ssl-libssh2-ipv6
# #
# Look for ' ?=' to find all accepted customization variables. # Look for ' ?=' to find all accepted customization variables.
@ -40,10 +40,7 @@ endif
CFLAGS ?= CFLAGS ?=
CPPFLAGS ?= CPPFLAGS ?=
RCFLAGS ?=
LDFLAGS ?= LDFLAGS ?=
CURL_LDFLAGS_BIN ?=
CURL_LDFLAGS_LIB ?=
LIBS ?= LIBS ?=
CROSSPREFIX ?= CROSSPREFIX ?=
@ -53,46 +50,21 @@ ifeq ($(CC),cc)
endif endif
CC := $(CROSSPREFIX)$(CC) CC := $(CROSSPREFIX)$(CC)
AR := $(CROSSPREFIX)$(AR) AR := $(CROSSPREFIX)$(AR)
RC ?= $(CROSSPREFIX)windres
# For compatibility TRIPLET ?= $(shell $(CC) -dumpmachine)
ARCH ?=
ifeq ($(ARCH),w64)
TRIPLET := x86_64-w64-mingw32
CFLAGS += -m64
LDFLAGS += -m64
RCFLAGS += --target=pe-x86-64
else ifdef ARCH
TRIPLET := i686-w64-mingw32
CFLAGS += -m32
LDFLAGS += -m32
RCFLAGS += --target=pe-i386
else
TRIPLET ?= $(shell $(CC) -dumpmachine)
endif
BIN_EXT := .exe BIN_EXT :=
ifneq ($(findstring -w,$(TRIPLET)),) ifneq ($(findstring msdos,$(TRIPLET)),)
WIN32 := 1
else ifneq ($(findstring msdos,$(TRIPLET)),)
# Cross-tools: https://github.com/andrewwutw/build-djgpp # Cross-tools: https://github.com/andrewwutw/build-djgpp
MSDOS := 1 MSDOS := 1
BIN_EXT := .exe
else ifneq ($(findstring amigaos,$(TRIPLET)),) else ifneq ($(findstring amigaos,$(TRIPLET)),)
# Cross-tools: https://github.com/bebbo/amiga-gcc # Cross-tools: https://github.com/bebbo/amiga-gcc
AMIGA := 1 AMIGA := 1
endif endif
CPPFLAGS += -I. -I$(PROOT)/include CPPFLAGS += -I. -I$(PROOT)/include
RCFLAGS += -I$(PROOT)/include
ifndef WIN32
DYN :=
endif
ifdef AMIGA
BIN_EXT :=
endif
### Deprecated settings. For compatibility. ### Deprecated settings. For compatibility.
@ -115,40 +87,26 @@ ifneq ($(findstring -map,$(CFG)),)
MAP := 1 MAP := 1
endif endif
ifdef WIN32
ifneq ($(findstring -unicode,$(CFG)),)
CPPFLAGS += -DUNICODE -D_UNICODE
CURL_LDFLAGS_BIN += -municode
endif
endif
# CPPFLAGS below are only necessary when building libcurl via 'lib' (see # CPPFLAGS below are only necessary when building libcurl via 'lib' (see
# comments below about exceptions). Always include them anyway to match # comments below about exceptions). Always include them anyway to match
# behavior of other build systems. # behavior of other build systems.
# Linker options to exclude for shared mode executables.
_LDFLAGS :=
_LIBS :=
ifneq ($(findstring -sync,$(CFG)),) ifneq ($(findstring -sync,$(CFG)),)
CPPFLAGS += -DUSE_SYNC_DNS CPPFLAGS += -DUSE_SYNC_DNS
else ifneq ($(findstring -ares,$(CFG)),) else ifneq ($(findstring -ares,$(CFG)),)
LIBCARES_PATH ?= $(PROOT)/../c-ares LIBCARES_PATH ?= $(PROOT)/../c-ares
CPPFLAGS += -DUSE_ARES CPPFLAGS += -DUSE_ARES
CPPFLAGS += -I"$(LIBCARES_PATH)/include" CPPFLAGS += -I"$(LIBCARES_PATH)/include"
_LDFLAGS += -L"$(LIBCARES_PATH)/lib" LDFLAGS += -L"$(LIBCARES_PATH)/lib"
_LIBS += -lcares LIBS += -lcares
endif endif
ifneq ($(findstring -rtmp,$(CFG)),) ifneq ($(findstring -rtmp,$(CFG)),)
LIBRTMP_PATH ?= $(PROOT)/../librtmp LIBRTMP_PATH ?= $(PROOT)/../librtmp
CPPFLAGS += -DUSE_LIBRTMP CPPFLAGS += -DUSE_LIBRTMP
CPPFLAGS += -I"$(LIBRTMP_PATH)" CPPFLAGS += -I"$(LIBRTMP_PATH)"
_LDFLAGS += -L"$(LIBRTMP_PATH)/librtmp" LDFLAGS += -L"$(LIBRTMP_PATH)/librtmp"
_LIBS += -lrtmp LIBS += -lrtmp
ifdef WIN32
_LIBS += -lwinmm
endif
ZLIB := 1 ZLIB := 1
endif endif
@ -156,23 +114,20 @@ ifneq ($(findstring -ssh2,$(CFG)),)
LIBSSH2_PATH ?= $(PROOT)/../libssh2 LIBSSH2_PATH ?= $(PROOT)/../libssh2
CPPFLAGS += -DUSE_LIBSSH2 CPPFLAGS += -DUSE_LIBSSH2
CPPFLAGS += -I"$(LIBSSH2_PATH)/include" CPPFLAGS += -I"$(LIBSSH2_PATH)/include"
_LDFLAGS += -L"$(LIBSSH2_PATH)/lib" LDFLAGS += -L"$(LIBSSH2_PATH)/lib"
ifdef WIN32 LIBS += -lssh2
_LDFLAGS += -L"$(LIBSSH2_PATH)/win32"
endif
_LIBS += -lssh2
else ifneq ($(findstring -libssh,$(CFG)),) else ifneq ($(findstring -libssh,$(CFG)),)
LIBSSH_PATH ?= $(PROOT)/../libssh LIBSSH_PATH ?= $(PROOT)/../libssh
CPPFLAGS += -DUSE_LIBSSH CPPFLAGS += -DUSE_LIBSSH
CPPFLAGS += -I"$(LIBSSH_PATH)/include" CPPFLAGS += -I"$(LIBSSH_PATH)/include"
_LDFLAGS += -L"$(LIBSSH_PATH)/lib" LDFLAGS += -L"$(LIBSSH_PATH)/lib"
_LIBS += -lssh LIBS += -lssh
else ifneq ($(findstring -wolfssh,$(CFG)),) else ifneq ($(findstring -wolfssh,$(CFG)),)
WOLFSSH_PATH ?= $(PROOT)/../wolfssh WOLFSSH_PATH ?= $(PROOT)/../wolfssh
CPPFLAGS += -DUSE_WOLFSSH CPPFLAGS += -DUSE_WOLFSSH
CPPFLAGS += -I"$(WOLFSSH_PATH)/include" CPPFLAGS += -I"$(WOLFSSH_PATH)/include"
_LDFLAGS += -L"$(WOLFSSH_PATH)/lib" LDFLAGS += -L"$(WOLFSSH_PATH)/lib"
_LIBS += -lwolfssh LIBS += -lwolfssh
endif endif
ifneq ($(findstring -ssl,$(CFG)),) ifneq ($(findstring -ssl,$(CFG)),)
@ -182,9 +137,9 @@ ifneq ($(findstring -ssl,$(CFG)),)
OPENSSL_INCLUDE ?= $(OPENSSL_PATH)/include OPENSSL_INCLUDE ?= $(OPENSSL_PATH)/include
OPENSSL_LIBPATH ?= $(OPENSSL_PATH)/lib OPENSSL_LIBPATH ?= $(OPENSSL_PATH)/lib
CPPFLAGS += -I"$(OPENSSL_INCLUDE)" CPPFLAGS += -I"$(OPENSSL_INCLUDE)"
_LDFLAGS += -L"$(OPENSSL_LIBPATH)" LDFLAGS += -L"$(OPENSSL_LIBPATH)"
OPENSSL_LIBS ?= -lssl -lcrypto OPENSSL_LIBS ?= -lssl -lcrypto
_LIBS += $(OPENSSL_LIBS) LIBS += $(OPENSSL_LIBS)
ifneq ($(findstring -srp,$(CFG)),) ifneq ($(findstring -srp,$(CFG)),)
ifneq ($(wildcard $(OPENSSL_INCLUDE)/openssl/srp.h),) ifneq ($(wildcard $(OPENSSL_INCLUDE)/openssl/srp.h),)
@ -199,20 +154,16 @@ ifneq ($(findstring -wolfssl,$(CFG)),)
CPPFLAGS += -DUSE_WOLFSSL CPPFLAGS += -DUSE_WOLFSSL
CPPFLAGS += -DSIZEOF_LONG_LONG=8 CPPFLAGS += -DSIZEOF_LONG_LONG=8
CPPFLAGS += -I"$(WOLFSSL_PATH)/include" CPPFLAGS += -I"$(WOLFSSL_PATH)/include"
_LDFLAGS += -L"$(WOLFSSL_PATH)/lib" LDFLAGS += -L"$(WOLFSSL_PATH)/lib"
_LIBS += -lwolfssl LIBS += -lwolfssl
SSLLIBS += 1 SSLLIBS += 1
endif endif
ifneq ($(findstring -mbedtls,$(CFG)),) ifneq ($(findstring -mbedtls,$(CFG)),)
MBEDTLS_PATH ?= $(PROOT)/../mbedtls MBEDTLS_PATH ?= $(PROOT)/../mbedtls
CPPFLAGS += -DUSE_MBEDTLS CPPFLAGS += -DUSE_MBEDTLS
CPPFLAGS += -I"$(MBEDTLS_PATH)/include" CPPFLAGS += -I"$(MBEDTLS_PATH)/include"
_LDFLAGS += -L"$(MBEDTLS_PATH)/lib" LDFLAGS += -L"$(MBEDTLS_PATH)/lib"
_LIBS += -lmbedtls -lmbedx509 -lmbedcrypto LIBS += -lmbedtls -lmbedx509 -lmbedcrypto
SSLLIBS += 1
endif
ifneq ($(findstring -schannel,$(CFG)),)
CPPFLAGS += -DUSE_SCHANNEL
SSLLIBS += 1 SSLLIBS += 1
endif endif
@ -220,21 +171,21 @@ ifneq ($(findstring -nghttp2,$(CFG)),)
NGHTTP2_PATH ?= $(PROOT)/../nghttp2 NGHTTP2_PATH ?= $(PROOT)/../nghttp2
CPPFLAGS += -DUSE_NGHTTP2 CPPFLAGS += -DUSE_NGHTTP2
CPPFLAGS += -I"$(NGHTTP2_PATH)/include" CPPFLAGS += -I"$(NGHTTP2_PATH)/include"
_LDFLAGS += -L"$(NGHTTP2_PATH)/lib" LDFLAGS += -L"$(NGHTTP2_PATH)/lib"
_LIBS += -lnghttp2 LIBS += -lnghttp2
endif endif
ifeq ($(findstring -nghttp3,$(CFG))$(findstring -ngtcp2,$(CFG)),-nghttp3-ngtcp2) ifeq ($(findstring -nghttp3,$(CFG))$(findstring -ngtcp2,$(CFG)),-nghttp3-ngtcp2)
NGHTTP3_PATH ?= $(PROOT)/../nghttp3 NGHTTP3_PATH ?= $(PROOT)/../nghttp3
CPPFLAGS += -DUSE_NGHTTP3 CPPFLAGS += -DUSE_NGHTTP3
CPPFLAGS += -I"$(NGHTTP3_PATH)/include" CPPFLAGS += -I"$(NGHTTP3_PATH)/include"
_LDFLAGS += -L"$(NGHTTP3_PATH)/lib" LDFLAGS += -L"$(NGHTTP3_PATH)/lib"
_LIBS += -lnghttp3 LIBS += -lnghttp3
NGTCP2_PATH ?= $(PROOT)/../ngtcp2 NGTCP2_PATH ?= $(PROOT)/../ngtcp2
CPPFLAGS += -DUSE_NGTCP2 CPPFLAGS += -DUSE_NGTCP2
CPPFLAGS += -I"$(NGTCP2_PATH)/include" CPPFLAGS += -I"$(NGTCP2_PATH)/include"
_LDFLAGS += -L"$(NGTCP2_PATH)/lib" LDFLAGS += -L"$(NGTCP2_PATH)/lib"
NGTCP2_LIBS ?= NGTCP2_LIBS ?=
ifeq ($(NGTCP2_LIBS),) ifeq ($(NGTCP2_LIBS),)
@ -249,7 +200,7 @@ ifeq ($(findstring -nghttp3,$(CFG))$(findstring -ngtcp2,$(CFG)),-nghttp3-ngtcp2)
endif endif
endif endif
_LIBS += -lngtcp2 $(NGTCP2_LIBS) LIBS += -lngtcp2 $(NGTCP2_LIBS)
endif endif
ifneq ($(findstring -zlib,$(CFG))$(ZLIB),) ifneq ($(findstring -zlib,$(CFG))$(ZLIB),)
@ -257,59 +208,51 @@ ifneq ($(findstring -zlib,$(CFG))$(ZLIB),)
# These CPPFLAGS are also required when compiling the curl tool via 'src'. # These CPPFLAGS are also required when compiling the curl tool via 'src'.
CPPFLAGS += -DHAVE_LIBZ CPPFLAGS += -DHAVE_LIBZ
CPPFLAGS += -I"$(ZLIB_PATH)/include" CPPFLAGS += -I"$(ZLIB_PATH)/include"
_LDFLAGS += -L"$(ZLIB_PATH)/lib" LDFLAGS += -L"$(ZLIB_PATH)/lib"
ZLIB_LIBS ?= -lz ZLIB_LIBS ?= -lz
_LIBS += $(ZLIB_LIBS) LIBS += $(ZLIB_LIBS)
ZLIB := 1 ZLIB := 1
endif endif
ifneq ($(findstring -zstd,$(CFG)),) ifneq ($(findstring -zstd,$(CFG)),)
ZSTD_PATH ?= $(PROOT)/../zstd ZSTD_PATH ?= $(PROOT)/../zstd
CPPFLAGS += -DHAVE_ZSTD CPPFLAGS += -DHAVE_ZSTD
CPPFLAGS += -I"$(ZSTD_PATH)/include" CPPFLAGS += -I"$(ZSTD_PATH)/include"
_LDFLAGS += -L"$(ZSTD_PATH)/lib" LDFLAGS += -L"$(ZSTD_PATH)/lib"
ZSTD_LIBS ?= -lzstd ZSTD_LIBS ?= -lzstd
_LIBS += $(ZSTD_LIBS) LIBS += $(ZSTD_LIBS)
endif endif
ifneq ($(findstring -brotli,$(CFG)),) ifneq ($(findstring -brotli,$(CFG)),)
BROTLI_PATH ?= $(PROOT)/../brotli BROTLI_PATH ?= $(PROOT)/../brotli
CPPFLAGS += -DHAVE_BROTLI CPPFLAGS += -DHAVE_BROTLI
CPPFLAGS += -I"$(BROTLI_PATH)/include" CPPFLAGS += -I"$(BROTLI_PATH)/include"
_LDFLAGS += -L"$(BROTLI_PATH)/lib" LDFLAGS += -L"$(BROTLI_PATH)/lib"
BROTLI_LIBS ?= -lbrotlidec -lbrotlicommon BROTLI_LIBS ?= -lbrotlidec -lbrotlicommon
_LIBS += $(BROTLI_LIBS) LIBS += $(BROTLI_LIBS)
endif endif
ifneq ($(findstring -gsasl,$(CFG)),) ifneq ($(findstring -gsasl,$(CFG)),)
LIBGSASL_PATH ?= $(PROOT)/../gsasl LIBGSASL_PATH ?= $(PROOT)/../gsasl
CPPFLAGS += -DUSE_GSASL CPPFLAGS += -DUSE_GSASL
CPPFLAGS += -I"$(LIBGSASL_PATH)/include" CPPFLAGS += -I"$(LIBGSASL_PATH)/include"
_LDFLAGS += -L"$(LIBGSASL_PATH)/lib" LDFLAGS += -L"$(LIBGSASL_PATH)/lib"
_LIBS += -lgsasl LIBS += -lgsasl
endif endif
ifneq ($(findstring -idn2,$(CFG)),) ifneq ($(findstring -idn2,$(CFG)),)
LIBIDN2_PATH ?= $(PROOT)/../libidn2 LIBIDN2_PATH ?= $(PROOT)/../libidn2
CPPFLAGS += -DUSE_LIBIDN2 CPPFLAGS += -DUSE_LIBIDN2
CPPFLAGS += -I"$(LIBIDN2_PATH)/include" CPPFLAGS += -I"$(LIBIDN2_PATH)/include"
_LDFLAGS += -L"$(LIBIDN2_PATH)/lib" LDFLAGS += -L"$(LIBIDN2_PATH)/lib"
_LIBS += -lidn2 LIBS += -lidn2
ifneq ($(findstring -psl,$(CFG)),) ifneq ($(findstring -psl,$(CFG)),)
LIBPSL_PATH ?= $(PROOT)/../libpsl LIBPSL_PATH ?= $(PROOT)/../libpsl
CPPFLAGS += -DUSE_LIBPSL CPPFLAGS += -DUSE_LIBPSL
CPPFLAGS += -I"$(LIBPSL_PATH)/include" CPPFLAGS += -I"$(LIBPSL_PATH)/include"
_LDFLAGS += -L"$(LIBPSL_PATH)/lib" LDFLAGS += -L"$(LIBPSL_PATH)/lib"
_LIBS += -lpsl LIBS += -lpsl
endif endif
else ifneq ($(findstring -winidn,$(CFG)),)
CPPFLAGS += -DUSE_WIN32_IDN
_LIBS += -lnormaliz
endif endif
ifneq ($(findstring -sspi,$(CFG)),)
ifdef WIN32
CPPFLAGS += -DUSE_WINDOWS_SSPI
endif
endif
ifneq ($(findstring -ipv6,$(CFG)),) ifneq ($(findstring -ipv6,$(CFG)),)
CPPFLAGS += -DENABLE_IPV6 CPPFLAGS += -DENABLE_IPV6
endif endif
@ -317,26 +260,14 @@ endif
ifneq ($(findstring -watt,$(CFG))$(MSDOS),) ifneq ($(findstring -watt,$(CFG))$(MSDOS),)
WATT_PATH ?= $(PROOT)/../watt WATT_PATH ?= $(PROOT)/../watt
CPPFLAGS += -I"$(WATT_PATH)/inc" CPPFLAGS += -I"$(WATT_PATH)/inc"
_LDFLAGS += -L"$(WATT_PATH)/lib" LDFLAGS += -L"$(WATT_PATH)/lib"
_LIBS += -lwatt LIBS += -lwatt
endif
ifdef WIN32
ifeq ($(findstring -lldap,$(LIBS)),)
_LIBS += -lwldap32
endif
_LIBS += -lws2_32 -lcrypt32 -lbcrypt
endif endif
ifneq ($(findstring 11,$(subst $(subst ,, ),,$(SSLLIBS))),) ifneq ($(findstring 11,$(subst $(subst ,, ),,$(SSLLIBS))),)
CPPFLAGS += -DCURL_WITH_MULTI_SSL CPPFLAGS += -DCURL_WITH_MULTI_SSL
endif endif
ifndef DYN
LDFLAGS += $(_LDFLAGS)
LIBS += $(_LIBS)
endif
### Common rules ### Common rules
OBJ_DIR := $(TRIPLET) OBJ_DIR := $(TRIPLET)
@ -363,9 +294,6 @@ $(OBJ_DIR):
$(OBJ_DIR)/%.o: %.c $(OBJ_DIR)/%.o: %.c
$(CC) -W -Wall $(CFLAGS) $(CPPFLAGS) -c $< -o $@ $(CC) -W -Wall $(CFLAGS) $(CPPFLAGS) -c $< -o $@
$(OBJ_DIR)/%.res: %.rc
$(RC) -O coff $(RCFLAGS) -i $< -o $@
clean: clean:
@$(call DEL, $(TOCLEAN)) @$(call DEL, $(TOCLEAN))
@$(RMDIR) $(OBJ_DIR) @$(RMDIR) $(OBJ_DIR)
@ -378,42 +306,23 @@ distclean vclean: clean
ifdef LOCAL ifdef LOCAL
CPPFLAGS += -DBUILDING_LIBCURL CPPFLAGS += -DBUILDING_LIBCURL
ifdef WIN32
CPPFLAGS += -DCURL_STATICLIB
endif
### Sources and targets ### Sources and targets
# Provides CSOURCES, HHEADERS, LIB_RCFILES # Provides CSOURCES, HHEADERS
include Makefile.inc include Makefile.inc
vpath %.c vauth vquic vssh vtls vpath %.c vauth vquic vssh vtls
libcurl_a_LIBRARY := libcurl.a libcurl_a_LIBRARY := libcurl.a
ifdef WIN32
CURL_DLL_SUFFIX ?=
libcurl_dll_LIBRARY := libcurl$(CURL_DLL_SUFFIX).dll
libcurl_dll_a_LIBRARY := libcurl.dll.a
ifeq ($(findstring -trackmem,$(CFG)),)
CURL_LDFLAGS_LIB += $(PROOT)/libcurl.def
endif
ifdef MAP
libcurl_map_LIBRARY := libcurl$(CURL_DLL_SUFFIX).map
CURL_LDFLAGS_LIB += -Wl,-Map,$(libcurl_map_LIBRARY)
endif
endif
TARGETS := $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) TARGETS := $(libcurl_a_LIBRARY)
libcurl_a_OBJECTS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(notdir $(strip $(CSOURCES)))) libcurl_a_OBJECTS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(notdir $(strip $(CSOURCES))))
libcurl_a_DEPENDENCIES := $(strip $(CSOURCES) $(HHEADERS)) libcurl_a_DEPENDENCIES := $(strip $(CSOURCES) $(HHEADERS))
ifdef WIN32
libcurl_dll_OBJECTS := $(libcurl_a_OBJECTS)
libcurl_dll_OBJECTS += $(patsubst %.rc,$(OBJ_DIR)/%.res,$(strip $(LIB_RCFILES)))
endif
TOCLEAN := $(libcurl_dll_OBJECTS) TOCLEAN :=
TOVCLEAN := $(libcurl_dll_LIBRARY:.dll=.def) $(libcurl_dll_a_LIBRARY) $(libcurl_map_LIBRARY) TOVCLEAN :=
### Rules ### Rules
@ -421,9 +330,5 @@ $(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
@$(call DEL, $@) @$(call DEL, $@)
$(AR) rcs $@ $(libcurl_a_OBJECTS) $(AR) rcs $@ $(libcurl_a_OBJECTS)
$(libcurl_dll_LIBRARY): $(libcurl_dll_OBJECTS)
$(CC) $(LDFLAGS) -shared $(CURL_LDFLAGS_LIB) -o $@ $(libcurl_dll_OBJECTS) $(LIBS) \
-Wl,--output-def,$(@:.dll=.def),--out-implib,$(libcurl_dll_a_LIBRARY)
all: $(OBJ_DIR) $(TARGETS) all: $(OBJ_DIR) $(TARGETS)
endif endif

View File

@ -32,31 +32,13 @@ include $(PROOT)/lib/Makefile.mk
### Local ### Local
RCFLAGS += -DCURL_EMBED_MANIFEST
CPPFLAGS += -I$(PROOT)/lib CPPFLAGS += -I$(PROOT)/lib
LDFLAGS += -L$(PROOT)/lib LDFLAGS += -L$(PROOT)/lib
LIBS := -lcurl $(LIBS) LIBS := -lcurl $(LIBS)
ifdef WIN32
ifneq ($(findstring -dyn,$(CFG)),)
DYN := 1
endif
endif
ifdef DYN
curl_DEPENDENCIES := $(PROOT)/lib/libcurl$(CURL_DLL_SUFFIX).dll
curl_DEPENDENCIES += $(PROOT)/lib/libcurl.dll.a
else
curl_DEPENDENCIES := $(PROOT)/lib/libcurl.a
ifdef WIN32
CPPFLAGS += -DCURL_STATICLIB
LDFLAGS += -static
endif
endif
### Sources and targets ### Sources and targets
# Provides CURL_CFILES, CURLX_CFILES, CURL_RCFILES # Provides CURL_CFILES, CURLX_CFILES
include Makefile.inc include Makefile.inc
TARGETS := curl$(BIN_EXT) TARGETS := curl$(BIN_EXT)
@ -64,12 +46,9 @@ TARGETS := curl$(BIN_EXT)
CURL_CFILES += $(notdir $(CURLX_CFILES)) CURL_CFILES += $(notdir $(CURLX_CFILES))
curl_OBJECTS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(strip $(CURL_CFILES))) curl_OBJECTS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(strip $(CURL_CFILES)))
ifdef WIN32
curl_OBJECTS += $(patsubst %.rc,$(OBJ_DIR)/%.res,$(strip $(CURL_RCFILES)))
endif
ifdef MAP ifdef MAP
CURL_MAP := curl.map CURL_MAP := curl.map
CURL_LDFLAGS_BIN += -Wl,-Map,$(CURL_MAP) LDFLAGS += -Wl,-Map,$(CURL_MAP)
TOVCLEAN := $(CURL_MAP) TOVCLEAN := $(CURL_MAP)
endif endif
vpath %.c $(PROOT)/lib vpath %.c $(PROOT)/lib
@ -105,7 +84,7 @@ tool_hugehelp.c:
endif endif
endif endif
$(TARGETS): $(curl_OBJECTS) $(curl_DEPENDENCIES) $(TARGETS): $(curl_OBJECTS) $(PROOT)/lib/libcurl.a
$(CC) $(LDFLAGS) $(CURL_LDFLAGS_BIN) -o $@ $(curl_OBJECTS) $(LIBS) $(CC) $(LDFLAGS) -o $@ $(curl_OBJECTS) $(LIBS)
all: $(OBJ_DIR) $(TARGETS) all: $(OBJ_DIR) $(TARGETS)