removed some obsolete include paths and defines.
[platform/upstream/c-ares.git] / Makefile.netware
1 #################################################################
2 # $Id$
3 #
4 ## Makefile for building libcares (NetWare version - gnu make)
5 ## Use: make -f Makefile.netware
6 ##
7 ## Comments to: Guenter Knauf http://www.gknw.de/phpbb
8 #
9 #################################################################
10
11 # Edit the path below to point to the base of your Novell NDK.
12 ifndef NDKBASE
13 NDKBASE = c:/novell
14 endif
15
16 ifndef INSTDIR
17 INSTDIR = ../curl-$(LIBCURL_VERSION_STR)-bin-nw
18 endif
19
20 # Edit the vars below to change NLM target settings.
21 TARGETS = adig.nlm ahost.nlm
22 LTARGET = libcares.$(LIBEXT)
23 VERSION = $(LIBCARES_VERSION)
24 COPYR   = Copyright (C) 1996 - 2007, Daniel Stenberg, <daniel@haxx.se>
25 DESCR   = cURL $(subst .def,,$(notdir $@)) $(LIBCARES_VERSION_STR) - http://curl.haxx.se
26 MTSAFE  = YES
27 STACK   = 64000
28 SCREEN  = none
29 #EXPORTS        =
30 # Comment the line below if you dont want to load protected automatically.
31 #LDRING = 3
32
33 # Edit the var below to point to your lib architecture.
34 ifndef LIBARCH
35 LIBARCH = LIBC
36 endif
37
38 # must be equal to NDEBUG or DEBUG, CURLDEBUG
39 ifndef DB
40 DB      = NDEBUG
41 endif
42 # Optimization: -O<n> or debugging: -g
43 ifeq ($(DB),NDEBUG)
44         OPT     = -O2
45         OBJDIR  = release
46 else
47         OPT     = -g
48         OBJDIR  = debug
49 endif
50
51 # Include the version info retrieved from curlver.h
52 -include $(OBJDIR)/version.inc
53
54 # The following line defines your compiler.
55 ifdef METROWERKS
56         # MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support
57         MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support
58         CC = mwccnlm
59 else
60         CC = gcc
61 endif
62 # a native win32 awk can be downloaded from here:
63 # http://www.gknw.net/development/prgtools/awk-20050424.zip
64 AWK     = awk
65 YACC    = bison -y
66 CP      = cp -afv
67 # RM    = rm -f
68 # if you want to mark the target as MTSAFE you will need a tool for
69 # generating the xdc data for the linker; here's a minimal tool:
70 # http://www.gknw.com/development/prgtools/mkxdc.zip
71 MPKXDC  = mkxdc
72
73 # Global flags for all compilers
74 CFLAGS  = $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc
75
76 ifeq ($(CC),mwccnlm)
77 LD      = mwldnlm
78 LDFLAGS = -nostdlib $(PRELUDE) $(OBJEXE) $(<:.def=.o) -o $@ -commandfile
79 AR      = mwldnlm
80 ARFLAGS = -nostdlib -type library -o
81 LIBEXT  = lib
82 #RANLIB =
83 CFLAGS  += -msgstyle gcc -gccinc -inline off -opt nointrinsics -proc 586
84 CFLAGS  += -relax_pointers
85 #CFLAGS += -w on
86 ifeq ($(LIBARCH),LIBC)
87         PRELUDE = $(SDK_LIBC)/imports/libcpre.o
88         CFLAGS += -align 4
89 else
90         # PRELUDE = $(SDK_CLIB)/imports/clibpre.o
91         # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
92         PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
93         # CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
94         CFLAGS += -align 1
95 endif
96 else
97 LD      = nlmconv
98 LDFLAGS = -T
99 AR      = ar
100 ARFLAGS = -cq
101 LIBEXT  = a
102 RANLIB  = ranlib
103 CFLAGS  += -fno-builtin -fpcc-struct-return -fno-strict-aliasing
104 CFLAGS  += -Wall -Wno-format -Wno-uninitialized # -pedantic
105 ifeq ($(LIBARCH),LIBC)
106         PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
107 else
108         # PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
109         # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
110         # http://www.gknw.net/development/mk_nlm/gcc_pre.zip
111         PRELUDE = $(NDK_ROOT)/pre/prelude.o
112         CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
113 endif
114 endif
115
116 NDK_ROOT = $(NDKBASE)/ndk
117 SDK_CLIB = $(NDK_ROOT)/nwsdk
118 SDK_LIBC = $(NDK_ROOT)/libc
119
120 ifeq ($(LIBARCH),LIBC)
121         INCLUDES += -I$(SDK_LIBC)/include
122         # INCLUDES += -I$(SDK_LIBC)/include/nks
123         # INCLUDES += -I$(SDK_LIBC)/include/winsock
124         CFLAGS += -D_POSIX_SOURCE
125 else
126         INCLUDES += -I$(SDK_CLIB)/include/nlm
127         # INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
128         # INCLUDES += -I$(SDK_CLIB)/include
129 endif
130 CFLAGS  += -I. $(INCLUDES)
131
132 ifeq ($(MTSAFE),YES)
133         XDCOPT = -n
134 endif
135 ifeq ($(MTSAFE),NO)
136         XDCOPT = -u
137 endif
138
139 ifeq ($(findstring linux,$(OSTYPE)),linux)
140 DL      = '
141 #-include $(NDKBASE)/nlmconv/ncpfs.inc
142 endif
143
144 # Makefile.inc provides the CSOURCES and HHEADERS defines
145 include Makefile.inc
146
147 OBJLIB  := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CSOURCES)))
148 OBJEXE  = $(OBJLIB) $(OBJDIR)/ares_getopt.o
149
150 .PHONY: lib nlm prebuild dist install clean
151
152 lib: prebuild $(LTARGET)
153
154 nlm: prebuild $(TARGETS)
155
156 prebuild: $(OBJDIR) $(OBJDIR)/version.inc config.h arpa/nameser.h
157
158 dist: all
159         -$(RM) $(OBJLIB) $(OBJDIR)/*.map $(OBJDIR)/*.ncv
160         -$(RM) $(OBJDIR)/*.def $(OBJDIR)/*.xdc $(OBJDIR)/version.inc
161
162 install: $(INSTDIR) all
163         @$(CP) *.nlm $(INSTDIR)
164         @$(CP) ../CHANGES $(INSTDIR)
165         @$(CP) ../COPYING $(INSTDIR)
166         @$(CP) ../README $(INSTDIR)
167         @$(CP) ../RELEASE-NOTES $(INSTDIR)
168
169 clean:
170         -$(RM) $(LTARGET) $(TARGETS) config.h
171         -$(RM) -r $(OBJDIR)
172         -$(RM) -r arpa
173
174 %.$(LIBEXT): $(OBJLIB)
175         @echo Creating $@
176         @-$(RM) $@
177         @$(AR) $(ARFLAGS) $@ $^
178 ifdef RANLIB
179         @$(RANLIB) $@
180 endif
181
182 %.nlm: $(OBJDIR)/%.def $(OBJDIR)/%.o $(OBJDIR)/%.xdc $(OBJEXE)
183         @echo Linking $@
184         @-$(RM) $@
185         @$(LD) $(LDFLAGS) $<
186
187 $(INSTDIR):
188         @mkdir $(INSTDIR)
189
190 $(OBJDIR):
191         @mkdir $(OBJDIR)
192
193 $(OBJDIR)/%.o: %.c
194 #       @echo Compiling $<
195         $(CC) $(CFLAGS) -c $< -o $@
196
197 $(OBJDIR)/version.inc: ares_version.h $(OBJDIR)
198         @echo Creating $@
199         @$(AWK) -f ../packages/NetWare/get_ver.awk $< > $@
200
201 $(OBJDIR)/%.xdc: Makefile.netware
202         @echo Creating $@
203         @$(MPKXDC) $(XDCOPT) $@
204
205 $(OBJDIR)/%.def: Makefile.netware
206         @echo Creating $@
207         @echo $(DL)# DEF file for linking with $(LD)$(DL) > $@
208         @echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@
209         @echo $(DL)# All your changes will be lost!!$(DL) >> $@
210         @echo $(DL)#$(DL) >> $@
211         @echo $(DL)copyright "$(COPYR)"$(DL) >> $@
212         @echo $(DL)description "$(DESCR)"$(DL) >> $@
213         @echo $(DL)version $(VERSION)$(DL) >> $@
214 ifdef NLMTYPE
215         @echo $(DL)type $(NLMTYPE)$(DL) >> $@
216 endif
217 ifdef STACK
218         @echo $(DL)stack $(STACK)$(DL) >> $@
219 endif
220 ifdef SCREEN
221         @echo $(DL)screenname "$(SCREEN)"$(DL) >> $@
222 else
223         @echo $(DL)screenname "DEFAULT"$(DL) >> $@
224 endif
225 ifeq ($(DB),DEBUG)
226         @echo $(DL)debug$(DL) >> $@
227 endif
228         @echo $(DL)threadname "$^"$(DL) >> $@
229 ifdef XDCOPT
230         @echo $(DL)xdcdata $(@:.def=.xdc)$(DL) >> $@
231 endif
232 ifeq ($(LDRING),0)
233         @echo $(DL)flag_on 16$(DL) >> $@
234 endif
235 ifeq ($(LDRING),3)
236         @echo $(DL)flag_on 512$(DL) >> $@
237 endif
238 ifeq ($(LIBARCH),CLIB)
239         @echo $(DL)start _Prelude$(DL) >> $@
240         @echo $(DL)exit _Stop$(DL) >> $@
241         @echo $(DL)import @$(SDK_CLIB)/imports/clib.imp$(DL) >> $@
242         @echo $(DL)import @$(SDK_CLIB)/imports/threads.imp$(DL) >> $@
243         @echo $(DL)import @$(SDK_CLIB)/imports/nlmlib.imp$(DL) >> $@
244         @echo $(DL)import @$(SDK_CLIB)/imports/socklib.imp$(DL) >> $@
245         @echo $(DL)module clib$(DL) >> $@
246 else
247         @echo $(DL)flag_on 64$(DL) >> $@
248         @echo $(DL)pseudopreemption$(DL) >> $@
249         @echo $(DL)start _LibCPrelude$(DL) >> $@
250         @echo $(DL)exit _LibCPostlude$(DL) >> $@
251         @echo $(DL)check _LibCCheckUnload$(DL) >> $@
252         @echo $(DL)import @$(SDK_LIBC)/imports/libc.imp$(DL) >> $@
253         @echo $(DL)import @$(SDK_LIBC)/imports/netware.imp$(DL) >> $@
254         @echo $(DL)module libc$(DL) >> $@
255 endif
256 ifdef MODULES
257         @echo $(DL)module $(MODULES)$(DL) >> $@
258 endif
259 ifdef EXPORTS
260         @echo $(DL)export $(EXPORTS)$(DL) >> $@
261 endif
262 ifdef IMPORTS
263         @echo $(DL)import $(IMPORTS)$(DL) >> $@
264 endif
265 ifeq ($(LD),nlmconv)
266         @echo $(DL)input $(OBJEXE)$(DL) >> $@
267         @echo $(DL)input $(PRELUDE)$(DL) >> $@
268         @echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@
269 endif
270
271 config.h: Makefile.netware
272         @echo Creating $@
273         @echo $(DL)/* $@ for NetWare target.$(DL) > $@
274         @echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@
275         @echo $(DL)** All your changes will be lost!!$(DL) >> $@
276         @echo $(DL)*/$(DL) >> $@
277         @echo $(DL)#ifndef NETWARE$(DL) >> $@
278         @echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@
279         @echo $(DL)#endif$(DL) >> $@
280         @echo $(DL)#define VERSION "$(LIBCARES_VERSION_STR)"$(DL) >> $@
281         @echo $(DL)#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"$(DL) >> $@
282 ifeq ($(LIBARCH),CLIB)
283         @echo $(DL)#define OS "i586-pc-clib-NetWare"$(DL) >> $@
284         @echo $(DL)#define MAXHOSTNAMELEN 256$(DL) >> $@
285         @echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@
286         @echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
287         @echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@
288         @echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@
289         @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
290         @echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@
291         @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
292         @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
293         @echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@
294         @echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
295         @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
296         @echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
297         @echo $(DL)#define DL_LDAP_FILE "ldapsdk.nlm"$(DL) >> $@
298         @echo $(DL)#define socklen_t int$(DL) >> $@
299         @echo $(DL)#define strncasecmp strnicmp$(DL) >> $@
300         @echo $(DL)#define strcasecmp stricmp$(DL) >> $@
301 else
302         @echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
303         @echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
304         @echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
305         @echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
306         @echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
307         @echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@
308         @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
309         @echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
310         @echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
311         @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
312         @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
313         @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
314         @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
315         @echo $(DL)#define HAVE_STRTOLL 1$(DL) >> $@
316         @echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
317         @echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
318         @echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
319         @echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
320         @echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@
321         @echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
322         @echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@
323         @echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
324         @echo $(DL)#define RECV_TYPE_ARG2 void *$(DL) >> $@
325         @echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@
326         @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
327         @echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@
328         @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
329         @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
330         @echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@
331         @echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@
332         @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
333         @echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@
334         @echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
335         @echo $(DL)#define DL_LDAP_FILE "lldapsdk.nlm"$(DL) >> $@
336 endif
337         @echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
338         @echo $(DL)#define HAVE_ARPA_NAMESER_H 1$(DL) >> $@
339         @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
340         @echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
341         @echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
342         @echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
343         @echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
344         @echo $(DL)#define HAVE_GETHOSTBYNAME 1$(DL) >> $@
345         @echo $(DL)#define HAVE_GETPROTOBYNAME 1$(DL) >> $@
346         @echo $(DL)#define HAVE_GMTIME_R 1$(DL) >> $@
347         @echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
348         @echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@
349         @echo $(DL)#define HAVE_LL 1$(DL) >> $@
350         @echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@
351         @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@
352         @echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@
353         @echo $(DL)#define HAVE_RECV 1$(DL) >> $@
354         @echo $(DL)#define HAVE_SELECT 1$(DL) >> $@
355         @echo $(DL)#define HAVE_SEND 1$(DL) >> $@
356         @echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@
357         @echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@
358         @echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@
359         @echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@
360         @echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@
361         @echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@
362         @echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@
363         @echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@
364         @echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@
365         @echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@
366         @echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@
367         @echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@
368         @echo $(DL)#define HAVE_SYS_IOCTL_H 1$(DL) >> $@
369         @echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@
370         @echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@
371         @echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@
372         @echo $(DL)#define HAVE_UNAME 1$(DL) >> $@
373         @echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@
374         @echo $(DL)#define HAVE_UTIME 1$(DL) >> $@
375         @echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@
376         @echo $(DL)#define RETSIGTYPE void$(DL) >> $@
377         @echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@
378         @echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
379         @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
380         @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
381 ifdef NW_WINSOCK
382         @echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
383 else
384         @echo $(DL)#define HAVE_SYS_TYPES_H 1$(DL) >> $@
385         @echo $(DL)#define HAVE_SYS_SOCKET_H 1$(DL) >> $@
386         @echo $(DL)#define HAVE_SYS_SOCKIO_H 1$(DL) >> $@
387         @echo $(DL)#define HAVE_NETDB_H 1$(DL) >> $@
388 endif
389         @echo $(DL)#ifdef __GNUC__$(DL) >> $@
390         @echo $(DL)#define HAVE_VARIADIC_MACROS_GCC 1$(DL) >> $@
391         @echo $(DL)#else$(DL) >> $@
392         @echo $(DL)#define HAVE_VARIADIC_MACROS_C99 1$(DL) >> $@
393         @echo $(DL)#endif$(DL) >> $@
394 ifdef OLD_NOVELLSDK
395         @echo $(DL)#define socklen_t int$(DL) >> $@
396 endif
397
398 arpa/nameser.h: nameser.h
399         @echo Fix missing header $@
400         @-mkdir arpa
401         @$(CP) $< arpa
402
403