| 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. |
| 11 |
ifndef NDKBASE |
| 12 |
NDKBASE = c:/novell |
| 13 |
endif |
| 14 |
|
| 15 |
# Edit the path below to point to the base of your Zlib sources. |
| 16 |
ifndef ZLIB_PATH |
| 17 |
ZLIB_PATH = ../../../zlib-1.2.8 |
| 18 |
endif |
| 19 |
|
| 20 |
# Edit the path below to point to the base of your OpenSSL package. |
| 21 |
ifndef OPENSSL_PATH |
| 22 |
OPENSSL_PATH = ../../../openssl-1.0.2a |
| 23 |
endif |
| 24 |
|
| 25 |
# Edit the path below to point to the base of your LibSSH2 package. |
| 26 |
ifndef LIBSSH2_PATH |
| 27 |
LIBSSH2_PATH = ../../../libssh2-1.5.0 |
| 28 |
endif |
| 29 |
|
| 30 |
# Edit the path below to point to the base of your libidn package. |
| 31 |
ifndef LIBIDN_PATH |
| 32 |
LIBIDN_PATH = ../../../libidn-1.32 |
| 33 |
endif |
| 34 |
|
| 35 |
# Edit the path below to point to the base of your librtmp package. |
| 36 |
ifndef LIBRTMP_PATH |
| 37 |
LIBRTMP_PATH = ../../../librtmp-2.4 |
| 38 |
endif |
| 39 |
|
| 40 |
# Edit the path below to point to the base of your fbopenssl package. |
| 41 |
ifndef FBOPENSSL_PATH |
| 42 |
FBOPENSSL_PATH = ../../fbopenssl-0.4 |
| 43 |
endif |
| 44 |
|
| 45 |
# Edit the path below to point to the base of your c-ares package. |
| 46 |
ifndef LIBCARES_PATH |
| 47 |
LIBCARES_PATH = ../../ares |
| 48 |
endif |
| 49 |
|
| 50 |
ifndef INSTDIR |
| 51 |
INSTDIR = ..$(DS)..$(DS)curl-$(LIBCURL_VERSION_STR)-bin-nw |
| 52 |
endif |
| 53 |
|
| 54 |
# Edit the vars below to change NLM target settings. |
| 55 |
TARGET = examples |
| 56 |
VERSION = $(LIBCURL_VERSION) |
| 57 |
COPYR = Copyright (C) $(LIBCURL_COPYRIGHT_STR) |
| 58 |
DESCR = curl ($(LIBARCH)) |
| 59 |
MTSAFE = YES |
| 60 |
STACK = 8192 |
| 61 |
SCREEN = 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. |
| 69 |
ifndef LIBARCH |
| 70 |
LIBARCH = LIBC |
| 71 |
endif |
| 72 |
|
| 73 |
# must be equal to NDEBUG or DEBUG, CURLDEBUG |
| 74 |
ifndef DB |
| 75 |
DB = NDEBUG |
| 76 |
endif |
| 77 |
# Optimization: -O<n> or debugging: -g |
| 78 |
ifeq ($(DB),NDEBUG) |
| 79 |
OPT = -O2 |
| 80 |
OBJDIR = release |
| 81 |
else |
| 82 |
OPT = -g |
| 83 |
OBJDIR = debug |
| 84 |
endif |
| 85 |
|
| 86 |
# The following lines defines your compiler. |
| 87 |
ifdef CWFolder |
| 88 |
METROWERKS = $(CWFolder) |
| 89 |
endif |
| 90 |
ifdef METROWERKS |
| 91 |
# MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support |
| 92 |
MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support |
| 93 |
CC = mwccnlm |
| 94 |
else |
| 95 |
CC = gcc |
| 96 |
endif |
| 97 |
PERL = perl |
| 98 |
# Here you can find a native Win32 binary of the original awk: |
| 99 |
# http://www.gknw.net/development/prgtools/awk-20100523.zip |
| 100 |
AWK = awk |
| 101 |
CP = cp -afv |
| 102 |
MKDIR = 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 |
| 107 |
MPKXDC = mkxdc |
| 108 |
|
| 109 |
# LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH)) |
| 110 |
LIBARCH_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 |
| 116 |
CFLAGS += $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc |
| 117 |
|
| 118 |
ifeq ($(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 |
| 139 |
else |
| 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 |
| 162 |
endif |
| 163 |
|
| 164 |
NDK_ROOT = $(NDKBASE)/ndk |
| 165 |
ifndef NDK_CLIB |
| 166 |
NDK_CLIB = $(NDK_ROOT)/nwsdk |
| 167 |
endif |
| 168 |
ifndef NDK_LIBC |
| 169 |
NDK_LIBC = $(NDK_ROOT)/libc |
| 170 |
endif |
| 171 |
ifndef NDK_LDAP |
| 172 |
NDK_LDAP = $(NDK_ROOT)/cldapsdk/netware |
| 173 |
endif |
| 174 |
CURL_INC = ../../include |
| 175 |
CURL_LIB = ../../lib |
| 176 |
|
| 177 |
INCLUDES = -I$(CURL_INC) |
| 178 |
|
| 179 |
ifeq ($(findstring -static,$(CFG)),-static) |
| 180 |
LINK_STATIC = 1 |
| 181 |
endif |
| 182 |
ifeq ($(findstring -ares,$(CFG)),-ares) |
| 183 |
WITH_ARES = 1 |
| 184 |
endif |
| 185 |
ifeq ($(findstring -rtmp,$(CFG)),-rtmp) |
| 186 |
WITH_RTMP = 1 |
| 187 |
WITH_SSL = 1 |
| 188 |
WITH_ZLIB = 1 |
| 189 |
endif |
| 190 |
ifeq ($(findstring -ssh2,$(CFG)),-ssh2) |
| 191 |
WITH_SSH2 = 1 |
| 192 |
WITH_SSL = 1 |
| 193 |
WITH_ZLIB = 1 |
| 194 |
endif |
| 195 |
ifeq ($(findstring -ssl,$(CFG)),-ssl) |
| 196 |
WITH_SSL = 1 |
| 197 |
endif |
| 198 |
ifeq ($(findstring -zlib,$(CFG)),-zlib) |
| 199 |
WITH_ZLIB = 1 |
| 200 |
endif |
| 201 |
ifeq ($(findstring -idn,$(CFG)),-idn) |
| 202 |
WITH_IDN = 1 |
| 203 |
endif |
| 204 |
ifeq ($(findstring -ipv6,$(CFG)),-ipv6) |
| 205 |
ENABLE_IPV6 = 1 |
| 206 |
endif |
| 207 |
|
| 208 |
ifdef LINK_STATIC |
| 209 |
LDLIBS = $(CURL_LIB)/libcurl.$(LIBEXT) |
| 210 |
ifdef WITH_ARES |
| 211 |
LDLIBS += $(LIBCARES_PATH)/libcares.$(LIBEXT) |
| 212 |
endif |
| 213 |
else |
| 214 |
MODULES = libcurl.nlm |
| 215 |
IMPORTS = @$(CURL_LIB)/libcurl.imp |
| 216 |
endif |
| 217 |
ifdef 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 |
| 225 |
endif |
| 226 |
ifdef WITH_RTMP |
| 227 |
# INCLUDES += -I$(LIBRTMP_PATH) |
| 228 |
ifdef LINK_STATIC |
| 229 |
LDLIBS += $(LIBRTMP_PATH)/librtmp/librtmp.$(LIBEXT) |
| 230 |
endif |
| 231 |
endif |
| 232 |
ifdef 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 |
| 237 |
else |
| 238 |
endif |
| 239 |
ifdef WITH_ZLIB |
| 240 |
# INCLUDES += -I$(ZLIB_PATH) |
| 241 |
ifdef LINK_STATIC |
| 242 |
LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT) |
| 243 |
else |
| 244 |
MODULES += libz.nlm |
| 245 |
IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp |
| 246 |
endif |
| 247 |
endif |
| 248 |
ifdef WITH_IDN |
| 249 |
# INCLUDES += -I$(LIBIDN_PATH)/include |
| 250 |
LDLIBS += $(LIBIDN_PATH)/lib/libidn.$(LIBEXT) |
| 251 |
endif |
| 252 |
|
| 253 |
ifeq ($(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 |
| 258 |
else |
| 259 |
INCLUDES += -I$(NDK_CLIB)/include/nlm |
| 260 |
# INCLUDES += -I$(NDK_CLIB)/include |
| 261 |
endif |
| 262 |
ifndef DISABLE_LDAP |
| 263 |
# INCLUDES += -I$(NDK_LDAP)/$(LIBARCH_L)/inc |
| 264 |
endif |
| 265 |
CFLAGS += $(INCLUDES) |
| 266 |
|
| 267 |
ifeq ($(MTSAFE),YES) |
| 268 |
XDCOPT = -n |
| 269 |
endif |
| 270 |
ifeq ($(MTSAFE),NO) |
| 271 |
XDCOPT = -u |
| 272 |
endif |
| 273 |
ifdef XDCOPT |
| 274 |
XDCDATA = $(OBJDIR)/$(TARGET).xdc |
| 275 |
endif |
| 276 |
|
| 277 |
ifeq ($(findstring /sh,$(SHELL)),/sh) |
| 278 |
DL = ' |
| 279 |
DS = / |
| 280 |
PCT = % |
| 281 |
#-include $(NDKBASE)/nlmconv/ncpfs.inc |
| 282 |
else |
| 283 |
DS = \\ |
| 284 |
PCT = %% |
| 285 |
endif |
| 286 |
|
| 287 |
# Makefile.inc provides the CSOURCES and HHEADERS defines |
| 288 |
include Makefile.inc |
| 289 |
|
| 290 |
check_PROGRAMS := $(patsubst %,%.nlm,$(strip $(check_PROGRAMS))) |
| 291 |
|
| 292 |
.PRECIOUS: $(OBJDIR)/%.o $(OBJDIR)/%.def $(OBJDIR)/%.xdc |
| 293 |
|
| 294 |
|
| 295 |
all: prebuild $(check_PROGRAMS) |
| 296 |
|
| 297 |
prebuild: $(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 |
|
| 307 |
install: $(INSTDIR) all |
| 308 |
@$(CP) $(check_PROGRAMS) $(INSTDIR) |
| 309 |
|
| 310 |
clean: |
| 311 |
-$(RM) -r $(OBJDIR) |
| 312 |
|
| 313 |
distclean 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) >> $@ |
| 336 |
ifdef NLMTYPE |
| 337 |
@echo $(DL)type $(NLMTYPE)$(DL) >> $@ |
| 338 |
endif |
| 339 |
ifdef STACK |
| 340 |
@echo $(DL)stack $(STACK)$(DL) >> $@ |
| 341 |
endif |
| 342 |
ifdef SCREEN |
| 343 |
@echo $(DL)screenname "$(DESCR) $(notdir $(@:.def=)) $(SCREEN)"$(DL) >> $@ |
| 344 |
else |
| 345 |
@echo $(DL)screenname "DEFAULT"$(DL) >> $@ |
| 346 |
endif |
| 347 |
ifneq ($(DB),NDEBUG) |
| 348 |
@echo $(DL)debug$(DL) >> $@ |
| 349 |
endif |
| 350 |
@echo $(DL)threadname "_$(notdir $(@:.def=))"$(DL) >> $@ |
| 351 |
ifdef XDCDATA |
| 352 |
@echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@ |
| 353 |
endif |
| 354 |
ifeq ($(LDRING),0) |
| 355 |
@echo $(DL)flag_on 16$(DL) >> $@ |
| 356 |
endif |
| 357 |
ifeq ($(LDRING),3) |
| 358 |
@echo $(DL)flag_on 512$(DL) >> $@ |
| 359 |
endif |
| 360 |
ifeq ($(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) >> $@ |
| 368 |
ifndef 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) >> $@ |
| 373 |
endif |
| 374 |
else |
| 375 |
ifeq ($(POSIXFL),1) |
| 376 |
@echo $(DL)flag_on 4194304$(DL) >> $@ |
| 377 |
endif |
| 378 |
@echo $(DL)flag_on 64$(DL) >> $@ |
| 379 |
@echo $(DL)pseudopreemption$(DL) >> $@ |
| 380 |
ifeq ($(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) >> $@ |
| 384 |
else |
| 385 |
@echo $(DL)start _LibCPrelude$(DL) >> $@ |
| 386 |
@echo $(DL)exit _LibCPostlude$(DL) >> $@ |
| 387 |
@echo $(DL)check _LibCCheckUnload$(DL) >> $@ |
| 388 |
endif |
| 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) >> $@ |
| 392 |
ifndef 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) >> $@ |
| 397 |
endif |
| 398 |
endif |
| 399 |
ifdef MODULES |
| 400 |
@echo $(DL)module $(MODULES)$(DL) >> $@ |
| 401 |
endif |
| 402 |
ifdef EXPORTS |
| 403 |
@echo $(DL)export $(EXPORTS)$(DL) >> $@ |
| 404 |
endif |
| 405 |
ifdef IMPORTS |
| 406 |
@echo $(DL)import $(IMPORTS)$(DL) >> $@ |
| 407 |
endif |
| 408 |
ifeq ($(findstring nlmconv,$(LD)),nlmconv) |
| 409 |
@echo $(DL)input $(PRELUDE)$(DL) >> $@ |
| 410 |
@echo $(DL)input $(@:.def=.o)$(DL) >> $@ |
| 411 |
ifdef LDLIBS |
| 412 |
@echo $(DL)input $(LDLIBS)$(DL) >> $@ |
| 413 |
endif |
| 414 |
@echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@ |
| 415 |
endif |