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