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