1#*************************************************************************** 2# _ _ ____ _ 3# Project ___| | | | _ \| | 4# / __| | | | |_) | | 5# | (__| |_| | _ <| |___ 6# \___|\___/|_| \_\_____| 7# 8# Copyright (C) 1998 - 2021, 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########################################################################### 22# 23# Common defines for curl (djgpp/Watt-32) 24# 25# Assumes you've unpacked curl with long-file names 26# I.e use "set LFN=y" before untaring on Win9x/XP. 27# Requires sed, rm and the usual stuff. 28# 29# Define TOPDIR before including this file. 30 31MAKEFILE = Makefile.dj 32OBJ_DIR = djgpp 33 34# 35# Find out if using a Unix-like shell or a DOS command interpreter 36# 37ifneq ($(findstring COMMAND.COM,$(SHELL)),COMMAND.COM) 38 ifneq ($(findstring CMD.EXE,$(SHELL)),CMD.EXE) 39 ifneq ($(findstring 4DOS.COM,$(SHELL)),4DOS.COM) 40 IS_UNIX_SHELL = 1 41 endif 42 endif 43endif 44 45# 46# Define shell dependent commands and vars 47# 48ifeq ($(IS_UNIX_SHELL),1) 49 COPY = cp -f 50 DELETE = rm -f 51 MKDIR = mkdir 52 RMDIR = rm -f -r 53 DS = / 54else 55 COPY = copy 56 DELETE = del 57 MKDIR = mkdir 58 RMDIR = rmdir 59 DS = \$(NOTHING) 60endif 61 62ifeq ($(OS),Windows_NT) 63 # 64 # Windows hosted djgpp cross compiler. Get it from: 65 # https://github.com/andrewwutw/build-djgpp/releases 66 # 67 DJ_PREFIX ?= c:/some-path/djgpp/bin/i586-pc-msdosdjgpp- 68 CC = $(DJ_PREFIX)gcc 69 70else 71 # 72 # The normal djgpp 'gcc' for MSDOS. 73 # 74 CC = gcc 75endif 76 77# 78# OpenSSL is available from www.openssl.org and builds okay 79# with djgpp/Watt-32. Set to 0 if you don't need https URLs 80# (reduces curl.exe with approx 700 kB) 81# 82USE_OPENSSL ?= 0 83 84# 85# Use zlib for contents encoding. Needed for 'USE_OPENSSL=1' too. 86# 87USE_ZLIB ?= 0 88 89# 90# Use libidn for international domain names 91# 92USE_IDNA ?= 0 93 94# 95# Use Watt-32 IPv6 stack (only IPv6 name resolution working at the moment) 96# 97USE_IPV6 ?= 0 98 99# 100# Use C-Ares resolver library 101# 102USE_ARES ?= 0 103 104# 105# Enable debug code in libcurl/curl 106# 107USE_DEBUG ?= 0 108 109# 110# Enable memory tracking code in libcurl/curl 111# 112USE_CURLDEBUG ?= 0 113 114# 115# Generate a .map file in 'link_EXE' macro 116# 117MAKE_MAP_FILE ?= 0 118 119default: all 120 121# 122# Root directory for Waterloo tcp/ip etc. Change to suite. 123# WATT_ROOT should be set during Watt-32 install. 124# 125WATT32_ROOT = $(realpath $(WATT_ROOT)) 126OPENSSL_ROOT ?= $(TOPDIR)/../crypto/OpenSSL 127ZLIB_ROOT ?= e:/djgpp/contrib/zlib 128LIBIDN_ROOT ?= $(TOPDIR)/../IDN/libidn 129ARES_ROOT ?= $(TOPDIR)/../DNS/c-ares 130 131CFLAGS = -g -O2 -I. -I$(TOPDIR)/include -I$(TOPDIR)/lib \ 132 -I$(WATT32_ROOT)/inc -Wall -DHAVE_CONFIG_H 133 134ifeq ($(USE_OPENSSL),1) 135 CFLAGS += -DUSE_OPENSSL -I$(OPENSSL_ROOT)/include 136 137 # 138 # Squelch the warnings on deprecated functions. 139 # 140 CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED 141 142 # 143 # Use some of these too? 144 # 145 # CFLAGS += -DUSE_TLS_SRP=1 \ 146 # -DHAVE_ENGINE_LOAD_BUILTIN_ENGINES \ 147 # -DHAVE_OPENSSL_PKCS12_H \ 148 # -DHAVE_SSLV2_CLIENT_METHOD \ 149 # -DOPENSSL_NO_DEPRECATED 150 151 # 152 # 'libcomm.a' is normally 'libcommon.a'. But to keep it 8+3 clean, it's 153 # shortened to 'libcomm.a'. The official OpenSSL build was recently changed 154 # and this "Common" library was added for several of the Crypto Providers. 155 # 156 OPENSSL_LIBS = $(OPENSSL_ROOT)/lib/libssl.a \ 157 $(OPENSSL_ROOT)/lib/libcrypt.a \ 158 $(OPENSSL_ROOT)/lib/libcomm.a 159endif 160 161ifeq ($(USE_ZLIB),1) 162 CFLAGS += -DUSE_ZLIB -I$(ZLIB_ROOT) 163endif 164 165ifeq ($(USE_IPV6),1) 166 CFLAGS += -DENABLE_IPV6 167endif 168 169ifeq ($(USE_ARES),1) 170 CFLAGS += -DUSE_ARES -I$(ARES_ROOT)/include 171endif 172 173ifeq ($(USE_IDNA),1) 174 CFLAGS += -DHAVE_LIBIDN -DHAVE_IDN_FREE_H -DHAVE_IDN_FREE -DHAVE_TLD_H \ 175 -DHAVE_TLD_STRERROR -I$(LIBIDN_ROOT)/lib 176endif 177 178ifeq ($(USE_DEBUG),1) 179 CFLAGS += -DDEBUG=1 -DDEBUGBUILD 180endif 181 182ifeq ($(USE_CURLDEBUG),1) 183 CFLAGS += -DCURLDEBUG 184endif 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# 198ifeq ($(MAKE_MAP_FILE),1) 199 define link_EXE 200 $(CC) -o $(1) $(LDFLAGS) -Wl,--print-map,--sort-common $(2) > $(1:.exe=.map) 201 endef 202else 203 define link_EXE 204 $(CC) $(LDFLAGS) -o $(1) $(2) 205 endef 206endif 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 212DEP_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# 222depend: $(DEPEND_PREREQ) $(MAKEFILE) 223 $(CC) -MM $(CFLAGS) $(CSOURCES) | $(DEP_REPLACE) > depend.dj 224