]> granicus.if.org Git - apache/blob - build/NWGNUenvironment.inc
Merge the AP_OPENSSL_USE_ERRNO_THREADID check to trunk for wider testing
[apache] / build / NWGNUenvironment.inc
1 #
2 # Setup needed Tools and Libraries
3 #
4
5 ifeq "$(wildcard $(AP_WORK)/NWGNUcustom.ini)" "$(AP_WORK)/NWGNUcustom.ini"
6 include $(AP_WORK)/NWGNUcustom.ini
7 CUSTOM_INI = $(AP_WORK)/NWGNUcustom.ini
8 endif
9
10 ifndef VERBOSE
11 .SILENT:
12 endif
13
14 #
15 # Treat like an include
16 #
17 ifndef EnvironmentDefined
18
19 #
20 # simple macros for parsing makefiles
21 #
22 EOLIST:=
23 EMPTY :=
24 COMMA := ,
25 SPACE := $(EMPTY) $(EMPTY)
26
27 #
28 # Base environment
29 #
30
31 # Try and handle case issues
32 ifndef NOVELLLIBC
33 ifdef NovellLibC
34 NOVELLLIBC = $(NovellLibC)
35 endif
36 endif
37
38 ifndef NOVELLLIBC
39 NOVELLLIBC = C:/novell/ndk/libc
40 endif
41 ifneq "$(wildcard $(NOVELLLIBC)/include/ndkvers.h)" "$(NOVELLLIBC)/include/ndkvers.h"
42 $(error NOVELLLIBC does not point to a valid Novell LIBC SDK) 
43 endif
44
45 ifndef LDAPSDK
46 LDAPSDK = C:/novell/ndk/cldapsdk/NetWare/libc
47 endif
48 ifneq "$(wildcard $(LDAPSDK)/inc/ldap.h)" "$(LDAPSDK)/inc/ldap.h"
49 $(error LDAPSDK does not point to a valid Novell CLDAP SDK) 
50 endif
51
52 ifdef WITH_HTTP2
53 ifneq "$(wildcard $(NGH2SRC)/lib/nghttp2_hd.h)" "$(NGH2SRC)/lib/nghttp2_hd.h"
54 $(error NGH2SRC does not point to a valid NGHTTP2 source tree)
55 endif
56 endif
57
58 ifndef PCRESRC
59 PCRESRC = $(AP_WORK)/srclib/pcre
60 endif
61 ifneq "$(wildcard $(PCRESRC)/pcre-config.in)" "$(PCRESRC)/pcre-config.in"
62 $(error PCRESRC does not point to a valid PCRE source tree) 
63 endif
64
65 # This is a placeholder
66 # ifndef ZLIBSDK
67 # ZLIBSDK = C:/novell/ndk/zlibsdk
68 # endif
69
70 ifndef METROWERKS
71 METROWERKS = $(ProgramFiles)\Metrowerks\CodeWarrior
72 endif
73
74 # If LM_LICENSE_FILE isn't defined, define a variable that can be used to
75 # restart make with it defined
76 ifndef LM_LICENSE_FILE
77 NO_LICENSE_FILE = NO_LICENSE_FILE
78 endif
79
80 #
81 # Set the Release type that you want to build, possible values are:
82 #
83 #  debug        - full debug switches are set
84 #  noopt        - normal switches are set
85 #  release      - optimization switches are set (default)
86
87 ifdef reltype
88 RELEASE = $(reltype)
89 endif    
90
91 ifdef RELTYPE
92 RELEASE = $(RELTYPE)
93 endif
94
95 ifdef debug
96 RELEASE = debug
97 endif
98
99 ifdef DEBUG
100 RELEASE = debug
101 endif
102
103 ifdef noopt
104 RELEASE = noopt
105 endif
106
107 ifdef NOOPT
108 RELEASE = noopt
109 endif
110
111 ifdef optimized
112 RELEASE = release
113 endif
114
115 ifdef OPTIMIZED
116 RELEASE = release
117 endif
118
119 ifndef RELEASE
120 RELEASE = release
121 endif
122
123 OBJDIR = obj_$(RELEASE)
124
125 # Define minimum APR version to check for
126 APR_WANTED = 1004000
127
128 #
129 # Setup compiler information
130 #
131
132 # MetroWerks NLM tools
133 CC      = mwccnlm
134 CPP     = mwccnlm
135 LINK    = mwldnlm
136 LIB     = mwldnlm -type library -w nocmdline
137 WIN_CC  = mwcc
138
139 # Setup build tools
140 AWK     = awk
141
142 # Setup distribution tools
143 ZIP     = zip -qr9
144 7ZA     = 7za >NUL a
145
146 #
147 # Declare Command and tool macros here
148 #
149
150 ifeq ($(findstring /sh,$(SHELL)),/sh)
151 DEL     = rm -f $1
152 RMDIR   = rm -fr $1
153 MKDIR   = mkdir -p $1
154 COPY    = -cp -afv $1 $2
155 #COPYR  = -cp -afr $1/* $2
156 COPYR   = -rsync -aC $1/* $2
157 TOUCH   = -touch $1
158 ECHONL  = echo ""
159 DL      = '
160 CAT     = cat
161 else
162 ifeq "$(OS)" "Windows_NT"
163 DEL     = $(shell if exist $(subst /,\,$1) del /q /f 2>NUL $(subst /,\,$1))
164 RMDIR   = $(shell if exist $(subst /,\,$1)\NUL rd /q /s 2>NUL $(subst /,\,$1))
165 else
166 DEL     = $(shell if exist $(subst /,\,$1) del 2>NUL $(subst /,\,$1))
167 RMDIR   = $(shell if exist $(subst /,\,$1)\NUL deltree /y 2>NUL $(subst /,\,$1))
168 endif
169 ECHONL  = $(ComSpec) /c echo.
170 MKDIR   = $(shell if not exist $(subst /,\,$1)\NUL md 2>NUL $(subst /,\,$1))
171 COPY    = -copy /y 2>NUL $(subst /,\,$1) $(subst /,\,$2)
172 COPYR   = -xcopy /q /y /e 2>NUL $(subst /,\,$1) $(subst /,\,$2)
173 TOUCH   = -copy /b 2>&1>NUL $(subst /,\,$1) +,,
174 CAT     = type
175 endif
176
177 ifdef IPV6
178 ifndef USE_STDSOCKETS
179 USE_STDSOCKETS=1
180 endif
181 endif
182
183 NOVI    = $(NOVELLLIBC)/imports
184 PRELUDE = $(NOVI)/libcpre.o
185
186 INCDIRS = $(NOVELLLIBC)/include;
187 ifndef USE_STDSOCKETS
188 INCDIRS += $(NOVELLLIBC)/include/winsock;
189 endif
190 ifneq "$(LDAPSDK)" ""
191 INCDIRS += $(LDAPSDK)/inc;
192 endif
193 ifneq "$(ZLIBSDK)" ""
194 INCDIRS += $(ZLIBSDK);
195 endif
196 ifneq "$(PCRESRC)" ""
197 INCDIRS += $(PCRESRC);
198 endif
199
200 DEFINES = -DNETWARE 
201 ifndef USE_STDSOCKETS
202 DEFINES += -DUSE_WINSOCK
203 endif
204 ifndef DEBUG
205 DEFINES += -DNDEBUG
206 endif
207
208 ifdef USE_STDSOCKETS
209 VERSION_SKT = (BSDSOCK)
210 else
211 VERSION_SKT = (WINSOCK)
212 endif
213
214 # MetroWerks static Libraries
215 CLIB3S  = $(METROWERKS)/Novell Support/Metrowerks Support/Libraries/Runtime/mwcrtl.lib
216 MATH3S  =
217 PLIB3S  = $(METROWERKS)/Novell Support/Metrowerks Support/Libraries/MSL C++/MWCPP.lib
218
219 ifeq "$(OS)" "Windows_NT"
220 # MetroWerks Win32 build flags to create build tools
221 MWCW_MSL         = "$(METROWERKS)/MSL"
222 MWCW_W32         = "$(METROWERKS)/Win32-x86 Support"
223 CC_FOR_BUILD     = $(WIN_CC)
224 CFLAGS_FOR_BUILD =  -O2 -gccinc -nodefaults -proc 586 -w off
225 CFLAGS_FOR_BUILD += -ir $(MWCW_MSL) -ir $(MWCW_W32) -lr $(MWCW_MSL) -lr $(MWCW_W32)
226 CFLAGS_FOR_BUILD += -lMSL_All_x86.lib -lkernel32.lib -luser32.lib
227 else
228 # GNUC build flags to create build tools
229 CC_FOR_BUILD     = gcc
230 CFLAGS_FOR_BUILD = -Wall -O2
231 endif
232
233 # Base compile flags
234 # and prefix or precompiled header added here.
235
236 # The default flags are as follows:
237 #
238 # -c                    compile only, no link
239 # -gccinc               search directory of referencing file first for #includes
240 # -Cpp_exceptions off   disable C++ exceptions
241 # -RTTI off             disable C++ run-time typing information
242 # -align 4              align on 4 byte bounderies
243 # -w nocmdline          disable command-line driver/parser warnings
244 # -proc PII             generate code base on Pentium II instruction set
245 # -inst mmx             use MMX extensions (Not used)
246
247 CFLAGS += -c -w nocmdline -gccinc -Cpp_exceptions off -RTTI off -align 4 -proc PII
248
249 ifdef CC_MAX_ERRORS
250 CFLAGS += -maxerrors $(CC_MAX_ERRORS)
251 else
252 CFLAGS += -maxerrors 1
253 endif
254
255 ifeq "$(REQUIRE_PROTOTYPES)" "1"
256 CFLAGS += -r
257 endif
258
259 # -g                    generate debugging information
260 # -O0                   level 0 optimizations
261 ifeq "$(RELEASE)" "debug"
262 CFLAGS += -g -O0
263 endif
264
265 # -O4,p                 level 4 optimizations, optimize for speed
266 ifeq "$(RELEASE)" "release"
267 CFLAGS += -O4,p
268 endif
269
270 # -prefix pre_nw.h      #include pre_nw.h for all files
271 CFLAGS += -prefix pre_nw.h
272
273
274 ifneq ($(findstring /sh,$(SHELL)),/sh)
275 PATH:=$(PATH);$(METROWERKS)\bin;$(METROWERKS)\Other Metrowerks Tools\Command Line Tools
276 endif
277
278 #
279 # Declare major project deliverables output directories here
280 #
281
282 ifndef PORT
283 PORT = 80
284 endif
285
286 ifndef SSLPORT
287 SSLPORT = 443
288 endif
289
290 ifdef DEST
291 INSTALL = $(subst \,/,$(DEST))
292 ifeq (/, $(findstring /,$(INSTALL)))
293 INSTDIRS = $(INSTALL)
294 endif
295 endif
296
297 ifdef dest
298 INSTALL = $(subst \,/,$(dest))
299 ifeq (/, $(findstring /,$(INSTALL)))
300 INSTDIRS = $(INSTALL)
301 endif
302 endif
303
304 ifndef INSTALL
305 INSTALL = $(AP_WORK)/Dist
306 INSTDIRS = $(INSTALL)
307 endif
308
309 ifeq ($(MAKECMDGOALS),installdev)
310 ifndef BASEDIR
311 export BASEDIR = apache_$(VERSION_STR)-sdk
312 endif
313 else
314 ifndef BASEDIR
315 export BASEDIR = Apache$(VERSION_MAJMIN)
316 endif
317 endif
318
319 # Add support for building IPV6 alongside
320 ifneq "$(IPV6)" ""
321 DEFINES += -DNW_BUILD_IPV6
322 # INCDIRS := $(NOVELLLIBC)/include/winsock/IPV6;$(INCDIRS)
323
324 ifneq "$(findstring IPV6,$(OBJDIR))" "IPV6"
325 OBJDIR := $(OBJDIR)_IPV6
326 endif
327         
328 ifneq "$(findstring IPV6,$(INSTALL))" "IPV6"
329 INSTALL := $(INSTALL)_IPV6
330 endif        
331
332 ifneq "$(findstring IPV6,$(INSTDIRS))" "IPV6"
333 INSTDIRS := $(INSTDIRS)_IPV6
334 endif
335
336 endif
337
338 INSTALLBASE = $(INSTALL)/$(BASEDIR)
339
340 INSTDEVDIRS = \
341         $(INSTALL) \
342         $(INSTALLBASE) \
343         $(INSTALLBASE)/build \
344         $(INSTALLBASE)/include \
345         $(INSTALLBASE)/lib \
346         $(EOLIST) 
347
348 INSTDIRS += \
349         $(INSTALLBASE) \
350         $(INSTALLBASE)/bin \
351         $(INSTALLBASE)/cgi-bin \
352         $(INSTALLBASE)/conf \
353         $(INSTALLBASE)/conf/extra \
354         $(INSTALLBASE)/error \
355         $(INSTALLBASE)/htdocs \
356         $(INSTALLBASE)/icons \
357         $(INSTALLBASE)/logs \
358         $(INSTALLBASE)/man \
359         $(INSTALLBASE)/manual \
360         $(INSTALLBASE)/modules \
361         $(EOLIST) 
362
363 #
364 # Common directories
365 #
366
367 SRC             = $(subst \,/,$(AP_WORK))
368 APR             = $(subst \,/,$(APR_WORK))
369 APRUTIL         = $(subst \,/,$(APU_WORK))
370 APBUILD         = $(SRC)/build
371 STDMOD          = $(SRC)/modules
372 HTTPD           = $(SRC)/modules/http
373 DAV             = $(SRC)/modules/dav
374 NWOS            = $(SRC)/os/netware
375 SERVER          = $(SRC)/server
376 SUPMOD          = $(SRC)/support
377 APULDAP         = $(APRUTIL)/ldap
378 XML             = $(APRUTIL)/xml
379 APRTEST         = $(APR)/test
380 PCRE            = $(PCRESRC)
381
382 PREBUILD_INST   = $(SRC)/nwprebuild
383
384 #
385 # Internal Libraries
386 #
387
388 APRLIB          = $(APR)/$(OBJDIR)/aprlib.lib
389 APRUTLIB        = $(APRUTIL)/$(OBJDIR)/aprutil.lib
390 APULDAPLIB      = $(APULDAP)/$(OBJDIR)/apuldap.lib
391 STMODLIB        = $(STDMOD)/$(OBJDIR)/stdmod.lib
392 PCRELIB         = $(SRC)/$(OBJDIR)/pcre.lib
393 NWOSLIB         = $(NWOS)/$(OBJDIR)/netware.lib
394 SERVLIB         = $(SERVER)/$(OBJDIR)/server.lib
395 HTTPDLIB        = $(HTTPD)/$(OBJDIR)/httpd.lib
396 XMLLIB          = $(XML)/$(OBJDIR)/xmllib.lib
397
398 #
399 # Additional general defines
400 #
401
402 EnvironmentDefined = 1
403 endif # ifndef EnvironmentDefined
404
405 # This is always set so that it will show up in lower directories
406
407 ifdef Path
408 Path = $(PATH)
409 endif
410