curl/lib/Makefile.mk

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

421 lines
10 KiB
Makefile
Raw Normal View History

#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
2020-11-04 21:02:01 +08:00
# are also available at https://curl.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
#***************************************************************************
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
# Makefile to build curl parts with GCC-like toolchains and optional features.
Makefile.m32: cleanups and fixes [ci skip] - Add `-lcrypt32` once, and add it always for simplicity. - Delete broken link and reference to the pre-Vista WinIDN add-on. MS no longer distribute it. - Delete related `WINIDN_PATH` option. IDN is a system lib since Vista. - Sync `LIBCARES_PATH` default with the rest of dependencies. - Delete version numbers from dependency path defaults. - `libgsasl` package is now called `gsasl`. - Delete `libexpat` and `libxml2` references. No longer used by curl. - Delete `Edit the path below...` comments. We recommend to predefine those envvars instead. - `libcares.a` is not an internal dependency anymore. Stop using it as such. - `windres` `--include-dir` -> `-I`, `-F` -> `--target=` for readability. - Delete `STRIP`, `CURL_STRIP`, `AR` references from `src/Makefile.m32`. They were never used. - Stop to `clean` some objects twice in `src/Makefile.m32`. - Delete cvs-specific leftovers. - Finish resource support in examples make file. - Delete `-I<root>/lib` from examples make file. - Fix copyright start year in examples make file. - Delete duplicate `ftpuploadresume` input in examples make file. - Sync OpenSSL lib order, `SYNC` support, `PROOT` use, dependency path defaults, variables names and other internal bits between the three make files. - `lib/Makefile.m32` accepted custom options via `DLL_LIBS` envvar. This was lib-specific and possibly accidental. Use `CURL_LDFLAG_EXTRAS_DLL` envvar for the same effect. - Fix linking `curl.exe` and examples to wrong static libs with auto-detected OpenSSL 1.0.2 or earlier. - Add `-lgdi32` for OpenSSL 1.0.2 and earlier only. - Add link to Novell LDAP SDK and use a relative default path. Latest version is from 2016, linked to an outdated OpenSSL 1.0.1. - Whitespace and comment cleanups. TODO in a next commit: Delete built-in detection/logic for OpenSSL 1.0.2 and earlier, the Novell LDAP SDK and the other LDAP SDK (which is _not_ OpenLDAP). Write up the necessary custom envvars to configure them. Closes #9616
2022-10-01 18:07:34 +08:00
#
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
# Usage: [mingw32-]make -f Makefile.mk CFG=-feat1[-feat2][-feat3][...]
# Example: [mingw32-]make -f Makefile.mk CFG=-zlib-ssl-libssh2-ipv6
Makefile.m32: cleanups and fixes [ci skip] - Add `-lcrypt32` once, and add it always for simplicity. - Delete broken link and reference to the pre-Vista WinIDN add-on. MS no longer distribute it. - Delete related `WINIDN_PATH` option. IDN is a system lib since Vista. - Sync `LIBCARES_PATH` default with the rest of dependencies. - Delete version numbers from dependency path defaults. - `libgsasl` package is now called `gsasl`. - Delete `libexpat` and `libxml2` references. No longer used by curl. - Delete `Edit the path below...` comments. We recommend to predefine those envvars instead. - `libcares.a` is not an internal dependency anymore. Stop using it as such. - `windres` `--include-dir` -> `-I`, `-F` -> `--target=` for readability. - Delete `STRIP`, `CURL_STRIP`, `AR` references from `src/Makefile.m32`. They were never used. - Stop to `clean` some objects twice in `src/Makefile.m32`. - Delete cvs-specific leftovers. - Finish resource support in examples make file. - Delete `-I<root>/lib` from examples make file. - Fix copyright start year in examples make file. - Delete duplicate `ftpuploadresume` input in examples make file. - Sync OpenSSL lib order, `SYNC` support, `PROOT` use, dependency path defaults, variables names and other internal bits between the three make files. - `lib/Makefile.m32` accepted custom options via `DLL_LIBS` envvar. This was lib-specific and possibly accidental. Use `CURL_LDFLAG_EXTRAS_DLL` envvar for the same effect. - Fix linking `curl.exe` and examples to wrong static libs with auto-detected OpenSSL 1.0.2 or earlier. - Add `-lgdi32` for OpenSSL 1.0.2 and earlier only. - Add link to Novell LDAP SDK and use a relative default path. Latest version is from 2016, linked to an outdated OpenSSL 1.0.1. - Whitespace and comment cleanups. TODO in a next commit: Delete built-in detection/logic for OpenSSL 1.0.2 and earlier, the Novell LDAP SDK and the other LDAP SDK (which is _not_ OpenLDAP). Write up the necessary custom envvars to configure them. Closes #9616
2022-10-01 18:07:34 +08:00
#
# Look for ' ?=' to find all accepted customization variables.
2002-09-07 06:05:36 +08:00
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
# This script is reused by 'src' and 'docs/examples' Makefile.mk scripts.
Makefile.m32: deduplicate build rules [ci skip] After this patch, we reduce the three copies of most `Makefile.m32` logic to one. This now resides in `lib/Makefile.m32`. It makes future updates easier, the code shorter, with a small amount of added complexity. `Makefile.m32` reduction: | | bytes | LOC total | blank | comment | code | |-------------------|-------:|----------:|-------:|---------:|------:| | 7.85.0 | 34772 | 1337 | 79 | 192 | 1066 | | before this patch | 17601 | 625 | 62 | 106 | 457 | | after this patch | 11680 | 392 | 52 | 104 | 236 | Details: - Change rules to create objects for the `v*` subdirs in the `lib` dir. This allows to use a shared compile rule and assumes that filenames are not (and will not be) colliding across these directories. `Makefile.m32` now also stores a list of these subdirs. They are changing rarely though. - Sync as much as possible between the three `Makefile.m32` scripts' rules and their source/target sections. - After this patch `CPPFLAGS` are all applied to the `src` sources once again. This matches the behaviour of cmake/autotools. Only zlib ones are actually required there. - Use `.rc` names from `Makefile.inc` instead of keeping a duplicate. - Change examples to link `libcurl.dll` by default. This makes building trivial, even as a cross-build: `CC=x86_64-w64-mingw32-gcc make -f Makefile.m32` To run them, you need to move/copy or add-to-path `libcurl.dll`. You can select static mode via `CFG=-static`. - List more of the `Makefile.m32` config variables. - Drop `.rc` support from examples. It made it fragile without much benefit. - Include a necessary system lib for the `externalsocket.c` example. - Exclude unnecessary systems libs when building in `-dyn` mode. Closes #9642
2022-10-05 01:09:51 +08:00
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
ifndef PROOT
PROOT := ..
LOCAL := 1
endif
Makefile.m32: deduplicate build rules [ci skip] After this patch, we reduce the three copies of most `Makefile.m32` logic to one. This now resides in `lib/Makefile.m32`. It makes future updates easier, the code shorter, with a small amount of added complexity. `Makefile.m32` reduction: | | bytes | LOC total | blank | comment | code | |-------------------|-------:|----------:|-------:|---------:|------:| | 7.85.0 | 34772 | 1337 | 79 | 192 | 1066 | | before this patch | 17601 | 625 | 62 | 106 | 457 | | after this patch | 11680 | 392 | 52 | 104 | 236 | Details: - Change rules to create objects for the `v*` subdirs in the `lib` dir. This allows to use a shared compile rule and assumes that filenames are not (and will not be) colliding across these directories. `Makefile.m32` now also stores a list of these subdirs. They are changing rarely though. - Sync as much as possible between the three `Makefile.m32` scripts' rules and their source/target sections. - After this patch `CPPFLAGS` are all applied to the `src` sources once again. This matches the behaviour of cmake/autotools. Only zlib ones are actually required there. - Use `.rc` names from `Makefile.inc` instead of keeping a duplicate. - Change examples to link `libcurl.dll` by default. This makes building trivial, even as a cross-build: `CC=x86_64-w64-mingw32-gcc make -f Makefile.m32` To run them, you need to move/copy or add-to-path `libcurl.dll`. You can select static mode via `CFG=-static`. - List more of the `Makefile.m32` config variables. - Drop `.rc` support from examples. It made it fragile without much benefit. - Include a necessary system lib for the `externalsocket.c` example. - Exclude unnecessary systems libs when building in `-dyn` mode. Closes #9642
2022-10-05 01:09:51 +08:00
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
### Common
Makefile.m32: deduplicate build rules [ci skip] After this patch, we reduce the three copies of most `Makefile.m32` logic to one. This now resides in `lib/Makefile.m32`. It makes future updates easier, the code shorter, with a small amount of added complexity. `Makefile.m32` reduction: | | bytes | LOC total | blank | comment | code | |-------------------|-------:|----------:|-------:|---------:|------:| | 7.85.0 | 34772 | 1337 | 79 | 192 | 1066 | | before this patch | 17601 | 625 | 62 | 106 | 457 | | after this patch | 11680 | 392 | 52 | 104 | 236 | Details: - Change rules to create objects for the `v*` subdirs in the `lib` dir. This allows to use a shared compile rule and assumes that filenames are not (and will not be) colliding across these directories. `Makefile.m32` now also stores a list of these subdirs. They are changing rarely though. - Sync as much as possible between the three `Makefile.m32` scripts' rules and their source/target sections. - After this patch `CPPFLAGS` are all applied to the `src` sources once again. This matches the behaviour of cmake/autotools. Only zlib ones are actually required there. - Use `.rc` names from `Makefile.inc` instead of keeping a duplicate. - Change examples to link `libcurl.dll` by default. This makes building trivial, even as a cross-build: `CC=x86_64-w64-mingw32-gcc make -f Makefile.m32` To run them, you need to move/copy or add-to-path `libcurl.dll`. You can select static mode via `CFG=-static`. - List more of the `Makefile.m32` config variables. - Drop `.rc` support from examples. It made it fragile without much benefit. - Include a necessary system lib for the `externalsocket.c` example. - Exclude unnecessary systems libs when building in `-dyn` mode. Closes #9642
2022-10-05 01:09:51 +08:00
CFLAGS ?=
CPPFLAGS ?=
RCFLAGS ?=
LDFLAGS ?=
CURL_LDFLAGS_BIN ?=
CURL_LDFLAGS_LIB ?=
LIBS ?=
CROSSPREFIX ?=
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
ifeq ($(CC),cc)
CC := gcc
endif
CC := $(CROSSPREFIX)$(CC)
AR := $(CROSSPREFIX)$(AR)
RC ?= $(CROSSPREFIX)windres
Makefile.m32: deduplicate build rules [ci skip] After this patch, we reduce the three copies of most `Makefile.m32` logic to one. This now resides in `lib/Makefile.m32`. It makes future updates easier, the code shorter, with a small amount of added complexity. `Makefile.m32` reduction: | | bytes | LOC total | blank | comment | code | |-------------------|-------:|----------:|-------:|---------:|------:| | 7.85.0 | 34772 | 1337 | 79 | 192 | 1066 | | before this patch | 17601 | 625 | 62 | 106 | 457 | | after this patch | 11680 | 392 | 52 | 104 | 236 | Details: - Change rules to create objects for the `v*` subdirs in the `lib` dir. This allows to use a shared compile rule and assumes that filenames are not (and will not be) colliding across these directories. `Makefile.m32` now also stores a list of these subdirs. They are changing rarely though. - Sync as much as possible between the three `Makefile.m32` scripts' rules and their source/target sections. - After this patch `CPPFLAGS` are all applied to the `src` sources once again. This matches the behaviour of cmake/autotools. Only zlib ones are actually required there. - Use `.rc` names from `Makefile.inc` instead of keeping a duplicate. - Change examples to link `libcurl.dll` by default. This makes building trivial, even as a cross-build: `CC=x86_64-w64-mingw32-gcc make -f Makefile.m32` To run them, you need to move/copy or add-to-path `libcurl.dll`. You can select static mode via `CFG=-static`. - List more of the `Makefile.m32` config variables. - Drop `.rc` support from examples. It made it fragile without much benefit. - Include a necessary system lib for the `externalsocket.c` example. - Exclude unnecessary systems libs when building in `-dyn` mode. Closes #9642
2022-10-05 01:09:51 +08:00
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
# For compatibility
ARCH ?=
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
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
Makefile.m32: deduplicate build rules [ci skip] After this patch, we reduce the three copies of most `Makefile.m32` logic to one. This now resides in `lib/Makefile.m32`. It makes future updates easier, the code shorter, with a small amount of added complexity. `Makefile.m32` reduction: | | bytes | LOC total | blank | comment | code | |-------------------|-------:|----------:|-------:|---------:|------:| | 7.85.0 | 34772 | 1337 | 79 | 192 | 1066 | | before this patch | 17601 | 625 | 62 | 106 | 457 | | after this patch | 11680 | 392 | 52 | 104 | 236 | Details: - Change rules to create objects for the `v*` subdirs in the `lib` dir. This allows to use a shared compile rule and assumes that filenames are not (and will not be) colliding across these directories. `Makefile.m32` now also stores a list of these subdirs. They are changing rarely though. - Sync as much as possible between the three `Makefile.m32` scripts' rules and their source/target sections. - After this patch `CPPFLAGS` are all applied to the `src` sources once again. This matches the behaviour of cmake/autotools. Only zlib ones are actually required there. - Use `.rc` names from `Makefile.inc` instead of keeping a duplicate. - Change examples to link `libcurl.dll` by default. This makes building trivial, even as a cross-build: `CC=x86_64-w64-mingw32-gcc make -f Makefile.m32` To run them, you need to move/copy or add-to-path `libcurl.dll`. You can select static mode via `CFG=-static`. - List more of the `Makefile.m32` config variables. - Drop `.rc` support from examples. It made it fragile without much benefit. - Include a necessary system lib for the `externalsocket.c` example. - Exclude unnecessary systems libs when building in `-dyn` mode. Closes #9642
2022-10-05 01:09:51 +08:00
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
BIN_EXT := .exe
Makefile.m32: deduplicate build rules [ci skip] After this patch, we reduce the three copies of most `Makefile.m32` logic to one. This now resides in `lib/Makefile.m32`. It makes future updates easier, the code shorter, with a small amount of added complexity. `Makefile.m32` reduction: | | bytes | LOC total | blank | comment | code | |-------------------|-------:|----------:|-------:|---------:|------:| | 7.85.0 | 34772 | 1337 | 79 | 192 | 1066 | | before this patch | 17601 | 625 | 62 | 106 | 457 | | after this patch | 11680 | 392 | 52 | 104 | 236 | Details: - Change rules to create objects for the `v*` subdirs in the `lib` dir. This allows to use a shared compile rule and assumes that filenames are not (and will not be) colliding across these directories. `Makefile.m32` now also stores a list of these subdirs. They are changing rarely though. - Sync as much as possible between the three `Makefile.m32` scripts' rules and their source/target sections. - After this patch `CPPFLAGS` are all applied to the `src` sources once again. This matches the behaviour of cmake/autotools. Only zlib ones are actually required there. - Use `.rc` names from `Makefile.inc` instead of keeping a duplicate. - Change examples to link `libcurl.dll` by default. This makes building trivial, even as a cross-build: `CC=x86_64-w64-mingw32-gcc make -f Makefile.m32` To run them, you need to move/copy or add-to-path `libcurl.dll`. You can select static mode via `CFG=-static`. - List more of the `Makefile.m32` config variables. - Drop `.rc` support from examples. It made it fragile without much benefit. - Include a necessary system lib for the `externalsocket.c` example. - Exclude unnecessary systems libs when building in `-dyn` mode. Closes #9642
2022-10-05 01:09:51 +08:00
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
ifneq ($(findstring -w,$(TRIPLET)),)
WIN32 := 1
else ifneq ($(findstring msdos,$(TRIPLET)),)
# Cross-tools: https://github.com/andrewwutw/build-djgpp
MSDOS := 1
else ifneq ($(findstring amigaos,$(TRIPLET)),)
# Cross-tools: https://github.com/bebbo/amiga-gcc
AMIGA := 1
Makefile.m32: deduplicate build rules [ci skip] After this patch, we reduce the three copies of most `Makefile.m32` logic to one. This now resides in `lib/Makefile.m32`. It makes future updates easier, the code shorter, with a small amount of added complexity. `Makefile.m32` reduction: | | bytes | LOC total | blank | comment | code | |-------------------|-------:|----------:|-------:|---------:|------:| | 7.85.0 | 34772 | 1337 | 79 | 192 | 1066 | | before this patch | 17601 | 625 | 62 | 106 | 457 | | after this patch | 11680 | 392 | 52 | 104 | 236 | Details: - Change rules to create objects for the `v*` subdirs in the `lib` dir. This allows to use a shared compile rule and assumes that filenames are not (and will not be) colliding across these directories. `Makefile.m32` now also stores a list of these subdirs. They are changing rarely though. - Sync as much as possible between the three `Makefile.m32` scripts' rules and their source/target sections. - After this patch `CPPFLAGS` are all applied to the `src` sources once again. This matches the behaviour of cmake/autotools. Only zlib ones are actually required there. - Use `.rc` names from `Makefile.inc` instead of keeping a duplicate. - Change examples to link `libcurl.dll` by default. This makes building trivial, even as a cross-build: `CC=x86_64-w64-mingw32-gcc make -f Makefile.m32` To run them, you need to move/copy or add-to-path `libcurl.dll`. You can select static mode via `CFG=-static`. - List more of the `Makefile.m32` config variables. - Drop `.rc` support from examples. It made it fragile without much benefit. - Include a necessary system lib for the `externalsocket.c` example. - Exclude unnecessary systems libs when building in `-dyn` mode. Closes #9642
2022-10-05 01:09:51 +08:00
endif
CPPFLAGS += -I. -I$(PROOT)/include
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
RCFLAGS += -I$(PROOT)/include
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
ifndef WIN32
DYN :=
endif
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
ifdef AMIGA
BIN_EXT :=
endif
### Deprecated settings. For compatibility.
ifdef WATT_ROOT
WATT_PATH := $(realpath $(WATT_ROOT))
endif
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
### Optional features
2002-09-07 06:05:36 +08:00
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
ifneq ($(findstring -debug,$(CFG)),)
CPPFLAGS += -DDEBUGBUILD
LDFLAGS += -g
else
CPPFLAGS += -DNDEBUG
endif
ifneq ($(findstring -trackmem,$(CFG)),)
CPPFLAGS += -DCURLDEBUG
endif
ifneq ($(findstring -map,$(CFG)),)
MAP := 1
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
# comments below about exceptions). Always include them anyway to match
# behavior of other build systems.
# Linker options to exclude for shared mode executables.
_LDFLAGS :=
_LIBS :=
ifneq ($(findstring -sync,$(CFG)),)
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
CPPFLAGS += -DUSE_SYNC_DNS
else ifneq ($(findstring -ares,$(CFG)),)
LIBCARES_PATH ?= $(PROOT)/../c-ares
CPPFLAGS += -DUSE_ARES
CPPFLAGS += -I"$(LIBCARES_PATH)/include"
_LDFLAGS += -L"$(LIBCARES_PATH)/lib"
_LIBS += -lcares
2013-04-11 20:05:08 +08:00
endif
ifneq ($(findstring -rtmp,$(CFG)),)
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
LIBRTMP_PATH ?= $(PROOT)/../librtmp
CPPFLAGS += -DUSE_LIBRTMP
CPPFLAGS += -I"$(LIBRTMP_PATH)"
_LDFLAGS += -L"$(LIBRTMP_PATH)/librtmp"
_LIBS += -lrtmp -lwinmm
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
ZLIB := 1
endif
ifneq ($(findstring -ssh2,$(CFG)),)
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
LIBSSH2_PATH ?= $(PROOT)/../libssh2
CPPFLAGS += -DUSE_LIBSSH2
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
CPPFLAGS += -I"$(LIBSSH2_PATH)/include"
_LDFLAGS += -L"$(LIBSSH2_PATH)/lib"
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
ifdef WIN32
_LDFLAGS += -L"$(LIBSSH2_PATH)/win32"
endif
_LIBS += -lssh2
else ifneq ($(findstring -libssh,$(CFG)),)
LIBSSH_PATH ?= $(PROOT)/../libssh
CPPFLAGS += -DUSE_LIBSSH
CPPFLAGS += -I"$(LIBSSH_PATH)/include"
_LDFLAGS += -L"$(LIBSSH_PATH)/lib"
_LIBS += -lssh
else ifneq ($(findstring -wolfssh,$(CFG)),)
WOLFSSH_PATH ?= $(PROOT)/../wolfssh
CPPFLAGS += -DUSE_WOLFSSH
CPPFLAGS += -I"$(WOLFSSH_PATH)/include"
_LDFLAGS += -L"$(WOLFSSH_PATH)/lib"
_LIBS += -lwolfssh
2012-04-13 19:17:57 +08:00
endif
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
ifneq ($(findstring -ssl,$(CFG)),)
OPENSSL_PATH ?= $(PROOT)/../openssl
CPPFLAGS += -DUSE_OPENSSL
CPPFLAGS += -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG
OPENSSL_INCLUDE ?= $(OPENSSL_PATH)/include
OPENSSL_LIBPATH ?= $(OPENSSL_PATH)/lib
CPPFLAGS += -I"$(OPENSSL_INCLUDE)"
_LDFLAGS += -L"$(OPENSSL_LIBPATH)"
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
OPENSSL_LIBS ?= -lssl -lcrypto
_LIBS += $(OPENSSL_LIBS)
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
ifneq ($(findstring -srp,$(CFG)),)
ifneq ($(wildcard $(OPENSSL_INCLUDE)/openssl/srp.h),)
# OpenSSL 1.0.1 and later.
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
CPPFLAGS += -DHAVE_OPENSSL_SRP -DUSE_TLS_SRP
endif
endif
SSLLIBS += 1
endif
ifneq ($(findstring -wolfssl,$(CFG)),)
WOLFSSL_PATH ?= $(PROOT)/../wolfssl
CPPFLAGS += -DUSE_WOLFSSL
CPPFLAGS += -DSIZEOF_LONG_LONG=8
CPPFLAGS += -I"$(WOLFSSL_PATH)/include"
_LDFLAGS += -L"$(WOLFSSL_PATH)/lib"
_LIBS += -lwolfssl
SSLLIBS += 1
endif
ifneq ($(findstring -mbedtls,$(CFG)),)
MBEDTLS_PATH ?= $(PROOT)/../mbedtls
CPPFLAGS += -DUSE_MBEDTLS
CPPFLAGS += -I"$(MBEDTLS_PATH)/include"
_LDFLAGS += -L"$(MBEDTLS_PATH)/lib"
_LIBS += -lmbedtls -lmbedx509 -lmbedcrypto
SSLLIBS += 1
endif
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
ifneq ($(findstring -schannel,$(CFG)),)
CPPFLAGS += -DUSE_SCHANNEL
SSLLIBS += 1
endif
ifneq ($(findstring -nghttp2,$(CFG)),)
NGHTTP2_PATH ?= $(PROOT)/../nghttp2
CPPFLAGS += -DUSE_NGHTTP2
CPPFLAGS += -I"$(NGHTTP2_PATH)/include"
_LDFLAGS += -L"$(NGHTTP2_PATH)/lib"
_LIBS += -lnghttp2
endif
ifeq ($(findstring -nghttp3,$(CFG))$(findstring -ngtcp2,$(CFG)),-nghttp3-ngtcp2)
NGHTTP3_PATH ?= $(PROOT)/../nghttp3
CPPFLAGS += -DUSE_NGHTTP3
CPPFLAGS += -I"$(NGHTTP3_PATH)/include"
_LDFLAGS += -L"$(NGHTTP3_PATH)/lib"
_LIBS += -lnghttp3
NGTCP2_PATH ?= $(PROOT)/../ngtcp2
CPPFLAGS += -DUSE_NGTCP2
CPPFLAGS += -I"$(NGTCP2_PATH)/include"
_LDFLAGS += -L"$(NGTCP2_PATH)/lib"
NGTCP2_LIBS ?=
ifeq ($(NGTCP2_LIBS),)
ifneq ($(findstring -ssl,$(CFG)),)
ifneq ($(wildcard $(OPENSSL_INCLUDE)/openssl/aead.h),)
NGTCP2_LIBS := -lngtcp2_crypto_boringssl
else # including libressl
NGTCP2_LIBS := -lngtcp2_crypto_openssl
endif
else ifneq ($(findstring -wolfssl,$(CFG)),)
NGTCP2_LIBS := -lngtcp2_crypto_wolfssl
endif
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
endif
_LIBS += -lngtcp2 $(NGTCP2_LIBS)
endif
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
ifneq ($(findstring -zlib,$(CFG))$(ZLIB),)
ZLIB_PATH ?= $(PROOT)/../zlib
Makefile.m32: deduplicate build rules [ci skip] After this patch, we reduce the three copies of most `Makefile.m32` logic to one. This now resides in `lib/Makefile.m32`. It makes future updates easier, the code shorter, with a small amount of added complexity. `Makefile.m32` reduction: | | bytes | LOC total | blank | comment | code | |-------------------|-------:|----------:|-------:|---------:|------:| | 7.85.0 | 34772 | 1337 | 79 | 192 | 1066 | | before this patch | 17601 | 625 | 62 | 106 | 457 | | after this patch | 11680 | 392 | 52 | 104 | 236 | Details: - Change rules to create objects for the `v*` subdirs in the `lib` dir. This allows to use a shared compile rule and assumes that filenames are not (and will not be) colliding across these directories. `Makefile.m32` now also stores a list of these subdirs. They are changing rarely though. - Sync as much as possible between the three `Makefile.m32` scripts' rules and their source/target sections. - After this patch `CPPFLAGS` are all applied to the `src` sources once again. This matches the behaviour of cmake/autotools. Only zlib ones are actually required there. - Use `.rc` names from `Makefile.inc` instead of keeping a duplicate. - Change examples to link `libcurl.dll` by default. This makes building trivial, even as a cross-build: `CC=x86_64-w64-mingw32-gcc make -f Makefile.m32` To run them, you need to move/copy or add-to-path `libcurl.dll`. You can select static mode via `CFG=-static`. - List more of the `Makefile.m32` config variables. - Drop `.rc` support from examples. It made it fragile without much benefit. - Include a necessary system lib for the `externalsocket.c` example. - Exclude unnecessary systems libs when building in `-dyn` mode. Closes #9642
2022-10-05 01:09:51 +08:00
# These CPPFLAGS are also required when compiling the curl tool via 'src'.
CPPFLAGS += -DHAVE_LIBZ
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
CPPFLAGS += -I"$(ZLIB_PATH)/include"
_LDFLAGS += -L"$(ZLIB_PATH)/lib"
ZLIB_LIBS ?= -lz
_LIBS += $(ZLIB_LIBS)
ZLIB := 1
2002-09-07 06:05:36 +08:00
endif
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
ifneq ($(findstring -zstd,$(CFG)),)
ZSTD_PATH ?= $(PROOT)/../zstd
CPPFLAGS += -DHAVE_ZSTD
CPPFLAGS += -I"$(ZSTD_PATH)/include"
_LDFLAGS += -L"$(ZSTD_PATH)/lib"
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
ZSTD_LIBS ?= -lzstd
_LIBS += $(ZSTD_LIBS)
endif
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
ifneq ($(findstring -brotli,$(CFG)),)
BROTLI_PATH ?= $(PROOT)/../brotli
CPPFLAGS += -DHAVE_BROTLI
CPPFLAGS += -I"$(BROTLI_PATH)/include"
_LDFLAGS += -L"$(BROTLI_PATH)/lib"
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
BROTLI_LIBS ?= -lbrotlidec -lbrotlicommon
_LIBS += $(BROTLI_LIBS)
2017-11-05 22:32:43 +08:00
endif
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
ifneq ($(findstring -gsasl,$(CFG)),)
LIBGSASL_PATH ?= $(PROOT)/../gsasl
CPPFLAGS += -DUSE_GSASL
CPPFLAGS += -I"$(LIBGSASL_PATH)/include"
_LDFLAGS += -L"$(LIBGSASL_PATH)/lib"
_LIBS += -lgsasl
endif
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
ifneq ($(findstring -idn2,$(CFG)),)
LIBIDN2_PATH ?= $(PROOT)/../libidn2
CPPFLAGS += -DUSE_LIBIDN2
CPPFLAGS += -I"$(LIBIDN2_PATH)/include"
_LDFLAGS += -L"$(LIBIDN2_PATH)/lib"
_LIBS += -lidn2
ifneq ($(findstring -psl,$(CFG)),)
LIBPSL_PATH ?= $(PROOT)/../libpsl
CPPFLAGS += -DUSE_LIBPSL
CPPFLAGS += -I"$(LIBPSL_PATH)/include"
_LDFLAGS += -L"$(LIBPSL_PATH)/lib"
_LIBS += -lpsl
endif
else ifneq ($(findstring -winidn,$(CFG)),)
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
CPPFLAGS += -DUSE_WIN32_IDN
_LIBS += -lnormaliz
2008-11-12 01:43:02 +08:00
endif
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
ifneq ($(findstring -sspi,$(CFG)),)
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
ifdef WIN32
CPPFLAGS += -DUSE_WINDOWS_SSPI
endif
2011-09-04 16:03:08 +08:00
endif
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
ifneq ($(findstring -ipv6,$(CFG)),)
CPPFLAGS += -DENABLE_IPV6
2007-02-15 09:36:35 +08:00
endif
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
ifneq ($(findstring -watt,$(CFG))$(MSDOS),)
WATT_PATH ?= $(PROOT)/../watt
CPPFLAGS += -I"$(WATT_PATH)/inc"
_LDFLAGS += -L"$(WATT_PATH)/lib"
_LIBS += -lwatt
endif
ifdef WIN32
ifeq ($(findstring -lldap,$(LIBS)),)
_LIBS += -lwldap32
endif
_LIBS += -lws2_32 -lcrypt32 -lbcrypt
endif
ifneq ($(findstring 11,$(subst $(subst ,, ),,$(SSLLIBS))),)
CPPFLAGS += -DCURL_WITH_MULTI_SSL
endif
Makefile.m32: deduplicate build rules [ci skip] After this patch, we reduce the three copies of most `Makefile.m32` logic to one. This now resides in `lib/Makefile.m32`. It makes future updates easier, the code shorter, with a small amount of added complexity. `Makefile.m32` reduction: | | bytes | LOC total | blank | comment | code | |-------------------|-------:|----------:|-------:|---------:|------:| | 7.85.0 | 34772 | 1337 | 79 | 192 | 1066 | | before this patch | 17601 | 625 | 62 | 106 | 457 | | after this patch | 11680 | 392 | 52 | 104 | 236 | Details: - Change rules to create objects for the `v*` subdirs in the `lib` dir. This allows to use a shared compile rule and assumes that filenames are not (and will not be) colliding across these directories. `Makefile.m32` now also stores a list of these subdirs. They are changing rarely though. - Sync as much as possible between the three `Makefile.m32` scripts' rules and their source/target sections. - After this patch `CPPFLAGS` are all applied to the `src` sources once again. This matches the behaviour of cmake/autotools. Only zlib ones are actually required there. - Use `.rc` names from `Makefile.inc` instead of keeping a duplicate. - Change examples to link `libcurl.dll` by default. This makes building trivial, even as a cross-build: `CC=x86_64-w64-mingw32-gcc make -f Makefile.m32` To run them, you need to move/copy or add-to-path `libcurl.dll`. You can select static mode via `CFG=-static`. - List more of the `Makefile.m32` config variables. - Drop `.rc` support from examples. It made it fragile without much benefit. - Include a necessary system lib for the `externalsocket.c` example. - Exclude unnecessary systems libs when building in `-dyn` mode. Closes #9642
2022-10-05 01:09:51 +08:00
ifndef DYN
LDFLAGS += $(_LDFLAGS)
LIBS += $(_LIBS)
endif
2002-09-07 06:05:36 +08:00
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
### Common rules
OBJ_DIR := $(TRIPLET)
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
ifneq ($(findstring /sh,$(SHELL)),)
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
DEL = rm -f $1
COPY = -cp -afv $1 $2
MKDIR = mkdir -p $1
RMDIR = rm -fr $1
WHICH = $(SHELL) -c "command -v $1"
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
else
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
DEL = -del 2>NUL /q /f $(subst /,\,$1)
COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
MKDIR = -md 2>NUL $(subst /,\,$1)
RMDIR = -rd 2>NUL /q /s $(subst /,\,$1)
WHICH = where $1
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
endif
2007-08-03 22:30:02 +08:00
Makefile.m32: deduplicate build rules [ci skip] After this patch, we reduce the three copies of most `Makefile.m32` logic to one. This now resides in `lib/Makefile.m32`. It makes future updates easier, the code shorter, with a small amount of added complexity. `Makefile.m32` reduction: | | bytes | LOC total | blank | comment | code | |-------------------|-------:|----------:|-------:|---------:|------:| | 7.85.0 | 34772 | 1337 | 79 | 192 | 1066 | | before this patch | 17601 | 625 | 62 | 106 | 457 | | after this patch | 11680 | 392 | 52 | 104 | 236 | Details: - Change rules to create objects for the `v*` subdirs in the `lib` dir. This allows to use a shared compile rule and assumes that filenames are not (and will not be) colliding across these directories. `Makefile.m32` now also stores a list of these subdirs. They are changing rarely though. - Sync as much as possible between the three `Makefile.m32` scripts' rules and their source/target sections. - After this patch `CPPFLAGS` are all applied to the `src` sources once again. This matches the behaviour of cmake/autotools. Only zlib ones are actually required there. - Use `.rc` names from `Makefile.inc` instead of keeping a duplicate. - Change examples to link `libcurl.dll` by default. This makes building trivial, even as a cross-build: `CC=x86_64-w64-mingw32-gcc make -f Makefile.m32` To run them, you need to move/copy or add-to-path `libcurl.dll`. You can select static mode via `CFG=-static`. - List more of the `Makefile.m32` config variables. - Drop `.rc` support from examples. It made it fragile without much benefit. - Include a necessary system lib for the `externalsocket.c` example. - Exclude unnecessary systems libs when building in `-dyn` mode. Closes #9642
2022-10-05 01:09:51 +08:00
all: $(TARGETS)
2002-09-07 06:05:36 +08:00
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
$(OBJ_DIR):
-$(call MKDIR, $(OBJ_DIR))
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
$(OBJ_DIR)/%.o: %.c
$(CC) -W -Wall $(CFLAGS) $(CPPFLAGS) -c $< -o $@
2002-09-07 06:05:36 +08:00
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
$(OBJ_DIR)/%.res: %.rc
Makefile.m32: major rework [ci skip] This patch overhauls `Makefile.m32` scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain. Details: - Rename customization envvars: `CURL_CC` -> `CC` `CURL_RC` -> `RC` `CURL_AR` -> `AR` `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB` `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN` - Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used. - Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars. - Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in favor of the above. - Do not automatically enable `zlib` with `libssh2`. `zlib` is optional with `libssh2`. - Omit unnecessary `CPPFLAGS` options when building `curl.exe` and examples. - Drop support for deprecated `-winssl` `CFG` option. Use `-schannel` instead. - Avoid late evaluation where not necessary (`=` -> `:=`). - Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix. Instead, use the standard naming scheme by default: `libcurl.dll.a`. The toolchain recognizes the name, and selects it automatically when asking for a `-shared` vs. `-static` build. - Stop applying `strip` to `libcurl.a`. Follow-up from 16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to strip since then. - Stop setting `-O3`, `-W`, `-Wall` options. You can add these to `CFLAGS` as desired. - Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL, to avoid that vulnerability on Windows. - Add `-lbrotlicommon` to `LIBS` when using `brotli`. - Do not enable `-nghttp3` without `-ngtcp2`. - `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend. You need to set the backend explicitly. This scales better and avoids issues with certain combinations (e.g. `libssh2` + `wolfssl` with no `schannel`). - Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via `NGTCP2_LIBS`. - Old, alternate method of enabling components (e.g. `SSH2=1`) no longer supported. - Delete `SPNEGO` references. They were no-ops. - Drop support for Win9x environments. - Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`. - Support autotools/CMake `libssh2` builds by default. - Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and examples. - Assume standard directory layout with `LIBCARES_PATH`. (Instead of the long gone embedded one.) - Stop static linking with c-ares by default. Add `CPPFLAGS=-DCARES_STATICLIB` to enable it. - Reorganize internal layout to avoid redundancy and emit clean diffs between src/lib and example make files. - Delete unused variables. - Code cleanups/rework. - Comment and indentation fixes. Closes #9632
2022-10-04 03:46:56 +08:00
$(RC) -O coff $(RCFLAGS) -i $< -o $@
2002-09-07 06:05:36 +08:00
clean:
Makefile.m32: deduplicate build rules [ci skip] After this patch, we reduce the three copies of most `Makefile.m32` logic to one. This now resides in `lib/Makefile.m32`. It makes future updates easier, the code shorter, with a small amount of added complexity. `Makefile.m32` reduction: | | bytes | LOC total | blank | comment | code | |-------------------|-------:|----------:|-------:|---------:|------:| | 7.85.0 | 34772 | 1337 | 79 | 192 | 1066 | | before this patch | 17601 | 625 | 62 | 106 | 457 | | after this patch | 11680 | 392 | 52 | 104 | 236 | Details: - Change rules to create objects for the `v*` subdirs in the `lib` dir. This allows to use a shared compile rule and assumes that filenames are not (and will not be) colliding across these directories. `Makefile.m32` now also stores a list of these subdirs. They are changing rarely though. - Sync as much as possible between the three `Makefile.m32` scripts' rules and their source/target sections. - After this patch `CPPFLAGS` are all applied to the `src` sources once again. This matches the behaviour of cmake/autotools. Only zlib ones are actually required there. - Use `.rc` names from `Makefile.inc` instead of keeping a duplicate. - Change examples to link `libcurl.dll` by default. This makes building trivial, even as a cross-build: `CC=x86_64-w64-mingw32-gcc make -f Makefile.m32` To run them, you need to move/copy or add-to-path `libcurl.dll`. You can select static mode via `CFG=-static`. - List more of the `Makefile.m32` config variables. - Drop `.rc` support from examples. It made it fragile without much benefit. - Include a necessary system lib for the `externalsocket.c` example. - Exclude unnecessary systems libs when building in `-dyn` mode. Closes #9642
2022-10-05 01:09:51 +08:00
@$(call DEL, $(TOCLEAN))
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
@$(RMDIR) $(OBJ_DIR)
2002-09-07 06:05:36 +08:00
distclean vclean: clean
Makefile.m32: deduplicate build rules [ci skip] After this patch, we reduce the three copies of most `Makefile.m32` logic to one. This now resides in `lib/Makefile.m32`. It makes future updates easier, the code shorter, with a small amount of added complexity. `Makefile.m32` reduction: | | bytes | LOC total | blank | comment | code | |-------------------|-------:|----------:|-------:|---------:|------:| | 7.85.0 | 34772 | 1337 | 79 | 192 | 1066 | | before this patch | 17601 | 625 | 62 | 106 | 457 | | after this patch | 11680 | 392 | 52 | 104 | 236 | Details: - Change rules to create objects for the `v*` subdirs in the `lib` dir. This allows to use a shared compile rule and assumes that filenames are not (and will not be) colliding across these directories. `Makefile.m32` now also stores a list of these subdirs. They are changing rarely though. - Sync as much as possible between the three `Makefile.m32` scripts' rules and their source/target sections. - After this patch `CPPFLAGS` are all applied to the `src` sources once again. This matches the behaviour of cmake/autotools. Only zlib ones are actually required there. - Use `.rc` names from `Makefile.inc` instead of keeping a duplicate. - Change examples to link `libcurl.dll` by default. This makes building trivial, even as a cross-build: `CC=x86_64-w64-mingw32-gcc make -f Makefile.m32` To run them, you need to move/copy or add-to-path `libcurl.dll`. You can select static mode via `CFG=-static`. - List more of the `Makefile.m32` config variables. - Drop `.rc` support from examples. It made it fragile without much benefit. - Include a necessary system lib for the `externalsocket.c` example. - Exclude unnecessary systems libs when building in `-dyn` mode. Closes #9642
2022-10-05 01:09:51 +08:00
@$(call DEL, $(TARGETS) $(TOVCLEAN))
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
### Local
ifdef LOCAL
CPPFLAGS += -DBUILDING_LIBCURL
### Sources and targets
# Provides CSOURCES, HHEADERS, LIB_RCFILES
include Makefile.inc
vpath %.c vauth vquic vssh vtls
libcurl_a_LIBRARY := libcurl.a
ifdef WIN32
CURL_DLL_SUFFIX ?=
Makefile.mk: portable Makefile.m32 Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764
2022-11-22 16:25:05 +08:00
libcurl_dll_LIBRARY := libcurl$(CURL_DLL_SUFFIX).dll
libcurl_dll_a_LIBRARY := libcurl.dll.a
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)
libcurl_a_OBJECTS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(notdir $(strip $(CSOURCES))))
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)
TOVCLEAN := $(libcurl_dll_LIBRARY:.dll=.def) $(libcurl_dll_a_LIBRARY) $(libcurl_map_LIBRARY)
### Rules
$(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
@$(call DEL, $@)
$(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)
endif