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