Makefile.netware 11 KB

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