2
0

Makefile.netware 11 KB

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