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