From a8861b6ccdd7ca35b6115588a578e36d765c9e38 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 22 Nov 2022 08:25:05 +0000 Subject: [PATCH] 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 --- .github/scripts/spellcheck.words | 2 + Makefile.dist | 34 +-- docs/INSTALL.md | 28 ++- docs/examples/Makefile.am | 4 +- docs/examples/{Makefile.m32 => Makefile.mk} | 50 ++-- docs/examples/makefile.dj | 57 ----- lib/Makefile.am | 6 +- lib/{Makefile.m32 => Makefile.mk} | 238 +++++++++++++------- lib/config-amigaos.h | 2 + lib/config-dos.h | 8 +- lib/config-mac.h | 2 + lib/config-os400.h | 2 + lib/config-plan9.h | 2 + lib/config-riscos.h | 2 + lib/config-win32.h | 2 +- lib/config-win32ce.h | 3 +- lib/curl_setup.h | 4 + lib/makefile.amiga | 44 ---- lib/makefile.dj | 73 ------ packages/DOS/README | 17 -- packages/DOS/common.dj | 223 ------------------ src/Makefile.am | 4 +- src/{Makefile.m32 => Makefile.mk} | 81 +++++-- src/makefile.amiga | 52 ----- src/makefile.dj | 101 --------- 25 files changed, 326 insertions(+), 715 deletions(-) rename docs/examples/{Makefile.m32 => Makefile.mk} (70%) delete mode 100644 docs/examples/makefile.dj rename lib/{Makefile.m32 => Makefile.mk} (71%) delete mode 100644 lib/makefile.amiga delete mode 100644 lib/makefile.dj delete mode 100644 packages/DOS/README delete mode 100644 packages/DOS/common.dj rename src/{Makefile.m32 => Makefile.mk} (60%) delete mode 100644 src/makefile.amiga delete mode 100644 src/makefile.dj diff --git a/.github/scripts/spellcheck.words b/.github/scripts/spellcheck.words index 73b65d46f6..9f3906b800 100644 --- a/.github/scripts/spellcheck.words +++ b/.github/scripts/spellcheck.words @@ -160,6 +160,7 @@ dir distro distro's distros +DJGPP dlist DLL dll @@ -226,6 +227,7 @@ FreeDOS FreeRTOS freshmeat Frexx +FS fseek FTPing fuzzer diff --git a/Makefile.dist b/Makefile.dist index ab5a9b5f31..dbb396553c 100644 --- a/Makefile.dist +++ b/Makefile.dist @@ -31,25 +31,25 @@ ssl: make mingw32: - $(MAKE) -C lib -f Makefile.m32 - $(MAKE) -C src -f Makefile.m32 + $(MAKE) -C lib -f Makefile.mk + $(MAKE) -C src -f Makefile.mk mingw32-clean: - $(MAKE) -C lib -f Makefile.m32 clean - $(MAKE) -C src -f Makefile.m32 clean - $(MAKE) -C docs/examples -f Makefile.m32 clean + $(MAKE) -C lib -f Makefile.mk clean + $(MAKE) -C src -f Makefile.mk clean + $(MAKE) -C docs/examples -f Makefile.mk clean mingw32-vclean mingw32-distclean: - $(MAKE) -C lib -f Makefile.m32 vclean - $(MAKE) -C src -f Makefile.m32 vclean - $(MAKE) -C docs/examples -f Makefile.m32 vclean + $(MAKE) -C lib -f Makefile.mk vclean + $(MAKE) -C src -f Makefile.mk vclean + $(MAKE) -C docs/examples -f Makefile.mk vclean mingw32-examples%: - $(MAKE) -C docs/examples -f Makefile.m32 CFG=$@ + $(MAKE) -C docs/examples -f Makefile.mk CFG=$@ mingw32%: - $(MAKE) -C lib -f Makefile.m32 CFG=$@ - $(MAKE) -C src -f Makefile.m32 CFG=$@ + $(MAKE) -C lib -f Makefile.mk CFG=$@ + $(MAKE) -C src -f Makefile.mk CFG=$@ vc: cd winbuild @@ -59,9 +59,9 @@ vc-x64: cd winbuild nmake /f Makefile.vc MACHINE=x64 -djgpp: - $(MAKE) -C lib -f Makefile.dj - $(MAKE) -C src -f Makefile.dj +djgpp%: + $(MAKE) -C lib -f Makefile.mk CFG=$@ CROSSPREFIX=i586-pc-msdosdjgpp- + $(MAKE) -C src -f Makefile.mk CFG=$@ CROSSPREFIX=i586-pc-msdosdjgpp- cygwin: ./configure @@ -71,9 +71,9 @@ cygwin-ssl: ./configure --with-openssl make -amiga: - cd ./lib && make -f makefile.amiga - cd ./src && make -f makefile.amiga +amiga%: + $(MAKE) -C lib -f Makefile.mk CFG=$@ CROSSPREFIX=m68k-amigaos- + $(MAKE) -C src -f Makefile.mk CFG=$@ CROSSPREFIX=m68k-amigaos- unix: all diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 73076611f5..7ad748dcfe 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -182,7 +182,7 @@ make targets available to build libcurl with more features, use: and SSPI support. If you have any problems linking libraries or finding header files, be sure -to verify that the provided `Makefile.m32` files use the proper paths, and +to verify that the provided `Makefile.mk` files use the proper paths, and adjust as necessary. It is also possible to override these paths with environment variables, for example: @@ -210,7 +210,7 @@ set LDFLAGS=-Lc:/openldapsdk/lib/mscvc set LIBS=-lldapsdk -lldapssl -lldapx ``` -If you want to enable LDAPS support then set LDAPS=1. +If you want to enable LDAPS support then append `-ldaps` to the make target. ## Cygwin @@ -220,6 +220,30 @@ executable in `/bin/` or you will see the configure fail toward the end. Run `make` +## MS-DOS + +Requires DJGPP in the search path and pointing to the Watt-32 stack via +`WATT_PATH=c:/djgpp/net/watt`. + +Run `make -f Makefile.dist djgpp` in the root curl dir. + +For build configuration options, please see the MinGW32 section. + +Notes: + + - DJGPP 2.04 beta has a `sscanf()` bug so the URL parsing is not done + properly. Use DJGPP 2.03 until they fix it. + + - Compile Watt-32 (and OpenSSL) with the same version of DJGPP. Otherwise + things go wrong because things like FS-extensions and `errno` values have + been changed between releases. + +## AmigaOS + +Run `make -f Makefile.dist amiga` in the root curl dir. + +For build configuration options, please see the MinGW32 section. + ## Disabling Specific Protocols in Windows builds The configure utility, unfortunately, is not available for the Windows diff --git a/docs/examples/Makefile.am b/docs/examples/Makefile.am index 614e8f3e2f..81eb95bc68 100644 --- a/docs/examples/Makefile.am +++ b/docs/examples/Makefile.am @@ -24,8 +24,8 @@ AUTOMAKE_OPTIONS = foreign nostdinc -EXTRA_DIST = README.md Makefile.example Makefile.inc Makefile.m32 \ - makefile.dj $(COMPLICATED_EXAMPLES) .checksrc +EXTRA_DIST = README.md Makefile.example Makefile.inc Makefile.mk \ + $(COMPLICATED_EXAMPLES) .checksrc # Specify our include paths here, and do it relative to $(top_srcdir) and # $(top_builddir), to ensure that these paths which belong to the library diff --git a/docs/examples/Makefile.m32 b/docs/examples/Makefile.mk similarity index 70% rename from docs/examples/Makefile.m32 rename to docs/examples/Makefile.mk index 0766082162..c5687119fe 100644 --- a/docs/examples/Makefile.m32 +++ b/docs/examples/Makefile.mk @@ -22,37 +22,53 @@ # #*************************************************************************** -# Build libcurl via lib/Makefile.m32 first. +# Build libcurl via lib/Makefile.mk first. PROOT := ../.. -LDFLAGS += -L$(PROOT)/lib -LIBS += -lcurl - ifeq ($(findstring -static,$(CFG)),) - curl_DEPENDENCIES += $(PROOT)/lib/libcurl.dll.a DYN := 1 -else - curl_DEPENDENCIES := $(PROOT)/lib/libcurl.a - CPPFLAGS += -DCURL_STATICLIB - LDFLAGS += -static endif -LIBS += -lws2_32 +### Common + +include $(PROOT)/lib/Makefile.mk + +### Local + +CPPFLAGS += -DCURL_NO_OLDIES +LDFLAGS += -L$(PROOT)/lib +LIBS := -lcurl $(LIBS) + +ifdef DYN + curl_DEPENDENCIES += $(PROOT)/lib/libcurl.dll.a +else + curl_DEPENDENCIES := $(PROOT)/lib/libcurl.a + ifdef WIN32 + CPPFLAGS += -DCURL_STATICLIB + LDFLAGS += -static + endif +endif + +ifdef WIN32 + LIBS += -lws2_32 +endif ### Sources and targets # Provides check_PROGRAMS include Makefile.inc -TARGETS := $(patsubst %,%.exe,$(strip $(check_PROGRAMS) synctime)) -TOCLEAN := $(TARGETS:.exe=.o) +ifdef WIN32 +check_PROGRAMS += synctime +endif -### Local rules +TARGETS := $(patsubst %,%$(BIN_EXT),$(strip $(check_PROGRAMS))) +TOCLEAN := $(TARGETS) -%.exe: %.o $(curl_DEPENDENCIES) - $(CC) $(LDFLAGS) $(CURL_LDFLAGS_BIN) -o $@ $< $(LIBS) +### Rules -### Global script +%$(BIN_EXT): %.c $(curl_DEPENDENCIES) + $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(CURL_LDFLAGS_BIN) $< -o $@ $(LIBS) -include $(PROOT)/lib/Makefile.m32 +all: $(TARGETS) diff --git a/docs/examples/makefile.dj b/docs/examples/makefile.dj deleted file mode 100644 index 9f0de66901..0000000000 --- a/docs/examples/makefile.dj +++ /dev/null @@ -1,57 +0,0 @@ -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# 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 -# -########################################################################### - -TOPDIR = ../.. - -include $(TOPDIR)/packages/DOS/common.dj - -CFLAGS += -DFALSE=0 -DTRUE=1 - -LIBS = $(TOPDIR)/lib/libcurl.a - -ifeq ($(USE_SSL),1) - LIBS += $(OPENSSL_ROOT)/lib/libssl.a $(OPENSSL_ROOT)/lib/libcrypt.a -endif - -ifeq ($(USE_IDNA),1) - LIBS += $(LIBIDN_ROOT)/lib/dj_obj/libidn.a -liconv -endif - -LIBS += $(WATT32_ROOT)/lib/libwatt.a $(ZLIB_ROOT)/libz.a - -include Makefile.inc - -PROGRAMS = $(patsubst %,%.exe,$(check_PROGRAMS)) - -all: $(PROGRAMS) - @echo Welcome to libcurl example program - -%.exe: %.c - $(CC) $(CFLAGS) -o $@ $^ $(LIBS) - @echo - -clean vclean realclean: - - rm -f $(PROGRAMS) depend.dj - --include depend.dj diff --git a/lib/Makefile.am b/lib/Makefile.am index 3b4f742387..e74ce1f0db 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -25,9 +25,9 @@ AUTOMAKE_OPTIONS = foreign nostdinc CMAKE_DIST = CMakeLists.txt curl_config.h.cmake -EXTRA_DIST = Makefile.m32 config-win32.h config-win32ce.h config-plan9.h \ - config-riscos.h config-mac.h curl_config.h.in makefile.dj config-dos.h \ - libcurl.plist libcurl.rc config-amigaos.h makefile.amiga config-win32ce.h \ +EXTRA_DIST = Makefile.mk config-win32.h config-win32ce.h config-plan9.h \ + config-riscos.h config-mac.h curl_config.h.in config-dos.h \ + libcurl.plist libcurl.rc config-amigaos.h config-win32ce.h \ config-os400.h setup-os400.h $(CMAKE_DIST) setup-win32.h .checksrc lib_LTLIBRARIES = libcurl.la diff --git a/lib/Makefile.m32 b/lib/Makefile.mk similarity index 71% rename from lib/Makefile.m32 rename to lib/Makefile.mk index 998d467985..3732634365 100644 --- a/lib/Makefile.m32 +++ b/lib/Makefile.mk @@ -22,89 +22,96 @@ # #*************************************************************************** -# Makefile for building curl parts with MinGW and optional features. +# Makefile to build curl parts with GCC-like toolchains and optional features. # -# Usage: mingw32-make -f Makefile.m32 CFG=-feature1[-feature2][-feature3][...] -# Example: mingw32-make -f Makefile.m32 CFG=-zlib-ssl-sspi-winidn +# Usage: [mingw32-]make -f Makefile.mk CFG=-feat1[-feat2][-feat3][...] +# Example: [mingw32-]make -f Makefile.mk CFG=-zlib-ssl-libssh2-ipv6 # # Set component roots via envvar _PATH. Also available for -# customization: CC, RC, AR, CPPFLAGS, LDFLAGS, LIBS, CFLAGS, RCFLAGS, -# ARCH[=custom], CROSSPREFIX, CURL_LDFLAGS_BIN, CURL_LDFLAGS_LIB, CURL_DLL_SUFFIX, +# customization: CC, AR, RC, CPPFLAGS, LDFLAGS, LIBS, CFLAGS, RCFLAGS, +# TRIPLET, CROSSPREFIX, CURL_LDFLAGS_BIN, CURL_LDFLAGS_LIB, CURL_DLL_SUFFIX, # and more for individual components (see below). -# This script is reused by 'src' and 'docs/examples' Makefile.m32 scripts. -# Skip lib-specific parts when called through them. +# This script is reused by 'src' and 'docs/examples' Makefile.mk scripts. + ifndef PROOT -PROOT := .. + PROOT := .. + LOCAL := 1 +endif -CPPFLAGS += -DBUILDING_LIBCURL +### Common -### Sources and targets +ifeq ($(CC),cc) + CC := gcc +endif +CC := $(CROSSPREFIX)$(CC) +AR := $(CROSSPREFIX)$(AR) +RC ?= $(CROSSPREFIX)windres -# Provides CSOURCES, HHEADERS, LIB_RCFILES -include Makefile.inc +# For compatibility +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 -libcurl_dll_LIBRARY := libcurl$(CURL_DLL_SUFFIX).dll -libcurl_dll_a_LIBRARY := libcurl.dll.a -libcurl_a_LIBRARY := libcurl.a +BIN_EXT := .exe -TARGETS := $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) - -libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(notdir $(strip $(CSOURCES)))) -libcurl_a_DEPENDENCIES := $(strip $(CSOURCES) $(HHEADERS)) -libcurl_dll_OBJECTS := $(libcurl_a_OBJECTS) -libcurl_dll_OBJECTS += $(patsubst %.rc,%.res,$(strip $(LIB_RCFILES))) -vpath %.c vauth vquic vssh vtls - -TOCLEAN := $(libcurl_dll_OBJECTS) -TOVCLEAN := $(libcurl_dll_LIBRARY:.dll=.def) $(libcurl_dll_a_LIBRARY) - -### Local rules - -# Keep this at the top to act as the default target. -all: $(TARGETS) - -$(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) +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 endif CPPFLAGS += -I. -I$(PROOT)/include RCFLAGS += -I$(PROOT)/include -CC := $(CROSSPREFIX)$(CC) -AR := $(CROSSPREFIX)$(AR) -RC ?= $(CROSSPREFIX)windres +ifndef WIN32 + DYN := +endif -ifneq ($(ARCH),custom) - # Set environment var ARCH to your architecture to override auto-detection. - ifndef ARCH - ifneq ($(findstring x86_64,$(shell $(CC) -dumpmachine)),) - ARCH := w64 - else - ARCH := w32 - endif - endif - ifeq ($(ARCH),w64) - CFLAGS += -m64 - LDFLAGS += -m64 - RCFLAGS += --target=pe-x86-64 - else - CFLAGS += -m32 - LDFLAGS += -m32 - RCFLAGS += --target=pe-i386 - endif +ifdef AMIGA + BIN_EXT := +endif + +### Deprecated settings. For compatibility. + +ifdef WATT_ROOT + WATT_PATH := $(realpath $(WATT_ROOT)) endif ### Optional features -ifneq ($(findstring -unicode,$(CFG)),) - CPPFLAGS += -DUNICODE -D_UNICODE - CURL_LDFLAGS_BIN += -municode +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 @@ -139,7 +146,9 @@ ifneq ($(findstring -ssh2,$(CFG)),) CPPFLAGS += -DUSE_LIBSSH2 CPPFLAGS += -I"$(LIBSSH2_PATH)/include" _LDFLAGS += -L"$(LIBSSH2_PATH)/lib" - _LDFLAGS += -L"$(LIBSSH2_PATH)/win32" + ifdef WIN32 + _LDFLAGS += -L"$(LIBSSH2_PATH)/win32" + endif _LIBS += -lssh2 else ifneq ($(findstring -libssh,$(CFG)),) LIBSSH_PATH ?= $(PROOT)/../libssh @@ -232,9 +241,11 @@ ifneq ($(findstring -zlib,$(CFG))$(ZLIB),) ZLIB_PATH ?= $(PROOT)/../zlib # These CPPFLAGS are also required when compiling the curl tool via 'src'. CPPFLAGS += -DHAVE_LIBZ - CPPFLAGS += -I"$(ZLIB_PATH)" - _LDFLAGS += -L"$(ZLIB_PATH)" - _LIBS += -lz + CPPFLAGS += -I"$(ZLIB_PATH)/include" + _LDFLAGS += -L"$(ZLIB_PATH)/lib" + ZLIB_LIBS ?= -lz + _LIBS += $(ZLIB_LIBS) + ZLIB := 1 endif ifneq ($(findstring -zstd,$(CFG)),) ZSTD_PATH ?= $(PROOT)/../zstd @@ -280,7 +291,9 @@ else ifneq ($(findstring -winidn,$(CFG)),) endif ifneq ($(findstring -sspi,$(CFG)),) - CPPFLAGS += -DUSE_WINDOWS_SSPI + ifdef WIN32 + CPPFLAGS += -DUSE_WINDOWS_SSPI + endif endif ifneq ($(findstring -ipv6,$(CFG)),) CPPFLAGS += -DENABLE_IPV6 @@ -289,10 +302,19 @@ ifneq ($(findstring -ldaps,$(CFG)),) CPPFLAGS += -DHAVE_LDAP_SSL endif -ifeq ($(findstring -lldap,$(LIBS)),) - _LIBS += -lwldap32 +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 -_LIBS += -lws2_32 -lcrypt32 -lbcrypt ifneq ($(findstring 11,$(subst $() ,,$(SSLLIBS))),) CPPFLAGS += -DCURL_WITH_MULTI_SSL @@ -303,26 +325,86 @@ ifndef DYN LIBS += $(_LIBS) endif -### Global rules +### Common rules + +OBJ_DIR := $(TRIPLET) ifneq ($(findstring /sh,$(SHELL)),) -DEL = rm -f $1 -COPY = -cp -afv $1 $2 +DEL = rm -f $1 +COPY = -cp -afv $1 $2 +MKDIR = mkdir -p $1 +RMDIR = rm -fr $1 +WHICH = command -v else -DEL = -del 2>NUL /q /f $(subst /,\,$1) -COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2) +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 endif all: $(TARGETS) -%.o: %.c - $(CC) -W -Wall $(CFLAGS) $(CPPFLAGS) -c $< +$(OBJ_DIR): + -$(MKDIR) $(OBJ_DIR) -%.res: %.rc +$(OBJ_DIR)/%.o: %.c + $(CC) -W -Wall $(CFLAGS) $(CPPFLAGS) -c $< -o $@ + +$(OBJ_DIR)/%.res: %.rc $(RC) -O coff $(RCFLAGS) -i $< -o $@ clean: @$(call DEL, $(TOCLEAN)) + @$(RMDIR) $(OBJ_DIR) distclean vclean: clean @$(call DEL, $(TARGETS) $(TOVCLEAN)) + +### 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 +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 diff --git a/lib/config-amigaos.h b/lib/config-amigaos.h index b7356c7629..20ea27df7a 100644 --- a/lib/config-amigaos.h +++ b/lib/config-amigaos.h @@ -78,7 +78,9 @@ #define USE_MANUAL 1 #define CURL_DISABLE_LDAP 1 +#ifndef OS #define OS "AmigaOS" +#endif #define PACKAGE "curl" #define PACKAGE_BUGREPORT "a suitable mailing list: https://curl.se/mail/" diff --git a/lib/config-dos.h b/lib/config-dos.h index 34e8c5f516..6532637e90 100644 --- a/lib/config-dos.h +++ b/lib/config-dos.h @@ -29,6 +29,7 @@ /* lib/config-dos.h - Hand crafted config file for DOS */ /* ================================================================ */ +#ifndef OS #if defined(DJGPP) #define OS "MSDOS/djgpp" #elif defined(__HIGHC__) @@ -36,9 +37,12 @@ #else #define OS "MSDOS/?" #endif +#endif #define PACKAGE "curl" +#define USE_MANUAL 1 + #define HAVE_ARPA_INET_H 1 #define HAVE_ASSERT_H 1 #define HAVE_ERRNO_H 1 @@ -104,10 +108,6 @@ /* CURLDEBUG definition enables memory tracking */ /* #define CURLDEBUG */ -#ifdef USE_ZLIB /* Deprecated. Use HAVE_LIBZ instead. */ - #define HAVE_LIBZ 1 -#endif - /* to disable LDAP */ #define CURL_DISABLE_LDAP 1 diff --git a/lib/config-mac.h b/lib/config-mac.h index ed07019e6b..2b36a5304b 100644 --- a/lib/config-mac.h +++ b/lib/config-mac.h @@ -30,7 +30,9 @@ /* On Mac OS X you must run configure to generate curl_config.h file */ /* =================================================================== */ +#ifndef OS #define OS "mac" +#endif /* Define if you want the built-in manual */ #define USE_MANUAL 1 diff --git a/lib/config-os400.h b/lib/config-os400.h index 2eef1a0c1b..e733e36e3f 100644 --- a/lib/config-os400.h +++ b/lib/config-os400.h @@ -36,7 +36,9 @@ #undef VERSION /* Define cpu-machine-OS */ +#ifndef OS #define OS "OS/400" +#endif /* OS400 supports a 3-argument ASCII version of gethostbyaddr_r(), but its * prototype is incompatible with the "standard" one (1st argument is not diff --git a/lib/config-plan9.h b/lib/config-plan9.h index 49a719c1aa..c0a78f71e6 100644 --- a/lib/config-plan9.h +++ b/lib/config-plan9.h @@ -32,7 +32,9 @@ #define CURL_DISABLE_LDAP 1 #define NEED_REENTRANT 1 +#ifndef OS #define OS "plan9" +#endif #define PACKAGE "curl" #define PACKAGE_NAME "curl" #define PACKAGE_BUGREPORT "a suitable mailing list: https://curl.se/mail/" diff --git a/lib/config-riscos.h b/lib/config-riscos.h index d6c81f3eb9..349fd8caca 100644 --- a/lib/config-riscos.h +++ b/lib/config-riscos.h @@ -35,7 +35,9 @@ #undef VERSION /* Define cpu-machine-OS */ +#ifndef OS #define OS "ARM-RISC OS" +#endif /* Define if you want the built-in manual */ #define USE_MANUAL diff --git a/lib/config-win32.h b/lib/config-win32.h index fb10f7e945..79ac15c65f 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -635,7 +635,7 @@ Vista /* ---------------------------------------------------------------- */ /* Define cpu-machine-OS */ -#if !defined(OS) +#ifndef OS #if defined(_M_IX86) || defined(__i386__) /* x86 (MSVC or gcc) */ #define OS "i386-pc-win32" #elif defined(_M_X64) || defined(__x86_64__) /* x86_64 (MSVC >=2005 or gcc) */ diff --git a/lib/config-win32ce.h b/lib/config-win32ce.h index e702a0c32e..29661ed23f 100644 --- a/lib/config-win32ce.h +++ b/lib/config-win32ce.h @@ -302,8 +302,9 @@ /* ---------------------------------------------------------------- */ /* Define cpu-machine-OS */ -#undef OS +#ifndef OS #define OS "i386-pc-win32ce" +#endif /* Name of package */ #define PACKAGE "curl" diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 59efe4d4f5..6612eb4b6b 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -112,6 +112,10 @@ # include "config-plan9.h" #endif +#ifdef MSDOS +# include "config-dos.h" +#endif + #endif /* HAVE_CONFIG_H */ /* ================================================================ */ diff --git a/lib/makefile.amiga b/lib/makefile.amiga deleted file mode 100644 index d5c8fe615e..0000000000 --- a/lib/makefile.amiga +++ /dev/null @@ -1,44 +0,0 @@ -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# 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 -# -########################################################################### -# -# libcurl Makefile for AmigaOS ... -# - -# change the follow to where you have the AmiTCP SDK v4.3 includes: - -ATCPSDKI= /GG/netinclude - - -CC = m68k-amigaos-gcc -CFLAGS = -I$(ATCPSDKI) -m68020-60 -O2 -msoft-float -noixemul -g -I. -I../include -W -Wall -DUSE_OPENSSL -DHAVE_LIBZ - -include Makefile.inc -OBJS = $(CSOURCES:.c=.o) - -all: $(OBJS) - ar cru libcurl.a $(OBJS) - ranlib libcurl.a - -install: - $(INSTALL) -c ./libcurl.a /lib/libcurl.a diff --git a/lib/makefile.dj b/lib/makefile.dj deleted file mode 100644 index bb95f2bbfd..0000000000 --- a/lib/makefile.dj +++ /dev/null @@ -1,73 +0,0 @@ -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 2003 - 2022, Gisle Vanem . -# Copyright (C) 2003 - 2020, Daniel Stenberg, , et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# 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 -# -#*************************************************************************** - -# -# Adapted for djgpp2 / Watt-32 / DOS -# - -DEPEND_PREREQ = curl_config.h -VPATH = vtls vauth vquic vssh -TOPDIR = .. - -include ../packages/DOS/common.dj -include Makefile.inc - -CFLAGS += -DBUILDING_LIBCURL - -SOURCES = $(sort $(CSOURCES)) -OBJECTS = $(addprefix $(OBJ_DIR)/, $(notdir $(SOURCES:.c=.o))) - -CURL_LIB = libcurl.a - -all: $(OBJ_DIR) curl_config.h $(CURL_LIB) - -$(CURL_LIB): $(OBJECTS) - ar rs $@ $? - -curl_config.h: config-dos.h - $(COPY) $^ $@ - -# clean generated files -# -genclean: - - $(DELETE) curl_config.h - -# clean object files and subdir -# -objclean: genclean - - $(DELETE) $(OBJ_DIR)$(DS)*.o - - $(RMDIR) $(OBJ_DIR) - -# clean without removing built library -# -clean: objclean - - $(DELETE) depend.dj - -# clean everything -# -realclean vclean: clean - - $(DELETE) $(CURL_LIB) - --include depend.dj diff --git a/packages/DOS/README b/packages/DOS/README deleted file mode 100644 index 8336efa412..0000000000 --- a/packages/DOS/README +++ /dev/null @@ -1,17 +0,0 @@ -Gisle Vanem made curl build fine on DOS (and MinGW) with djgpp, OpenSSL and his -Watt-32 stack. - -'make -f Makefile.dist djgpp' in the root curl dir should build it fine. -Or enter 'lib' and do a 'make -f Makefile.dj clean all' to first delete -'lib/curl_config.h' which is possibly from a previous incompatible Windows-build. - -Note 1: djgpp 2.04 beta has a sscanf() bug so the URL parsing isn't - done properly. Use djgpp 2.03 until they fix it. - -Note 2: Compile Watt-32 (and OpenSSL) with the same version of djgpp. - Otherwise things go wrong because things like FS-extensions and - errnos have been changed between releases. - -Note 3: Several 'USE_x' variables in 'common.dj' are on the 'USE_x ?= 0' - form (conditional variable assignment). So one can build like this: - c:\curl\lib> make -f makefile.dj USE_OPENSSL=1 USE_ZLIB=1 clean all diff --git a/packages/DOS/common.dj b/packages/DOS/common.dj deleted file mode 100644 index b181e82157..0000000000 --- a/packages/DOS/common.dj +++ /dev/null @@ -1,223 +0,0 @@ -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# 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 -# -########################################################################### -# -# Common defines for curl (djgpp/Watt-32) -# -# Assumes you've unpacked curl with long-file names -# I.e use "set LFN=y" before untaring on Win9x/XP. -# Requires sed, rm and the usual stuff. -# -# Define TOPDIR before including this file. - -MAKEFILE = Makefile.dj -OBJ_DIR = djgpp - -# -# Find out if using a Unix-like shell or a DOS command interpreter -# -ifneq ($(findstring COMMAND.COM,$(SHELL)),COMMAND.COM) - ifneq ($(findstring CMD.EXE,$(SHELL)),CMD.EXE) - ifneq ($(findstring 4DOS.COM,$(SHELL)),4DOS.COM) - IS_UNIX_SHELL = 1 - endif - endif -endif - -# -# Define shell dependent commands and vars -# -ifeq ($(IS_UNIX_SHELL),1) - COPY = cp -f - DELETE = rm -f - MKDIR = mkdir - RMDIR = rm -f -r - DS = / -else - COPY = copy - DELETE = del - MKDIR = mkdir - RMDIR = rmdir - DS = \$(NOTHING) -endif - -ifeq ($(OS),Windows_NT) - # - # Windows hosted djgpp cross compiler. Get it from: - # https://github.com/andrewwutw/build-djgpp/releases - # - DJ_PREFIX ?= c:/some-path/djgpp/bin/i586-pc-msdosdjgpp- - CC = $(DJ_PREFIX)gcc - -else - # - # The normal djgpp 'gcc' for MSDOS. - # - CC = gcc -endif - -# -# OpenSSL is available from www.openssl.org and builds okay -# with djgpp/Watt-32. Set to 0 if you don't need https URLs -# (reduces curl.exe with approx 700 kB) -# -USE_OPENSSL ?= 0 - -# -# Use zlib for contents encoding. Needed for 'USE_OPENSSL=1' too. -# -USE_ZLIB ?= 0 - -# -# Use libidn for international domain names -# -USE_IDNA ?= 0 - -# -# Use Watt-32 IPv6 stack (only IPv6 name resolution working at the moment) -# -USE_IPV6 ?= 0 - -# -# Use C-Ares resolver library -# -USE_ARES ?= 0 - -# -# Enable debug code in libcurl/curl -# -USE_DEBUG ?= 0 - -# -# Enable memory tracking code in libcurl/curl -# -USE_CURLDEBUG ?= 0 - -# -# Generate a .map file in 'link_EXE' macro -# -MAKE_MAP_FILE ?= 0 - -default: all - -# -# Root directory for Waterloo tcp/ip etc. Change to suite. -# WATT_ROOT should be set during Watt-32 install. -# -WATT32_ROOT = $(realpath $(WATT_ROOT)) -OPENSSL_ROOT ?= $(TOPDIR)/../crypto/OpenSSL -ZLIB_ROOT ?= e:/djgpp/contrib/zlib -LIBIDN_ROOT ?= $(TOPDIR)/../IDN/libidn -ARES_ROOT ?= $(TOPDIR)/../DNS/c-ares - -CFLAGS = -g -O2 -I. -I$(TOPDIR)/include -I$(TOPDIR)/lib \ - -I$(WATT32_ROOT)/inc -Wall -DHAVE_CONFIG_H - -ifeq ($(USE_OPENSSL),1) - CFLAGS += -DUSE_OPENSSL -I$(OPENSSL_ROOT)/include - - # - # Squelch the warnings on deprecated functions. - # - CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED - - # - # Use some of these too? - # - # CFLAGS += -DUSE_TLS_SRP=1 \ - # -DHAVE_ENGINE_LOAD_BUILTIN_ENGINES \ - # -DHAVE_SSLV2_CLIENT_METHOD \ - # -DOPENSSL_NO_DEPRECATED - - # - # 'libcomm.a' is normally 'libcommon.a'. But to keep it 8+3 clean, it's - # shortened to 'libcomm.a'. The official OpenSSL build was recently changed - # and this "Common" library was added for several of the Crypto Providers. - # - OPENSSL_LIBS = $(OPENSSL_ROOT)/lib/libssl.a \ - $(OPENSSL_ROOT)/lib/libcrypt.a \ - $(OPENSSL_ROOT)/lib/libcomm.a -endif - -ifeq ($(USE_ZLIB),1) - CFLAGS += -DHAVE_LIBZ -I$(ZLIB_ROOT) -endif - -ifeq ($(USE_IPV6),1) - CFLAGS += -DENABLE_IPV6 -endif - -ifeq ($(USE_ARES),1) - CFLAGS += -DUSE_ARES -I$(ARES_ROOT)/include -endif - -ifeq ($(USE_IDNA),1) - CFLAGS += -DHAVE_LIBIDN -I$(LIBIDN_ROOT)/lib -endif - -ifeq ($(USE_DEBUG),1) - CFLAGS += -DDEBUG=1 -DDEBUGBUILD -endif - -ifeq ($(USE_CURLDEBUG),1) - CFLAGS += -DCURLDEBUG -endif - -$(OBJ_DIR): - $(MKDIR) $(OBJ_DIR) - -$(OBJ_DIR)/%.o: %.c - $(CC) $(CFLAGS) -o $@ -c $< - @echo - -# -# Link-EXE macro: -# $(1): the .exe -# $(2): the .o-files and libraries -# -ifeq ($(MAKE_MAP_FILE),1) - define link_EXE - $(CC) -o $(1) $(LDFLAGS) -Wl,--print-map,--sort-common $(2) > $(1:.exe=.map) - endef -else - define link_EXE - $(CC) $(LDFLAGS) -o $(1) $(2) - endef -endif - -$(TOPDIR)/docs/curl.1: $(wildcard $(TOPDIR)/docs/cmdline-opts/*.d) - cd $(TOPDIR)/docs/cmdline-opts; \ - perl gen.pl mainpage > ../$(TOPDIR)/docs/curl.1 - -DEP_REPLACE = sed -e 's@\(.*\)\.o: @\n$$(OBJ_DIR)\/\1.o: @' \ - -e 's@$(ARES_ROOT)@$$(ARES_ROOT)@g' \ - -e 's@$(OPENSSL_ROOT)@$$(OPENSSL_ROOT)@g' \ - -e 's@$(WATT32_ROOT)@$$(WATT32_ROOT)@g' \ - -e 's@$(ZLIB_ROOT)@$$(ZLIB_ROOT)@g' - -# -# One may have to do 'make -f Makefile.dj clean' first in case -# a foreign 'curl_config.h' is making trouble. -# -depend: $(DEPEND_PREREQ) $(MAKEFILE) - $(CC) -MM $(CFLAGS) $(CSOURCES) | $(DEP_REPLACE) > depend.dj diff --git a/src/Makefile.am b/src/Makefile.am index d746d4676f..0db01575c4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -87,8 +87,8 @@ CLEANFILES = tool_hugehelp.c # embedded text. NROFF=env LC_ALL=C @NROFF@ @MANOPT@ # figured out by the configure script -EXTRA_DIST = mkhelp.pl makefile.dj \ - Makefile.m32 makefile.amiga curl.rc Makefile.inc CMakeLists.txt +EXTRA_DIST = mkhelp.pl \ + Makefile.mk curl.rc Makefile.inc CMakeLists.txt # Use absolute directory to disable VPATH MANPAGE=$(abs_top_builddir)/docs/curl.1 diff --git a/src/Makefile.m32 b/src/Makefile.mk similarity index 60% rename from src/Makefile.m32 rename to src/Makefile.mk index 096e093990..31e4d22a20 100644 --- a/src/Makefile.m32 +++ b/src/Makefile.mk @@ -22,23 +22,36 @@ # #*************************************************************************** -# See usage in lib/Makefile.m32 +# See usage in lib/Makefile.mk PROOT := .. +### Common + +include $(PROOT)/lib/Makefile.mk + +### Local + RCFLAGS += -DCURL_EMBED_MANIFEST CPPFLAGS += -I$(PROOT)/lib LDFLAGS += -L$(PROOT)/lib -LIBS += -lcurl +LIBS := -lcurl $(LIBS) -ifneq ($(findstring -dyn,$(CFG)),) +ifdef WIN32 + ifneq ($(findstring -dyn,$(CFG)),) + DYN := 1 + endif +endif + +ifdef DYN curl_DEPENDENCIES := $(PROOT)/lib/libcurl$(CURL_DLL_SUFFIX).dll curl_DEPENDENCIES += $(PROOT)/lib/libcurl.dll.a - DYN := 1 else curl_DEPENDENCIES := $(PROOT)/lib/libcurl.a - CPPFLAGS += -DCURL_STATICLIB - LDFLAGS += -static + ifdef WIN32 + CPPFLAGS += -DCURL_STATICLIB + LDFLAGS += -static + endif endif ### Sources and targets @@ -46,27 +59,53 @@ endif # Provides CURL_CFILES, CURLX_CFILES, CURL_RCFILES include Makefile.inc -TARGETS := curl.exe +TARGETS := curl$(BIN_EXT) -curl_OBJECTS := $(patsubst %.c,%.o,$(strip $(CURL_CFILES))) -curl_OBJECTS += $(patsubst %.c,%.o,$(notdir $(strip $(CURLX_CFILES)))) -curl_OBJECTS += $(patsubst %.rc,%.res,$(strip $(CURL_RCFILES))) +CURL_CFILES += $(notdir $(CURLX_CFILES)) + +curl_OBJECTS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(strip $(CURL_CFILES))) +ifdef WIN32 +curl_OBJECTS += $(patsubst %.rc,$(OBJ_DIR)/%.res,$(strip $(CURL_RCFILES))) +endif +ifdef MAP +CURL_MAP := curl.map +CURL_LDFLAGS_BIN += -Wl,-Map,$(CURL_MAP) +TOVCLEAN := $(CURL_MAP) +endif vpath %.c $(PROOT)/lib TOCLEAN := $(curl_OBJECTS) -ifneq ($(wildcard tool_hugehelp.c.cvs),) -TOCLEAN += tool_hugehelp.c -endif -### Local rules +### Rules + +ifneq ($(wildcard tool_hugehelp.c.cvs),) +PERL ?= perl +NROFF ?= groff + +TOCLEAN += tool_hugehelp.c + +ifneq ($(shell $(WHICH) $(NROFF)),) +$(PROOT)/docs/curl.1: $(wildcard $(PROOT)/docs/cmdline-opts/*.d) + cd $(PROOT)/docs/cmdline-opts && \ + $(PERL) gen.pl mainpage $(notdir $^) > ../curl.1 + +# Necessary for the generated tools_hugehelp.c +CPPFLAGS += -DUSE_MANUAL + +ifdef ZLIB +_MKHELPOPT += -c +endif +tool_hugehelp.c: $(PROOT)/docs/curl.1 mkhelp.pl + $(NROFF) -man -Tascii $(MANOPT) $< | \ + $(PERL) mkhelp.pl $(_MKHELPOPT) $< > $@ +else +tool_hugehelp.c: + @echo Creating $@ + @$(call COPY, $@.cvs, $@) +endif +endif $(TARGETS): $(curl_OBJECTS) $(curl_DEPENDENCIES) $(CC) $(LDFLAGS) $(CURL_LDFLAGS_BIN) -o $@ $(curl_OBJECTS) $(LIBS) -tool_hugehelp.c: - @echo Creating $@ - @$(call COPY, $@.cvs, $@) - -### Global script - -include $(PROOT)/lib/Makefile.m32 +all: $(OBJ_DIR) $(TARGETS) diff --git a/src/makefile.amiga b/src/makefile.amiga deleted file mode 100644 index 9aac7a0fb8..0000000000 --- a/src/makefile.amiga +++ /dev/null @@ -1,52 +0,0 @@ -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# 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 -# -########################################################################### -# -# curl Makefile for AmigaOS ... -# - -# change the follow to where you have the AmiTCP SDK v4.3 includes: - -ATCPSDKI= /GG/netinclude - - -CC = m68k-amigaos-gcc -CFLAGS = -I$(ATCPSDKI) -m68020-60 -O2 -msoft-float -noixemul -g -I. -I../include -W -Wall -DUSE_OPENSSL -DHAVE_LIBZ -LIBS = ../lib/libcurl.a -lssl -lcrypto -lz -MANPAGE = ../docs/curl.1 -README = ../docs/MANUAL -MKHELP = ../src/mkhelp.pl - -include Makefile.inc - -OBJS = $(CURL_CFILES:.c=.o) $(CURLX_CFILES:.c=.o) - -all: tool_hugehelp.c $(OBJS) - $(CC) $(CFLAGS) -o curl $(OBJS) $(LIBS) -Wl,-Map,curl.map,--cref - -tool_hugehelp.c: $(README) $(MANPAGE) mkhelp.pl - rm -f tool_hugehelp.c - /bin/nroff -man $(MANPAGE) | /bin/perl $(MKHELP) -c $(README) > tool_hugehelp.c - -install: - $(INSTALL) -c curl /c/curl diff --git a/src/makefile.dj b/src/makefile.dj deleted file mode 100644 index 84c127b07b..0000000000 --- a/src/makefile.dj +++ /dev/null @@ -1,101 +0,0 @@ -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 2003 - 2022, Gisle Vanem . -# Copyright (C) 2003 - 2020, Daniel Stenberg, , et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# 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 -# -#*************************************************************************** - -# -# Adapted for djgpp2 / Watt-32 / DOS -# - -DEPEND_PREREQ = # tool_hugehelp.c - -TOPDIR = .. - -vpath %.c ../lib - -include ../packages/DOS/common.dj -include Makefile.inc - -CSOURCES = $(CURL_CFILES) $(CURLX_CFILES) - -ifeq ($(USE_OPENSSL),1) - EX_LIBS += $(OPENSSL_LIBS) -endif - -ifeq ($(USE_ARES),1) - EX_LIBS += $(ARES_ROOT)/libcares.a -endif - -ifeq ($(USE_ZLIB),1) - EX_LIBS += $(ZLIB_ROOT)/libz.a - CFLAGS += -DUSE_MANUAL -endif - -ifeq ($(USE_IDNA),1) - EX_LIBS += $(LIBIDN_ROOT)/lib/dj_obj/libidn.a -liconv -endif - -EX_LIBS += $(WATT32_ROOT)/lib/libwatt.a - -PROGRAM = curl.exe -OBJECTS = $(addprefix $(OBJ_DIR)/, $(notdir $(CSOURCES:.c=.o))) - -all: $(OBJ_DIR) $(PROGRAM) - @echo Welcome to curl - -$(PROGRAM): $(OBJECTS) ../lib/libcurl.a - $(CC) -o $@ $^ $(LDFLAGS) $(EX_LIBS) - -# -# groff 1.18+ requires "-P -c" -# If 'USE_ZLIB = 1', create a compressed help-file. -# -ifeq ($(USE_ZLIB),1) - COMPRESS_OPT = -c -endif - -tool_hugehelp.c: ../docs/curl.1 mkhelp.pl Makefile.dj - groff -Tascii -man $< | perl -w mkhelp.pl $(COMPRESS_OPT) $< > $@ - -# clean generated files -# -genclean: - - $(DELETE) tool_hugehelp.c - -# clean object files and subdir -# -objclean: genclean - - $(DELETE) $(OBJ_DIR)$(DS)*.o - - $(RMDIR) $(OBJ_DIR) - -# clean without removing built program -# -clean: objclean - - $(DELETE) depend.dj - -# clean everything -# -realclean vclean: clean - - $(DELETE) $(PROGRAM) - --include depend.dj