1#
2# Common defines for curl (djgpp/Watt-32)
3#
4# Assumes you've unpacked cURL with long-file names
5# I.e use "set LFN=y" before untaring on Win9x/XP.
6# Requires sed, yacc, rm and the usual stuff.
7#
8# Define TOPDIR before including this file.
9
10.SUFFIXES: .exe .y
11
12MAKEFILE = Makefile.dj
13OBJ_DIR = djgpp
14
15#
16# Find out if using a Unix-like shell or a DOS command interpreter
17#
18ifneq ($(findstring COMMAND.COM,$(SHELL)),COMMAND.COM)
19  ifneq ($(findstring CMD.EXE,$(SHELL)),CMD.EXE)
20    ifneq ($(findstring 4DOS.COM,$(SHELL)),4DOS.COM)
21      IS_UNIX_SHELL = 1
22    endif
23  endif
24endif
25
26#
27# Define shell dependent commands and vars
28#
29ifeq ($(IS_UNIX_SHELL),1)
30  COPY   = cp -f
31  DELETE = rm -f
32  MKDIR  = mkdir
33  RMDIR  = rm -f -r
34  DS     = /
35else
36  COPY   = copy
37  DELETE = del
38  MKDIR  = mkdir
39  RMDIR  = rmdir
40  DS     = \$(NOTHING)
41endif
42
43#
44# OpenSSL is available from www.openssl.org and builds okay
45# with djgpp/Watt-32. Set to 0 if you don't need https URLs
46# (reduces curl.exe with approx 700 kB)
47#
48USE_SSL = 0
49
50#
51# Use zlib for contents encoding
52#
53USE_ZLIB = 0
54
55#
56# Use libidn for international domain names
57#
58USE_IDNA = 0
59
60#
61# Use Watt-32 IPv6 stack (only IPv6 name resolution working at the moment)
62#
63USE_IPV6 = 0
64
65#
66# Use C-Ares resolver library
67#
68USE_ARES = 0
69
70#
71# Enable debug code in libcurl/curl
72#
73USE_DEBUG = 0
74
75#
76# Enable memory tracking code in libcurl/curl
77#
78USE_CURLDEBUG = 0
79
80default: all
81
82#
83# Root directory for Waterloo tcp/ip etc. Change to suite.
84# WATT_ROOT should be set during Watt-32 install.
85#
86WATT32_ROOT  = $(subst \,/,$(WATT_ROOT))
87OPENSSL_ROOT = e:/net/openssl.099
88ZLIB_ROOT    = $(DJDIR)/contrib/zlib
89LIBIDN_ROOT  = $(TOPDIR)/../IDN/libidn
90ARES_ROOT    = $(TOPDIR)/ares
91
92CC   = gcc
93YACC = bison -y
94
95CFLAGS = -g -O2 -I. -I$(TOPDIR)/include -I$(TOPDIR)/lib \
96         -I$(WATT32_ROOT)/inc -Wall -DHAVE_CONFIG_H
97
98ifeq ($(USE_SSL),1)
99  CFLAGS += -DUSE_SSLEAY -DUSE_OPENSSL -I$(OPENSSL_ROOT)
100endif
101
102ifeq ($(USE_ZLIB),1)
103  CFLAGS += -DUSE_ZLIB -I$(ZLIB_ROOT)
104endif
105
106ifeq ($(USE_IPV6),1)
107  CFLAGS += -DENABLE_IPV6
108endif
109
110ifeq ($(USE_ARES),1)
111  CFLAGS += -DUSE_ARES -I$(ARES_ROOT)
112endif
113
114ifeq ($(USE_IDNA),1)
115  CFLAGS += -DHAVE_LIBIDN -DHAVE_IDN_FREE_H -DHAVE_IDN_FREE -DHAVE_TLD_H \
116            -DHAVE_TLD_STRERROR -I$(LIBIDN_ROOT)/lib
117endif
118
119ifeq ($(USE_DEBUG),1)
120  CFLAGS += -DDEBUG=1 -DDEBUGBUILD
121endif
122
123ifeq ($(USE_CURLDEBUG),1)
124  CFLAGS += -DCURLDEBUG
125endif
126
127$(OBJ_DIR):
128	$(MKDIR) $(OBJ_DIR)
129
130$(OBJ_DIR)/%.o: %.c
131	$(CC) $(CFLAGS) -o $@ -c $<
132	@echo
133
134depend: $(DEPEND_PREREQ) $(MAKEFILE)
135	$(CC) -MM $(CFLAGS) $(CSOURCES) | \
136	sed -e 's/^\([a-zA-Z0-9_-]*\.o:\)/$$(OBJ_DIR)\/\1/' > depend.dj
137