Imported Upstream version 7.59.0
[platform/upstream/curl.git] / src / Makefile.netware
1 #***************************************************************************
2 #                                  _   _ ____  _
3 #  Project                     ___| | | |  _ \| |
4 #                             / __| | | | |_) | |
5 #                            | (__| |_| |  _ <| |___
6 #                             \___|\___/|_| \_\_____|
7 #
8 # Copyright (C) 2004 - 2014, Guenter Knauf, <http://www.gknw.net/phpbb>.
9 # Copyright (C) 2001 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
10 #
11 # This software is licensed as described in the file COPYING, which
12 # you should have received as part of this distribution. The terms
13 # are also available at https://curl.haxx.se/docs/copyright.html.
14 #
15 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
16 # copies of the Software, and permit persons to whom the Software is
17 # furnished to do so, under the terms of the COPYING file.
18 #
19 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 # KIND, either express or implied.
21 #
22 #***************************************************************************
23
24 #################################################################
25 #
26 ## Makefile for building curl.nlm (NetWare version - gnu make)
27 ##
28 ## Use: make -f Makefile.netware
29 #
30 #################################################################
31
32 # Edit the path below to point to the base of your Novell NDK.
33 ifndef NDKBASE
34 NDKBASE = c:/novell
35 endif
36
37 # Edit the path below to point to the base of your Zlib sources.
38 ifndef ZLIB_PATH
39 ZLIB_PATH = ../../zlib-1.2.8
40 endif
41
42 # Edit the path below to point to the base of your OpenSSL package.
43 ifndef OPENSSL_PATH
44 OPENSSL_PATH = ../../openssl-1.0.2a
45 endif
46
47 # Edit the path below to point to the base of your LibSSH2 package.
48 ifndef LIBSSH2_PATH
49 LIBSSH2_PATH = ../../libssh2-1.5.0
50 endif
51
52 # Edit the path below to point to the base of your axTLS package.
53 ifndef AXTLS_PATH
54 AXTLS_PATH = ../../axTLS-1.2.7
55 endif
56
57 # Edit the path below to point to the base of your libidn package.
58 ifndef LIBIDN_PATH
59 LIBIDN_PATH = ../../libidn-1.18
60 endif
61
62 # Edit the path below to point to the base of your librtmp package.
63 ifndef LIBRTMP_PATH
64 LIBRTMP_PATH = ../../librtmp-2.3
65 endif
66
67 # Edit the path below to point to the base of your nghttp2 package.
68 ifndef NGHTTP2_PATH
69 NGHTTP2_PATH = ../../nghttp2-0.6.7
70 endif
71
72 # Edit the path below to point to the base of your fbopenssl package.
73 ifndef FBOPENSSL_PATH
74 FBOPENSSL_PATH = ../../fbopenssl-0.4
75 endif
76
77 # Edit the path below to point to the base of your libmetalink package.
78 ifndef LIBMETALINK_PATH
79 LIBMETALINK_PATH = ../../libmetalink-0.1.2
80 endif
81
82 # Edit the path below to point to the base of your libexpat package.
83 ifndef LIBEXPAT_PATH
84 LIBEXPAT_PATH = ../../expat-2.1.0
85 endif
86
87 # Edit the path below to point to the base of your libXML2 package.
88 ifndef LIBXML2_PATH
89 LIBXML2_PATH = ../../libxml2-2.8.0
90 endif
91
92 # Edit the path below to point to the base of your c-ares package.
93 ifndef LIBCARES_PATH
94 LIBCARES_PATH = ../ares
95 endif
96
97 ifndef INSTDIR
98 INSTDIR = ..$(DS)curl-$(LIBCURL_VERSION_STR)-bin-nw
99 endif
100
101 # Edit the vars below to change NLM target settings.
102 TARGET  = curl
103 VERSION = $(LIBCURL_VERSION)
104 COPYR   = Copyright (C) $(LIBCURL_COPYRIGHT_STR)
105 DESCR   = curl $(LIBCURL_VERSION_STR) ($(LIBARCH)) - https://curl.haxx.se
106 MTSAFE  = YES
107 STACK   = 64000
108 SCREEN  = $(TARGET) commandline utility
109 # Comment the line below if you don't want to load protected automatically.
110 # LDRING = 3
111
112 # Uncomment the next line to enable linking with POSIX semantics.
113 # POSIXFL = 1
114
115 # Edit the var below to point to your lib architecture.
116 ifndef LIBARCH
117 LIBARCH = LIBC
118 endif
119
120 # must be equal to NDEBUG or DEBUG, CURLDEBUG
121 ifndef DB
122 DB      = NDEBUG
123 endif
124 # Optimization: -O<n> or debugging: -g
125 ifeq ($(DB),NDEBUG)
126         OPT     = -O2
127         OBJDIR  = release
128 else
129         OPT     = -g
130         OBJDIR  = debug
131 endif
132
133 # The following lines defines your compiler.
134 ifdef CWFolder
135         METROWERKS = $(CWFolder)
136 endif
137 ifdef METROWERKS
138         # MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support
139         MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support
140         CC = mwccnlm
141 else
142         CC = gcc
143 endif
144 PERL    = perl
145 # Here you can find a native Win32 binary of the original awk:
146 # http://www.gknw.net/development/prgtools/awk-20100523.zip
147 AWK     = awk
148 CP      = cp -afv
149 MKDIR   = mkdir
150 # RM    = rm -f
151 # If you want to mark the target as MTSAFE you will need a tool for
152 # generating the xdc data for the linker; here's a minimal tool:
153 # http://www.gknw.net/development/prgtools/mkxdc.zip
154 MPKXDC  = mkxdc
155
156 # LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH))
157 LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH))
158
159 # Include the version info retrieved from curlver.h
160 -include $(OBJDIR)/version.inc
161
162 # Global flags for all compilers
163 CFLAGS  += $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc
164
165 ifeq ($(CC),mwccnlm)
166 LD      = mwldnlm
167 LDFLAGS = -nostdlib $(OBJS) $(PRELUDE) $(LDLIBS) -o $@ -commandfile
168 LIBEXT  = lib
169 CFLAGS  += -gccinc -inline off -opt nointrinsics -proc 586
170 CFLAGS  += -relax_pointers
171 #CFLAGS += -w on
172 ifeq ($(LIBARCH),LIBC)
173 ifeq ($(POSIXFL),1)
174         PRELUDE = $(NDK_LIBC)/imports/posixpre.o
175 else
176         PRELUDE = $(NDK_LIBC)/imports/libcpre.o
177 endif
178         CFLAGS += -align 4
179 else
180         # PRELUDE = $(NDK_CLIB)/imports/clibpre.o
181         # to avoid the __init_* / __deinit_* whoes don't use prelude from NDK
182         PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
183         # CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
184         CFLAGS += -align 1
185 endif
186 else
187 LD      = nlmconv
188 LDFLAGS = -T
189 LIBEXT  = a
190 CFLAGS  += -m32
191 CFLAGS  += -fno-builtin -fno-strict-aliasing
192 ifeq ($(findstring gcc,$(CC)),gcc)
193 CFLAGS  += -fpcc-struct-return
194 endif
195 CFLAGS  += -Wall # -pedantic
196 ifeq ($(LIBARCH),LIBC)
197 ifeq ($(POSIXFL),1)
198         PRELUDE = $(NDK_LIBC)/imports/posixpre.gcc.o
199 else
200         PRELUDE = $(NDK_LIBC)/imports/libcpre.gcc.o
201 endif
202 else
203         # PRELUDE = $(NDK_CLIB)/imports/clibpre.gcc.o
204         # to avoid the __init_* / __deinit_* whoes don't use prelude from NDK
205         # http://www.gknw.net/development/mk_nlm/gcc_pre.zip
206         PRELUDE = $(NDK_ROOT)/pre/prelude.o
207         CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
208 endif
209 endif
210
211 NDK_ROOT = $(NDKBASE)/ndk
212 ifndef NDK_CLIB
213 NDK_CLIB = $(NDK_ROOT)/nwsdk
214 endif
215 ifndef NDK_LIBC
216 NDK_LIBC = $(NDK_ROOT)/libc
217 endif
218 ifndef NDK_LDAP
219 NDK_LDAP = $(NDK_ROOT)/cldapsdk/netware
220 endif
221 CURL_INC = ../include
222 CURL_LIB = ../lib
223
224 INCLUDES = -I$(CURL_INC) -I$(CURL_LIB)
225
226 ifeq ($(findstring -static,$(CFG)),-static)
227 LINK_STATIC = 1
228 endif
229 ifeq ($(findstring -ares,$(CFG)),-ares)
230 WITH_ARES = 1
231 endif
232 ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
233 WITH_RTMP = 1
234 WITH_SSL = 1
235 WITH_ZLIB = 1
236 endif
237 ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
238 WITH_SSH2 = 1
239 WITH_SSL = 1
240 WITH_ZLIB = 1
241 endif
242 ifeq ($(findstring -axtls,$(CFG)),-axtls)
243 WITH_AXTLS = 1
244 WITH_SSL =
245 else
246 ifeq ($(findstring -ssl,$(CFG)),-ssl)
247 WITH_SSL = 1
248 endif
249 endif
250 ifeq ($(findstring -zlib,$(CFG)),-zlib)
251 WITH_ZLIB = 1
252 endif
253 ifeq ($(findstring -idn,$(CFG)),-idn)
254 WITH_IDN = 1
255 endif
256 ifeq ($(findstring -metalink,$(CFG)),-metalink)
257 WITH_METALINK = 1
258 WITH_SSL = 1
259 endif
260 ifeq ($(findstring -nghttp2,$(CFG)),-nghttp2)
261 WITH_NGHTTP2 = 1
262 endif
263 ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
264 ENABLE_IPV6 = 1
265 endif
266
267 ifdef LINK_STATIC
268         LDLIBS  = $(CURL_LIB)/libcurl.$(LIBEXT)
269 ifdef WITH_ARES
270         LDLIBS += $(LIBCARES_PATH)/libcares.$(LIBEXT)
271 endif
272 else
273         MODULES = libcurl.nlm
274         IMPORTS = @$(CURL_LIB)/libcurl.imp
275 endif
276 ifdef WITH_SSH2
277         # INCLUDES += -I$(LIBSSH2_PATH)/include
278 ifdef LINK_STATIC
279         LDLIBS += $(LIBSSH2_PATH)/nw/libssh2.$(LIBEXT)
280 else
281         MODULES += libssh2.nlm
282         IMPORTS += @$(LIBSSH2_PATH)/nw/libssh2.imp
283 endif
284 endif
285 ifdef WITH_RTMP
286         # INCLUDES += -I$(LIBRTMP_PATH)
287 ifdef LINK_STATIC
288         LDLIBS += $(LIBRTMP_PATH)/librtmp/librtmp.$(LIBEXT)
289 endif
290 endif
291 ifdef WITH_SSL
292         # INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)
293         LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT)
294         LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT)
295         IMPORTS += GetProcessSwitchCount RunningProcess
296 else
297 ifdef WITH_AXTLS
298         # INCLUDES += -I$(AXTLS_PATH)/inc
299 ifdef LINK_STATIC
300         LDLIBS += $(AXTLS_PATH)/lib/libaxtls.$(LIBEXT)
301 else
302         MODULES += libaxtls.nlm
303         IMPORTS += $(AXTLS_PATH)/lib/libaxtls.imp
304 endif
305 endif
306 endif
307 ifdef WITH_ZLIB
308         INCLUDES += -I$(ZLIB_PATH)
309 ifdef LINK_STATIC
310         LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT)
311 else
312         MODULES += libz.nlm
313         IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp
314 endif
315 endif
316 ifdef WITH_IDN
317         # INCLUDES += -I$(LIBIDN_PATH)/include
318         LDLIBS += $(LIBIDN_PATH)/lib/libidn.$(LIBEXT)
319 endif
320 ifdef WITH_NGHTTP2
321         INCLUDES += -I$(NGHTTP2_PATH)/include
322         LDLIBS += $(NGHTTP2_PATH)/lib/libnghttp2.$(LIBEXT)
323 endif
324 ifdef WITH_METALINK
325         CFLAGS += -DUSE_METALINK
326         INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)
327         INCLUDES += -I$(LIBMETALINK_PATH)/include
328         LDLIBS += $(LIBMETALINK_PATH)/lib/libmetalink.$(LIBEXT)
329 ifdef WITH_LIBEXPAT
330         ifeq ($(LIBARCH),LIBC)
331                 IMPORTS += @$(LIBEXPAT_PATH)/imports/expatlbc.imp
332                 MODULES += expatlbc
333         else
334                 IMPORTS += @$(LIBEXPAT_PATH)/imports/expatlib.imp
335                 MODULES += expatlib
336         endif
337 else
338 ifdef WITH_LIBXML2
339         IMPORTS += @$(LIBXML2_PATH)/lib/libxml2.imp
340         MODULES += libxml2
341 endif
342 endif
343 endif
344
345 ifeq ($(LIBARCH),LIBC)
346         INCLUDES += -I$(NDK_LIBC)/include
347         # INCLUDES += -I$(NDK_LIBC)/include/nks
348         # INCLUDES += -I$(NDK_LIBC)/include/winsock
349         CFLAGS += -D_POSIX_SOURCE
350 else
351         INCLUDES += -I$(NDK_CLIB)/include/nlm
352         # INCLUDES += -I$(NDK_CLIB)/include
353 endif
354 ifndef DISABLE_LDAP
355         # INCLUDES += -I$(NDK_LDAP)/$(LIBARCH_L)/inc
356 endif
357 CFLAGS  += $(INCLUDES)
358
359 ifeq ($(MTSAFE),YES)
360         XDCOPT = -n
361 endif
362 ifeq ($(MTSAFE),NO)
363         XDCOPT = -u
364 endif
365 ifdef XDCOPT
366         XDCDATA = $(OBJDIR)/$(TARGET).xdc
367 endif
368
369 ifeq ($(findstring /sh,$(SHELL)),/sh)
370 DL      = '
371 DS      = /
372 PCT     = %
373 #-include $(NDKBASE)/nlmconv/ncpfs.inc
374 else
375 DS      = \\
376 PCT     = %%
377 endif
378
379 # Makefile.inc provides the CSOURCES and HHEADERS defines
380 include Makefile.inc
381
382 OBJX    := $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(strip $(CURLX_CFILES))))
383 OBJS    := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CURL_CFILES)))
384 ifndef LINK_STATIC
385 OBJS    += $(OBJX)
386 endif
387
388 vpath %.c $(CURL_LIB)
389
390 all: prebuild $(TARGET).nlm
391
392 prebuild: $(OBJDIR) $(OBJDIR)/version.inc
393
394 $(OBJDIR)/%.o: %.c
395 #       @echo Compiling $<
396         $(CC) $(CFLAGS) -c $< -o $@
397
398 $(OBJDIR)/version.inc: $(CURL_INC)/curl/curlver.h $(OBJDIR)
399         @echo Creating $@
400         @$(AWK) -f ../packages/NetWare/get_ver.awk $< > $@
401
402 install: $(INSTDIR) all
403         @-$(CP) ../docs/$(TARGET).pdf $(INSTDIR)
404         @-$(CP) ../docs/$(TARGET).html $(INSTDIR)
405         @$(CP) $(TARGET).nlm $(INSTDIR)
406
407 clean:
408 ifeq "$(wildcard tool_hugehelp.c.cvs)" "tool_hugehelp.c.cvs"
409         -$(RM) tool_hugehelp.c
410 endif
411         -$(RM) -r $(OBJDIR)
412
413 distclean vclean: clean
414         -$(RM) $(TARGET).nlm
415
416 $(OBJDIR) $(INSTDIR):
417         @$(MKDIR) $@
418
419 $(TARGET).nlm: $(OBJS) $(OBJDIR)/$(TARGET).def $(XDCDATA)
420         @echo Linking $@
421         @-$(RM) $@
422         @$(LD) $(LDFLAGS) $(OBJDIR)/$(TARGET).def
423
424 $(OBJDIR)/%.xdc: Makefile.netware
425         @echo Creating $@
426         @$(MPKXDC) $(XDCOPT) $@
427
428 $(OBJDIR)/%.def: Makefile.netware
429         @echo $(DL)# DEF file for linking with $(LD)$(DL) > $@
430         @echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@
431         @echo $(DL)# All your changes will be lost!!$(DL) >> $@
432         @echo $(DL)#$(DL) >> $@
433         @echo $(DL)copyright "$(COPYR)"$(DL) >> $@
434         @echo $(DL)description "$(DESCR)"$(DL) >> $@
435         @echo $(DL)version $(VERSION)$(DL) >> $@
436 ifdef NLMTYPE
437         @echo $(DL)type $(NLMTYPE)$(DL) >> $@
438 endif
439 ifdef STACK
440         @echo $(DL)stack $(STACK)$(DL) >> $@
441 endif
442 ifdef SCREEN
443         @echo $(DL)screenname "$(SCREEN)"$(DL) >> $@
444 else
445         @echo $(DL)screenname "DEFAULT"$(DL) >> $@
446 endif
447 ifneq ($(DB),NDEBUG)
448         @echo $(DL)debug$(DL) >> $@
449 endif
450         @echo $(DL)threadname "$(TARGET)"$(DL) >> $@
451 ifdef XDCDATA
452         @echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@
453 endif
454 ifeq ($(LDRING),0)
455         @echo $(DL)flag_on 16$(DL) >> $@
456 endif
457 ifeq ($(LDRING),3)
458         @echo $(DL)flag_on 512$(DL) >> $@
459 endif
460 ifeq ($(LIBARCH),CLIB)
461         @echo $(DL)start _Prelude$(DL) >> $@
462         @echo $(DL)exit _Stop$(DL) >> $@
463         @echo $(DL)import @$(NDK_CLIB)/imports/clib.imp$(DL) >> $@
464         @echo $(DL)import @$(NDK_CLIB)/imports/threads.imp$(DL) >> $@
465         @echo $(DL)import @$(NDK_CLIB)/imports/nlmlib.imp$(DL) >> $@
466         @echo $(DL)import @$(NDK_CLIB)/imports/socklib.imp$(DL) >> $@
467         @echo $(DL)module clib$(DL) >> $@
468 ifndef DISABLE_LDAP
469         @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapsdk.imp$(DL) >> $@
470         @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapssl.imp$(DL) >> $@
471 #       @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@
472         @echo $(DL)module ldapsdk ldapssl$(DL) >> $@
473 endif
474 else
475 ifeq ($(POSIXFL),1)
476         @echo $(DL)flag_on 4194304$(DL) >> $@
477 endif
478         @echo $(DL)flag_on 64$(DL) >> $@
479         @echo $(DL)pseudopreemption$(DL) >> $@
480 ifeq ($(findstring posixpre,$(PRELUDE)),posixpre)
481         @echo $(DL)start POSIX_Start$(DL) >> $@
482         @echo $(DL)exit POSIX_Stop$(DL) >> $@
483         @echo $(DL)check POSIX_CheckUnload$(DL) >> $@
484 else
485         @echo $(DL)start _LibCPrelude$(DL) >> $@
486         @echo $(DL)exit _LibCPostlude$(DL) >> $@
487         @echo $(DL)check _LibCCheckUnload$(DL) >> $@
488 endif
489         @echo $(DL)import @$(NDK_LIBC)/imports/libc.imp$(DL) >> $@
490         @echo $(DL)import @$(NDK_LIBC)/imports/netware.imp$(DL) >> $@
491         @echo $(DL)module libc$(DL) >> $@
492 ifndef DISABLE_LDAP
493         @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapsdk.imp$(DL) >> $@
494         @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapssl.imp$(DL) >> $@
495 #       @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapx.imp$(DL) >> $@
496         @echo $(DL)module lldapsdk lldapssl$(DL) >> $@
497 endif
498 endif
499 ifdef MODULES
500         @echo $(DL)module $(MODULES)$(DL) >> $@
501 endif
502 ifdef EXPORTS
503         @echo $(DL)export $(EXPORTS)$(DL) >> $@
504 endif
505 ifdef IMPORTS
506         @echo $(DL)import $(IMPORTS)$(DL) >> $@
507 endif
508 ifeq ($(findstring nlmconv,$(LD)),nlmconv)
509         @echo $(DL)input $(PRELUDE)$(DL) >> $@
510         @echo $(DL)input $(OBJS)$(DL) >> $@
511 ifdef LDLIBS
512         @echo $(DL)input $(LDLIBS)$(DL) >> $@
513 endif
514         @echo $(DL)output $(TARGET).nlm$(DL) >> $@
515 endif
516
517 tool_hugehelp.c:
518         @echo Creating $@
519         @$(CP) tool_hugehelp.c.cvs $@
520
521 $(LIBCARES_PATH)/libcares.$(LIBEXT):
522         $(MAKE) -C $(LIBCARES_PATH) -f Makefile.netware lib
523
524