Makefile.netware 12 KB

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