xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame^] | 1 | #*************************************************************************** |
| 2 | # _ _ ____ _ |
| 3 | # Project ___| | | | _ \| | |
| 4 | # / __| | | | |_) | | |
| 5 | # | (__| |_| | _ <| |___ |
| 6 | # \___|\___/|_| \_\_____| |
| 7 | # |
| 8 | # Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al. |
| 9 | # |
| 10 | # This software is licensed as described in the file COPYING, which |
| 11 | # you should have received as part of this distribution. The terms |
| 12 | # are also available at https://curl.se/docs/copyright.html. |
| 13 | # |
| 14 | # You may opt to use, copy, modify, merge, publish, distribute and/or sell |
| 15 | # copies of the Software, and permit persons to whom the Software is |
| 16 | # furnished to do so, under the terms of the COPYING file. |
| 17 | # |
| 18 | # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 19 | # KIND, either express or implied. |
| 20 | # |
| 21 | # SPDX-License-Identifier: curl |
| 22 | # |
| 23 | ########################################################################### |
| 24 | # |
| 25 | # Common defines for curl (djgpp/Watt-32) |
| 26 | # |
| 27 | # Assumes you've unpacked curl with long-file names |
| 28 | # I.e use "set LFN=y" before untaring on Win9x/XP. |
| 29 | # Requires sed, rm and the usual stuff. |
| 30 | # |
| 31 | # Define TOPDIR before including this file. |
| 32 | |
| 33 | MAKEFILE = Makefile.dj |
| 34 | OBJ_DIR = djgpp |
| 35 | |
| 36 | # |
| 37 | # Find out if using a Unix-like shell or a DOS command interpreter |
| 38 | # |
| 39 | ifneq ($(findstring COMMAND.COM,$(SHELL)),COMMAND.COM) |
| 40 | ifneq ($(findstring CMD.EXE,$(SHELL)),CMD.EXE) |
| 41 | ifneq ($(findstring 4DOS.COM,$(SHELL)),4DOS.COM) |
| 42 | IS_UNIX_SHELL = 1 |
| 43 | endif |
| 44 | endif |
| 45 | endif |
| 46 | |
| 47 | # |
| 48 | # Define shell dependent commands and vars |
| 49 | # |
| 50 | ifeq ($(IS_UNIX_SHELL),1) |
| 51 | COPY = cp -f |
| 52 | DELETE = rm -f |
| 53 | MKDIR = mkdir |
| 54 | RMDIR = rm -f -r |
| 55 | DS = / |
| 56 | else |
| 57 | COPY = copy |
| 58 | DELETE = del |
| 59 | MKDIR = mkdir |
| 60 | RMDIR = rmdir |
| 61 | DS = \$(NOTHING) |
| 62 | endif |
| 63 | |
| 64 | ifeq ($(OS),Windows_NT) |
| 65 | # |
| 66 | # Windows hosted djgpp cross compiler. Get it from: |
| 67 | # https://github.com/andrewwutw/build-djgpp/releases |
| 68 | # |
| 69 | DJ_PREFIX ?= c:/some-path/djgpp/bin/i586-pc-msdosdjgpp- |
| 70 | CC = $(DJ_PREFIX)gcc |
| 71 | |
| 72 | else |
| 73 | # |
| 74 | # The normal djgpp 'gcc' for MSDOS. |
| 75 | # |
| 76 | CC = gcc |
| 77 | endif |
| 78 | |
| 79 | # |
| 80 | # OpenSSL is available from www.openssl.org and builds okay |
| 81 | # with djgpp/Watt-32. Set to 0 if you don't need https URLs |
| 82 | # (reduces curl.exe with approx 700 kB) |
| 83 | # |
| 84 | USE_OPENSSL ?= 0 |
| 85 | |
| 86 | # |
| 87 | # Use zlib for contents encoding. Needed for 'USE_OPENSSL=1' too. |
| 88 | # |
| 89 | USE_ZLIB ?= 0 |
| 90 | |
| 91 | # |
| 92 | # Use libidn for international domain names |
| 93 | # |
| 94 | USE_IDNA ?= 0 |
| 95 | |
| 96 | # |
| 97 | # Use Watt-32 IPv6 stack (only IPv6 name resolution working at the moment) |
| 98 | # |
| 99 | USE_IPV6 ?= 0 |
| 100 | |
| 101 | # |
| 102 | # Use C-Ares resolver library |
| 103 | # |
| 104 | USE_ARES ?= 0 |
| 105 | |
| 106 | # |
| 107 | # Enable debug code in libcurl/curl |
| 108 | # |
| 109 | USE_DEBUG ?= 0 |
| 110 | |
| 111 | # |
| 112 | # Enable memory tracking code in libcurl/curl |
| 113 | # |
| 114 | USE_CURLDEBUG ?= 0 |
| 115 | |
| 116 | # |
| 117 | # Generate a .map file in 'link_EXE' macro |
| 118 | # |
| 119 | MAKE_MAP_FILE ?= 0 |
| 120 | |
| 121 | default: all |
| 122 | |
| 123 | # |
| 124 | # Root directory for Waterloo tcp/ip etc. Change to suite. |
| 125 | # WATT_ROOT should be set during Watt-32 install. |
| 126 | # |
| 127 | WATT32_ROOT = $(realpath $(WATT_ROOT)) |
| 128 | OPENSSL_ROOT ?= $(TOPDIR)/../crypto/OpenSSL |
| 129 | ZLIB_ROOT ?= e:/djgpp/contrib/zlib |
| 130 | LIBIDN_ROOT ?= $(TOPDIR)/../IDN/libidn |
| 131 | ARES_ROOT ?= $(TOPDIR)/../DNS/c-ares |
| 132 | |
| 133 | CFLAGS = -g -O2 -I. -I$(TOPDIR)/include -I$(TOPDIR)/lib \ |
| 134 | -I$(WATT32_ROOT)/inc -Wall -DHAVE_CONFIG_H |
| 135 | |
| 136 | ifeq ($(USE_OPENSSL),1) |
| 137 | CFLAGS += -DUSE_OPENSSL -I$(OPENSSL_ROOT)/include |
| 138 | |
| 139 | # |
| 140 | # Squelch the warnings on deprecated functions. |
| 141 | # |
| 142 | CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED |
| 143 | |
| 144 | # |
| 145 | # Use some of these too? |
| 146 | # |
| 147 | # CFLAGS += -DUSE_TLS_SRP=1 \ |
| 148 | # -DHAVE_ENGINE_LOAD_BUILTIN_ENGINES \ |
| 149 | # -DHAVE_SSLV2_CLIENT_METHOD \ |
| 150 | # -DOPENSSL_NO_DEPRECATED |
| 151 | |
| 152 | # |
| 153 | # 'libcomm.a' is normally 'libcommon.a'. But to keep it 8+3 clean, it's |
| 154 | # shortened to 'libcomm.a'. The official OpenSSL build was recently changed |
| 155 | # and this "Common" library was added for several of the Crypto Providers. |
| 156 | # |
| 157 | OPENSSL_LIBS = $(OPENSSL_ROOT)/lib/libssl.a \ |
| 158 | $(OPENSSL_ROOT)/lib/libcrypt.a \ |
| 159 | $(OPENSSL_ROOT)/lib/libcomm.a |
| 160 | endif |
| 161 | |
| 162 | ifeq ($(USE_ZLIB),1) |
| 163 | CFLAGS += -DHAVE_LIBZ -I$(ZLIB_ROOT) |
| 164 | endif |
| 165 | |
| 166 | ifeq ($(USE_IPV6),1) |
| 167 | CFLAGS += -DENABLE_IPV6 |
| 168 | endif |
| 169 | |
| 170 | ifeq ($(USE_ARES),1) |
| 171 | CFLAGS += -DUSE_ARES -I$(ARES_ROOT)/include |
| 172 | endif |
| 173 | |
| 174 | ifeq ($(USE_IDNA),1) |
| 175 | CFLAGS += -DHAVE_LIBIDN -I$(LIBIDN_ROOT)/lib |
| 176 | endif |
| 177 | |
| 178 | ifeq ($(USE_DEBUG),1) |
| 179 | CFLAGS += -DDEBUG=1 -DDEBUGBUILD |
| 180 | endif |
| 181 | |
| 182 | ifeq ($(USE_CURLDEBUG),1) |
| 183 | CFLAGS += -DCURLDEBUG |
| 184 | endif |
| 185 | |
| 186 | $(OBJ_DIR): |
| 187 | $(MKDIR) $(OBJ_DIR) |
| 188 | |
| 189 | $(OBJ_DIR)/%.o: %.c |
| 190 | $(CC) $(CFLAGS) -o $@ -c $< |
| 191 | @echo |
| 192 | |
| 193 | # |
| 194 | # Link-EXE macro: |
| 195 | # $(1): the .exe |
| 196 | # $(2): the .o-files and libraries |
| 197 | # |
| 198 | ifeq ($(MAKE_MAP_FILE),1) |
| 199 | define link_EXE |
| 200 | $(CC) -o $(1) $(LDFLAGS) -Wl,--print-map,--sort-common $(2) > $(1:.exe=.map) |
| 201 | endef |
| 202 | else |
| 203 | define link_EXE |
| 204 | $(CC) $(LDFLAGS) -o $(1) $(2) |
| 205 | endef |
| 206 | endif |
| 207 | |
| 208 | $(TOPDIR)/docs/curl.1: $(wildcard $(TOPDIR)/docs/cmdline-opts/*.d) |
| 209 | cd $(TOPDIR)/docs/cmdline-opts; \ |
| 210 | perl gen.pl mainpage > ../$(TOPDIR)/docs/curl.1 |
| 211 | |
| 212 | DEP_REPLACE = sed -e 's@\(.*\)\.o: @\n$$(OBJ_DIR)\/\1.o: @' \ |
| 213 | -e 's@$(ARES_ROOT)@$$(ARES_ROOT)@g' \ |
| 214 | -e 's@$(OPENSSL_ROOT)@$$(OPENSSL_ROOT)@g' \ |
| 215 | -e 's@$(WATT32_ROOT)@$$(WATT32_ROOT)@g' \ |
| 216 | -e 's@$(ZLIB_ROOT)@$$(ZLIB_ROOT)@g' |
| 217 | |
| 218 | # |
| 219 | # One may have to do 'make -f Makefile.dj clean' first in case |
| 220 | # a foreign 'curl_config.h' is making trouble. |
| 221 | # |
| 222 | depend: $(DEPEND_PREREQ) $(MAKEFILE) |
| 223 | $(CC) -MM $(CFLAGS) $(CSOURCES) | $(DEP_REPLACE) > depend.dj |