• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) 2004 - 2014, Guenter Knauf, <http://www.gknw.net/phpbb>.
9# Copyright (C) 2001 - 2015, Daniel Stenberg, <daniel@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.
33ifndef NDKBASE
34NDKBASE	= c:/novell
35endif
36
37# Edit the path below to point to the base of your Zlib sources.
38ifndef ZLIB_PATH
39ZLIB_PATH = ../../zlib-1.2.8
40endif
41
42# Edit the path below to point to the base of your OpenSSL package.
43ifndef OPENSSL_PATH
44OPENSSL_PATH = ../../openssl-1.0.2a
45endif
46
47# Edit the path below to point to the base of your LibSSH2 package.
48ifndef LIBSSH2_PATH
49LIBSSH2_PATH = ../../libssh2-1.5.0
50endif
51
52# Edit the path below to point to the base of your axTLS package.
53ifndef AXTLS_PATH
54AXTLS_PATH = ../../axTLS-1.2.7
55endif
56
57# Edit the path below to point to the base of your libidn package.
58ifndef LIBIDN_PATH
59LIBIDN_PATH = ../../libidn-1.18
60endif
61
62# Edit the path below to point to the base of your librtmp package.
63ifndef LIBRTMP_PATH
64LIBRTMP_PATH = ../../librtmp-2.3
65endif
66
67# Edit the path below to point to the base of your nghttp2 package.
68ifndef NGHTTP2_PATH
69NGHTTP2_PATH = ../../nghttp2-0.6.7
70endif
71
72# Edit the path below to point to the base of your fbopenssl package.
73ifndef FBOPENSSL_PATH
74FBOPENSSL_PATH = ../../fbopenssl-0.4
75endif
76
77# Edit the path below to point to the base of your libmetalink package.
78ifndef LIBMETALINK_PATH
79LIBMETALINK_PATH = ../../libmetalink-0.1.2
80endif
81
82# Edit the path below to point to the base of your libexpat package.
83ifndef LIBEXPAT_PATH
84LIBEXPAT_PATH = ../../expat-2.1.0
85endif
86
87# Edit the path below to point to the base of your libXML2 package.
88ifndef LIBXML2_PATH
89LIBXML2_PATH = ../../libxml2-2.8.0
90endif
91
92# Edit the path below to point to the base of your c-ares package.
93ifndef LIBCARES_PATH
94LIBCARES_PATH = ../ares
95endif
96
97ifndef INSTDIR
98INSTDIR	= ..$(DS)curl-$(LIBCURL_VERSION_STR)-bin-nw
99endif
100
101# Edit the vars below to change NLM target settings.
102TARGET  = curl
103VERSION	= $(LIBCURL_VERSION)
104COPYR	= Copyright (C) $(LIBCURL_COPYRIGHT_STR)
105DESCR	= cURL $(LIBCURL_VERSION_STR) ($(LIBARCH)) - https://curl.haxx.se
106MTSAFE	= YES
107STACK	= 64000
108SCREEN	= $(TARGET) commandline utility
109# Comment the line below if you dont want to load protected automatically.
110# LDRING = 3
111
112# Uncomment the next line to enable linking with POSIX semantics.
113# POSIXFL = 1
114
115# Edit the var below to point to your lib architecture.
116ifndef LIBARCH
117LIBARCH = LIBC
118endif
119
120# must be equal to NDEBUG or DEBUG, CURLDEBUG
121ifndef DB
122DB	= NDEBUG
123endif
124# Optimization: -O<n> or debugging: -g
125ifeq ($(DB),NDEBUG)
126	OPT	= -O2
127	OBJDIR	= release
128else
129	OPT	= -g
130	OBJDIR	= debug
131endif
132
133# The following lines defines your compiler.
134ifdef CWFolder
135	METROWERKS = $(CWFolder)
136endif
137ifdef METROWERKS
138	# MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support
139	MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support
140	CC = mwccnlm
141else
142	CC = gcc
143endif
144PERL	= perl
145# Here you can find a native Win32 binary of the original awk:
146# http://www.gknw.net/development/prgtools/awk-20100523.zip
147AWK	= awk
148CP	= cp -afv
149MKDIR	= mkdir
150# RM	= rm -f
151# If you want to mark the target as MTSAFE you will need a tool for
152# generating the xdc data for the linker; here's a minimal tool:
153# http://www.gknw.net/development/prgtools/mkxdc.zip
154MPKXDC	= mkxdc
155
156# LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH))
157LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH))
158
159# Include the version info retrieved from curlver.h
160-include $(OBJDIR)/version.inc
161
162# Global flags for all compilers
163CFLAGS	+= $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc
164
165ifeq ($(CC),mwccnlm)
166LD	= mwldnlm
167LDFLAGS	= -nostdlib $(OBJS) $(PRELUDE) $(LDLIBS) -o $@ -commandfile
168LIBEXT	= lib
169CFLAGS	+= -gccinc -inline off -opt nointrinsics -proc 586
170CFLAGS	+= -relax_pointers
171#CFLAGS	+= -w on
172ifeq ($(LIBARCH),LIBC)
173ifeq ($(POSIXFL),1)
174	PRELUDE = $(NDK_LIBC)/imports/posixpre.o
175else
176	PRELUDE = $(NDK_LIBC)/imports/libcpre.o
177endif
178	CFLAGS += -align 4
179else
180	# PRELUDE = $(NDK_CLIB)/imports/clibpre.o
181	# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
182	PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
183	# CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
184	CFLAGS += -align 1
185endif
186else
187LD	= nlmconv
188LDFLAGS	= -T
189LIBEXT	= a
190CFLAGS	+= -m32
191CFLAGS  += -fno-builtin -fno-strict-aliasing
192ifeq ($(findstring gcc,$(CC)),gcc)
193CFLAGS  += -fpcc-struct-return
194endif
195CFLAGS	+= -Wall # -pedantic
196ifeq ($(LIBARCH),LIBC)
197ifeq ($(POSIXFL),1)
198	PRELUDE = $(NDK_LIBC)/imports/posixpre.gcc.o
199else
200	PRELUDE = $(NDK_LIBC)/imports/libcpre.gcc.o
201endif
202else
203	# PRELUDE = $(NDK_CLIB)/imports/clibpre.gcc.o
204	# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
205	# http://www.gknw.net/development/mk_nlm/gcc_pre.zip
206	PRELUDE = $(NDK_ROOT)/pre/prelude.o
207	CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
208endif
209endif
210
211NDK_ROOT = $(NDKBASE)/ndk
212ifndef NDK_CLIB
213NDK_CLIB = $(NDK_ROOT)/nwsdk
214endif
215ifndef NDK_LIBC
216NDK_LIBC = $(NDK_ROOT)/libc
217endif
218ifndef NDK_LDAP
219NDK_LDAP = $(NDK_ROOT)/cldapsdk/netware
220endif
221CURL_INC = ../include
222CURL_LIB = ../lib
223
224INCLUDES = -I$(CURL_INC) -I$(CURL_LIB)
225
226ifeq ($(findstring -static,$(CFG)),-static)
227LINK_STATIC = 1
228endif
229ifeq ($(findstring -ares,$(CFG)),-ares)
230WITH_ARES = 1
231endif
232ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
233WITH_RTMP = 1
234WITH_SSL = 1
235WITH_ZLIB = 1
236endif
237ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
238WITH_SSH2 = 1
239WITH_SSL = 1
240WITH_ZLIB = 1
241endif
242ifeq ($(findstring -axtls,$(CFG)),-axtls)
243WITH_AXTLS = 1
244WITH_SSL =
245else
246ifeq ($(findstring -ssl,$(CFG)),-ssl)
247WITH_SSL = 1
248endif
249endif
250ifeq ($(findstring -zlib,$(CFG)),-zlib)
251WITH_ZLIB = 1
252endif
253ifeq ($(findstring -idn,$(CFG)),-idn)
254WITH_IDN = 1
255endif
256ifeq ($(findstring -metalink,$(CFG)),-metalink)
257WITH_METALINK = 1
258WITH_SSL = 1
259endif
260ifeq ($(findstring -nghttp2,$(CFG)),-nghttp2)
261WITH_NGHTTP2 = 1
262endif
263ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
264ENABLE_IPV6 = 1
265endif
266
267ifdef LINK_STATIC
268	LDLIBS	= $(CURL_LIB)/libcurl.$(LIBEXT)
269ifdef WITH_ARES
270	LDLIBS += $(LIBCARES_PATH)/libcares.$(LIBEXT)
271endif
272else
273	MODULES	= libcurl.nlm
274	IMPORTS	= @$(CURL_LIB)/libcurl.imp
275endif
276ifdef WITH_SSH2
277	# INCLUDES += -I$(LIBSSH2_PATH)/include
278ifdef LINK_STATIC
279	LDLIBS += $(LIBSSH2_PATH)/nw/libssh2.$(LIBEXT)
280else
281	MODULES += libssh2.nlm
282	IMPORTS += @$(LIBSSH2_PATH)/nw/libssh2.imp
283endif
284endif
285ifdef WITH_RTMP
286	# INCLUDES += -I$(LIBRTMP_PATH)
287ifdef LINK_STATIC
288	LDLIBS += $(LIBRTMP_PATH)/librtmp/librtmp.$(LIBEXT)
289endif
290endif
291ifdef WITH_SSL
292	# INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)
293	LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT)
294	LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT)
295	IMPORTS += GetProcessSwitchCount RunningProcess
296else
297ifdef WITH_AXTLS
298	# INCLUDES += -I$(AXTLS_PATH)/inc
299ifdef LINK_STATIC
300	LDLIBS += $(AXTLS_PATH)/lib/libaxtls.$(LIBEXT)
301else
302	MODULES += libaxtls.nlm
303	IMPORTS += $(AXTLS_PATH)/lib/libaxtls.imp
304endif
305endif
306endif
307ifdef WITH_ZLIB
308	INCLUDES += -I$(ZLIB_PATH)
309ifdef LINK_STATIC
310	LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT)
311else
312	MODULES += libz.nlm
313	IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp
314endif
315endif
316ifdef WITH_IDN
317	# INCLUDES += -I$(LIBIDN_PATH)/include
318	LDLIBS += $(LIBIDN_PATH)/lib/libidn.$(LIBEXT)
319endif
320ifdef WITH_NGHTTP2
321	INCLUDES += -I$(NGHTTP2_PATH)/include
322	LDLIBS += $(NGHTTP2_PATH)/lib/libnghttp2.$(LIBEXT)
323endif
324ifdef WITH_METALINK
325	CFLAGS += -DUSE_METALINK
326	INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)
327	INCLUDES += -I$(LIBMETALINK_PATH)/include
328	LDLIBS += $(LIBMETALINK_PATH)/lib/libmetalink.$(LIBEXT)
329ifdef WITH_LIBEXPAT
330	ifeq ($(LIBARCH),LIBC)
331		IMPORTS += @$(LIBEXPAT_PATH)/imports/expatlbc.imp
332		MODULES += expatlbc
333	else
334		IMPORTS += @$(LIBEXPAT_PATH)/imports/expatlib.imp
335		MODULES += expatlib
336	endif
337else
338ifdef WITH_LIBXML2
339	IMPORTS += @$(LIBXML2_PATH)/lib/libxml2.imp
340	MODULES += libxml2
341endif
342endif
343endif
344
345ifeq ($(LIBARCH),LIBC)
346	INCLUDES += -I$(NDK_LIBC)/include
347	# INCLUDES += -I$(NDK_LIBC)/include/nks
348	# INCLUDES += -I$(NDK_LIBC)/include/winsock
349	CFLAGS += -D_POSIX_SOURCE
350else
351	INCLUDES += -I$(NDK_CLIB)/include/nlm
352	# INCLUDES += -I$(NDK_CLIB)/include
353endif
354ifndef DISABLE_LDAP
355	# INCLUDES += -I$(NDK_LDAP)/$(LIBARCH_L)/inc
356endif
357CFLAGS	+= $(INCLUDES)
358
359ifeq ($(MTSAFE),YES)
360	XDCOPT = -n
361endif
362ifeq ($(MTSAFE),NO)
363	XDCOPT = -u
364endif
365ifdef XDCOPT
366	XDCDATA = $(OBJDIR)/$(TARGET).xdc
367endif
368
369ifeq ($(findstring /sh,$(SHELL)),/sh)
370DL	= '
371DS	= /
372PCT	= %
373#-include $(NDKBASE)/nlmconv/ncpfs.inc
374else
375DS	= \\
376PCT	= %%
377endif
378
379# Makefile.inc provides the CSOURCES and HHEADERS defines
380include Makefile.inc
381
382OBJX	:= $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(strip $(CURLX_CFILES))))
383OBJS	:= $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CURL_CFILES)))
384ifndef LINK_STATIC
385OBJS	+= $(OBJX)
386endif
387
388vpath %.c $(CURL_LIB)
389
390all: prebuild $(TARGET).nlm
391
392prebuild: $(OBJDIR) $(OBJDIR)/version.inc
393
394$(OBJDIR)/%.o: %.c
395#	@echo Compiling $<
396	$(CC) $(CFLAGS) -c $< -o $@
397
398$(OBJDIR)/version.inc: $(CURL_INC)/curl/curlver.h $(OBJDIR)
399	@echo Creating $@
400	@$(AWK) -f ../packages/NetWare/get_ver.awk $< > $@
401
402install: $(INSTDIR) all
403	@-$(CP) ../docs/$(TARGET).pdf $(INSTDIR)
404	@-$(CP) ../docs/$(TARGET).html $(INSTDIR)
405	@$(CP) $(TARGET).nlm $(INSTDIR)
406
407clean:
408ifeq "$(wildcard tool_hugehelp.c.cvs)" "tool_hugehelp.c.cvs"
409	-$(RM) tool_hugehelp.c
410endif
411	-$(RM) -r $(OBJDIR)
412
413distclean vclean: clean
414	-$(RM) $(TARGET).nlm
415
416$(OBJDIR) $(INSTDIR):
417	@$(MKDIR) $@
418
419$(TARGET).nlm: $(OBJS) $(OBJDIR)/$(TARGET).def $(XDCDATA)
420	@echo Linking $@
421	@-$(RM) $@
422	@$(LD) $(LDFLAGS) $(OBJDIR)/$(TARGET).def
423
424$(OBJDIR)/%.xdc: Makefile.netware
425	@echo Creating $@
426	@$(MPKXDC) $(XDCOPT) $@
427
428$(OBJDIR)/%.def: Makefile.netware
429	@echo $(DL)# DEF file for linking with $(LD)$(DL) > $@
430	@echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@
431	@echo $(DL)# All your changes will be lost!!$(DL) >> $@
432	@echo $(DL)#$(DL) >> $@
433	@echo $(DL)copyright "$(COPYR)"$(DL) >> $@
434	@echo $(DL)description "$(DESCR)"$(DL) >> $@
435	@echo $(DL)version $(VERSION)$(DL) >> $@
436ifdef NLMTYPE
437	@echo $(DL)type $(NLMTYPE)$(DL) >> $@
438endif
439ifdef STACK
440	@echo $(DL)stack $(STACK)$(DL) >> $@
441endif
442ifdef SCREEN
443	@echo $(DL)screenname "$(SCREEN)"$(DL) >> $@
444else
445	@echo $(DL)screenname "DEFAULT"$(DL) >> $@
446endif
447ifneq ($(DB),NDEBUG)
448	@echo $(DL)debug$(DL) >> $@
449endif
450	@echo $(DL)threadname "$(TARGET)"$(DL) >> $@
451ifdef XDCDATA
452	@echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@
453endif
454ifeq ($(LDRING),0)
455	@echo $(DL)flag_on 16$(DL) >> $@
456endif
457ifeq ($(LDRING),3)
458	@echo $(DL)flag_on 512$(DL) >> $@
459endif
460ifeq ($(LIBARCH),CLIB)
461	@echo $(DL)start _Prelude$(DL) >> $@
462	@echo $(DL)exit _Stop$(DL) >> $@
463	@echo $(DL)import @$(NDK_CLIB)/imports/clib.imp$(DL) >> $@
464	@echo $(DL)import @$(NDK_CLIB)/imports/threads.imp$(DL) >> $@
465	@echo $(DL)import @$(NDK_CLIB)/imports/nlmlib.imp$(DL) >> $@
466	@echo $(DL)import @$(NDK_CLIB)/imports/socklib.imp$(DL) >> $@
467	@echo $(DL)module clib$(DL) >> $@
468ifndef DISABLE_LDAP
469	@echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapsdk.imp$(DL) >> $@
470	@echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapssl.imp$(DL) >> $@
471#	@echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@
472	@echo $(DL)module ldapsdk ldapssl$(DL) >> $@
473endif
474else
475ifeq ($(POSIXFL),1)
476	@echo $(DL)flag_on 4194304$(DL) >> $@
477endif
478	@echo $(DL)flag_on 64$(DL) >> $@
479	@echo $(DL)pseudopreemption$(DL) >> $@
480ifeq ($(findstring posixpre,$(PRELUDE)),posixpre)
481	@echo $(DL)start POSIX_Start$(DL) >> $@
482	@echo $(DL)exit POSIX_Stop$(DL) >> $@
483	@echo $(DL)check POSIX_CheckUnload$(DL) >> $@
484else
485	@echo $(DL)start _LibCPrelude$(DL) >> $@
486	@echo $(DL)exit _LibCPostlude$(DL) >> $@
487	@echo $(DL)check _LibCCheckUnload$(DL) >> $@
488endif
489	@echo $(DL)import @$(NDK_LIBC)/imports/libc.imp$(DL) >> $@
490	@echo $(DL)import @$(NDK_LIBC)/imports/netware.imp$(DL) >> $@
491	@echo $(DL)module libc$(DL) >> $@
492ifndef DISABLE_LDAP
493	@echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapsdk.imp$(DL) >> $@
494	@echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapssl.imp$(DL) >> $@
495#	@echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapx.imp$(DL) >> $@
496	@echo $(DL)module lldapsdk lldapssl$(DL) >> $@
497endif
498endif
499ifdef MODULES
500	@echo $(DL)module $(MODULES)$(DL) >> $@
501endif
502ifdef EXPORTS
503	@echo $(DL)export $(EXPORTS)$(DL) >> $@
504endif
505ifdef IMPORTS
506	@echo $(DL)import $(IMPORTS)$(DL) >> $@
507endif
508ifeq ($(findstring nlmconv,$(LD)),nlmconv)
509	@echo $(DL)input $(PRELUDE)$(DL) >> $@
510	@echo $(DL)input $(OBJS)$(DL) >> $@
511ifdef LDLIBS
512	@echo $(DL)input $(LDLIBS)$(DL) >> $@
513endif
514	@echo $(DL)output $(TARGET).nlm$(DL) >> $@
515endif
516
517tool_hugehelp.c:
518	@echo Creating $@
519	@$(CP) tool_hugehelp.c.cvs $@
520
521$(LIBCARES_PATH)/libcares.$(LIBEXT):
522	$(MAKE) -C $(LIBCARES_PATH) -f Makefile.netware lib
523
524
525