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