Home | History | Annotate | Download | only in src
      1 #***************************************************************************
      2 #                                  _   _ ____  _
      3 #  Project                     ___| | | |  _ \| |
      4 #                             / __| | | | |_) | |
      5 #                            | (__| |_| |  _ <| |___
      6 #                             \___|\___/|_| \_\_____|
      7 #
      8 # Copyright (C) 2004 - 2014, Guenter Knauf
      9 # Copyright (C) 2001 - 2018, Daniel Stenberg, <daniel (a] 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 libidn package.
     53 ifndef LIBIDN_PATH
     54 LIBIDN_PATH = ../../libidn-1.18
     55 endif
     56 
     57 # Edit the path below to point to the base of your librtmp package.
     58 ifndef LIBRTMP_PATH
     59 LIBRTMP_PATH = ../../librtmp-2.3
     60 endif
     61 
     62 # Edit the path below to point to the base of your nghttp2 package.
     63 ifndef NGHTTP2_PATH
     64 NGHTTP2_PATH = ../../nghttp2-0.6.7
     65 endif
     66 
     67 # Edit the path below to point to the base of your fbopenssl package.
     68 ifndef FBOPENSSL_PATH
     69 FBOPENSSL_PATH = ../../fbopenssl-0.4
     70 endif
     71 
     72 # Edit the path below to point to the base of your libmetalink package.
     73 ifndef LIBMETALINK_PATH
     74 LIBMETALINK_PATH = ../../libmetalink-0.1.2
     75 endif
     76 
     77 # Edit the path below to point to the base of your libexpat package.
     78 ifndef LIBEXPAT_PATH
     79 LIBEXPAT_PATH = ../../expat-2.1.0
     80 endif
     81 
     82 # Edit the path below to point to the base of your libXML2 package.
     83 ifndef LIBXML2_PATH
     84 LIBXML2_PATH = ../../libxml2-2.8.0
     85 endif
     86 
     87 # Edit the path below to point to the base of your c-ares package.
     88 ifndef LIBCARES_PATH
     89 LIBCARES_PATH = ../ares
     90 endif
     91 
     92 ifndef INSTDIR
     93 INSTDIR = ..$(DS)curl-$(LIBCURL_VERSION_STR)-bin-nw
     94 endif
     95 
     96 # Edit the vars below to change NLM target settings.
     97 TARGET  = curl
     98 VERSION = $(LIBCURL_VERSION)
     99 COPYR   = Copyright (C) $(LIBCURL_COPYRIGHT_STR)
    100 DESCR   = curl $(LIBCURL_VERSION_STR) ($(LIBARCH)) - https://curl.haxx.se
    101 MTSAFE  = YES
    102 STACK   = 64000
    103 SCREEN  = $(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.
    111 ifndef LIBARCH
    112 LIBARCH = LIBC
    113 endif
    114 
    115 # must be equal to NDEBUG or DEBUG, CURLDEBUG
    116 ifndef DB
    117 DB = NDEBUG
    118 endif
    119 # Optimization: -O<n> or debugging: -g
    120 ifeq ($(DB),NDEBUG)
    121   OPT = -O2
    122   OBJDIR = release
    123 else
    124   OPT = -g
    125   OBJDIR = debug
    126 endif
    127 
    128 # The following lines defines your compiler.
    129 ifdef CWFolder
    130   METROWERKS = $(CWFolder)
    131 endif
    132 ifdef METROWERKS
    133   # MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support
    134   MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support
    135   CC = mwccnlm
    136 else
    137   CC = gcc
    138 endif
    139 PERL = perl
    140 # Here you can find a native Win32 binary of the original awk:
    141 # http://www.gknw.net/development/prgtools/awk-20100523.zip
    142 AWK = awk
    143 CP  = cp -afv
    144 MKDIR = 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
    149 MPKXDC = mkxdc
    150 
    151 # LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH))
    152 LIBARCH_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
    158 CFLAGS += $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc
    159 
    160 ifeq ($(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
    181 else
    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
    204 endif
    205 
    206 NDK_ROOT = $(NDKBASE)/ndk
    207 ifndef NDK_CLIB
    208 NDK_CLIB = $(NDK_ROOT)/nwsdk
    209 endif
    210 ifndef NDK_LIBC
    211 NDK_LIBC = $(NDK_ROOT)/libc
    212 endif
    213 ifndef NDK_LDAP
    214 NDK_LDAP = $(NDK_ROOT)/cldapsdk/netware
    215 endif
    216 CURL_INC = ../include
    217 CURL_LIB = ../lib
    218 
    219 INCLUDES = -I$(CURL_INC) -I$(CURL_LIB)
    220 
    221 ifeq ($(findstring -static,$(CFG)),-static)
    222 LINK_STATIC = 1
    223 endif
    224 ifeq ($(findstring -ares,$(CFG)),-ares)
    225 WITH_ARES = 1
    226 endif
    227 ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
    228 WITH_RTMP = 1
    229 WITH_SSL = 1
    230 WITH_ZLIB = 1
    231 endif
    232 ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
    233 WITH_SSH2 = 1
    234 WITH_SSL = 1
    235 WITH_ZLIB = 1
    236 endif
    237 ifeq ($(findstring -ssl,$(CFG)),-ssl)
    238 WITH_SSL = 1
    239 endif
    240 ifeq ($(findstring -zlib,$(CFG)),-zlib)
    241 WITH_ZLIB = 1
    242 endif
    243 ifeq ($(findstring -idn,$(CFG)),-idn)
    244 WITH_IDN = 1
    245 endif
    246 ifeq ($(findstring -metalink,$(CFG)),-metalink)
    247 WITH_METALINK = 1
    248 WITH_SSL = 1
    249 endif
    250 ifeq ($(findstring -nghttp2,$(CFG)),-nghttp2)
    251 WITH_NGHTTP2 = 1
    252 endif
    253 ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
    254 ENABLE_IPV6 = 1
    255 endif
    256 
    257 ifdef LINK_STATIC
    258   LDLIBS = $(CURL_LIB)/libcurl.$(LIBEXT)
    259 ifdef WITH_ARES
    260   LDLIBS += $(LIBCARES_PATH)/libcares.$(LIBEXT)
    261 endif
    262 else
    263   MODULES  = libcurl.nlm
    264   IMPORTS = @$(CURL_LIB)/libcurl.imp
    265 endif
    266 ifdef 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
    274 endif
    275 ifdef WITH_RTMP
    276   # INCLUDES += -I$(LIBRTMP_PATH)
    277   ifdef LINK_STATIC
    278     LDLIBS += $(LIBRTMP_PATH)/librtmp/librtmp.$(LIBEXT)
    279   endif
    280 endif
    281 ifdef 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
    286 endif
    287 ifdef 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
    295 endif
    296 ifdef WITH_IDN
    297   # INCLUDES += -I$(LIBIDN_PATH)/include
    298   LDLIBS += $(LIBIDN_PATH)/lib/libidn.$(LIBEXT)
    299 endif
    300 ifdef WITH_NGHTTP2
    301   INCLUDES += -I$(NGHTTP2_PATH)/include
    302   LDLIBS += $(NGHTTP2_PATH)/lib/libnghttp2.$(LIBEXT)
    303 endif
    304 ifdef 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
    317 else
    318 ifdef WITH_LIBXML2
    319   IMPORTS += @$(LIBXML2_PATH)/lib/libxml2.imp
    320   MODULES += libxml2
    321 endif
    322 endif
    323 endif
    324 
    325 ifeq ($(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
    330 else
    331   INCLUDES += -I$(NDK_CLIB)/include/nlm
    332   # INCLUDES += -I$(NDK_CLIB)/include
    333 endif
    334 ifndef DISABLE_LDAP
    335   # INCLUDES += -I$(NDK_LDAP)/$(LIBARCH_L)/inc
    336 endif
    337 CFLAGS += $(INCLUDES)
    338 
    339 ifeq ($(MTSAFE),YES)
    340   XDCOPT = -n
    341 endif
    342 ifeq ($(MTSAFE),NO)
    343   XDCOPT = -u
    344 endif
    345 ifdef XDCOPT
    346   XDCDATA = $(OBJDIR)/$(TARGET).xdc
    347 endif
    348 
    349 ifeq ($(findstring /sh,$(SHELL)),/sh)
    350 DL  = '
    351 DS  = /
    352 PCT = %
    353 #-include $(NDKBASE)/nlmconv/ncpfs.inc
    354 else
    355 DS  = \\
    356 PCT = %%
    357 endif
    358 
    359 # Makefile.inc provides the CSOURCES and HHEADERS defines
    360 include Makefile.inc
    361 
    362 OBJX := $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(strip $(CURLX_CFILES))))
    363 OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CURL_CFILES)))
    364 ifndef LINK_STATIC
    365 OBJS += $(OBJX)
    366 endif
    367 
    368 vpath %.c $(CURL_LIB)
    369 
    370 all: prebuild $(TARGET).nlm
    371 
    372 prebuild: $(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 
    382 install: $(INSTDIR) all
    383 	@-$(CP) ../docs/$(TARGET).pdf $(INSTDIR)
    384 	@-$(CP) ../docs/$(TARGET).html $(INSTDIR)
    385 	@$(CP) $(TARGET).nlm $(INSTDIR)
    386 
    387 clean:
    388 ifeq "$(wildcard tool_hugehelp.c.cvs)" "tool_hugehelp.c.cvs"
    389 	-$(RM) tool_hugehelp.c
    390 endif
    391 	-$(RM) -r $(OBJDIR)
    392 
    393 distclean 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) >> $@
    416 ifdef NLMTYPE
    417 	@echo $(DL)type $(NLMTYPE)$(DL) >> $@
    418 endif
    419 ifdef STACK
    420 	@echo $(DL)stack $(STACK)$(DL) >> $@
    421 endif
    422 ifdef SCREEN
    423 	@echo $(DL)screenname "$(SCREEN)"$(DL) >> $@
    424 else
    425 	@echo $(DL)screenname "DEFAULT"$(DL) >> $@
    426 endif
    427 ifneq ($(DB),NDEBUG)
    428 	@echo $(DL)debug$(DL) >> $@
    429 endif
    430 	@echo $(DL)threadname "$(TARGET)"$(DL) >> $@
    431 ifdef XDCDATA
    432 	@echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@
    433 endif
    434 ifeq ($(LDRING),0)
    435 	@echo $(DL)flag_on 16$(DL) >> $@
    436 endif
    437 ifeq ($(LDRING),3)
    438 	@echo $(DL)flag_on 512$(DL) >> $@
    439 endif
    440 ifeq ($(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) >> $@
    448 ifndef 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) >> $@
    453 endif
    454 else
    455 ifeq ($(POSIXFL),1)
    456 	@echo $(DL)flag_on 4194304$(DL) >> $@
    457 endif
    458 	@echo $(DL)flag_on 64$(DL) >> $@
    459 	@echo $(DL)pseudopreemption$(DL) >> $@
    460 ifeq ($(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) >> $@
    464 else
    465 	@echo $(DL)start _LibCPrelude$(DL) >> $@
    466 	@echo $(DL)exit _LibCPostlude$(DL) >> $@
    467 	@echo $(DL)check _LibCCheckUnload$(DL) >> $@
    468 endif
    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) >> $@
    472 ifndef 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) >> $@
    477 endif
    478 endif
    479 ifdef MODULES
    480 	@echo $(DL)module $(MODULES)$(DL) >> $@
    481 endif
    482 ifdef EXPORTS
    483 	@echo $(DL)export $(EXPORTS)$(DL) >> $@
    484 endif
    485 ifdef IMPORTS
    486 	@echo $(DL)import $(IMPORTS)$(DL) >> $@
    487 endif
    488 ifeq ($(findstring nlmconv,$(LD)),nlmconv)
    489 	@echo $(DL)input $(PRELUDE)$(DL) >> $@
    490 	@echo $(DL)input $(OBJS)$(DL) >> $@
    491 ifdef LDLIBS
    492 	@echo $(DL)input $(LDLIBS)$(DL) >> $@
    493 endif
    494 	@echo $(DL)output $(TARGET).nlm$(DL) >> $@
    495 endif
    496 
    497 tool_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