]> granicus.if.org Git - apache/blob - build/NWGNUenvironment.inc
0f6ed523621bbcd69ee60f8afa2711b9cf9492c6
[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 SORT    = sort
136
137 # Setup distribution tools
138 ZIP     = zip -qr9
139 7ZA     = 7za >NUL a
140
141 #
142 # Declare Command and tool macros here
143 #
144
145 ifeq ($(findstring /sh,$(SHELL)),/sh)
146 DEL     = rm -f $1
147 RMDIR   = rm -fr $1
148 MKDIR   = mkdir -p $1
149 COPY    = -cp -afv $1 $2
150 #COPYR  = -cp -afr $1/* $2
151 COPYR   = -rsync -aC $1/* $2
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 CAT     = type
168 endif
169
170 ifdef IPV6
171 ifndef USE_STDSOCKETS
172 USE_STDSOCKETS=1
173 endif
174 endif
175
176 NOVI    = $(NOVELLLIBC)/imports
177 PRELUDE = $(NOVI)/libcpre.o
178
179 INCDIRS = $(NOVELLLIBC)/include;
180 ifndef USE_STDSOCKETS
181 INCDIRS += $(NOVELLLIBC)/include/winsock;
182 endif
183 ifneq "$(LDAPSDK)" ""
184 #INCDIRS := $(INCDIRS);$(LDAPSDK)/inc
185 INCDIRS += $(LDAPSDK)/inc;
186 endif
187 ifneq "$(ZLIBSDK)" ""
188 #INCDIRS := $(INCDIRS);$(ZLIBSDK)
189 INCDIRS += $(ZLIBSDK);
190 endif
191 ifneq "$(PCRESRC)" ""
192 #INCDIRS := $(INCDIRS);$(PCRESRC)
193 INCDIRS += $(PCRESRC);
194 endif
195
196 DEFINES = -DNETWARE 
197 ifndef USE_STDSOCKETS
198 DEFINES += -DUSE_WINSOCK
199 endif
200 ifndef DEBUG
201 DEFINES += -DNDEBUG
202 endif
203
204 ifdef USE_STDSOCKETS
205 VERSION_SKT = (BSDSOCK)
206 else
207 VERSION_SKT = (WINSOCK)
208 endif
209
210 # MetroWerks static Libraries
211 CLIB3S  = $(METROWERKS)/Novell Support/Metrowerks Support/Libraries/Runtime/mwcrtl.lib
212 MATH3S  =
213 PLIB3S  = $(METROWERKS)/Novell Support/Metrowerks Support/Libraries/MSL C++/MWCPP.lib
214
215 ifeq "$(OS)" "Windows_NT"
216 # MetroWerks Win32 build flags to create build tools
217 MWCW_MSL    = "$(METROWERKS)/MSL"
218 MWCW_W32    = "$(METROWERKS)/Win32-x86 Support"
219 HOST_CC     = $(WIN_CC)
220 HOST_CFLAGS =  -O2 -gccinc -nodefaults -proc 586 -w off
221 HOST_CFLAGS += -ir $(MWCW_MSL) -ir $(MWCW_W32) -lr $(MWCW_MSL) -lr $(MWCW_W32)
222 HOST_CFLAGS += -lMSL_All_x86.lib -lkernel32.lib -luser32.lib
223 else
224 # GNUC build flags to create build tools
225 HOST_CC     = gcc
226 HOST_CFLAGS = -Wall -O2
227 endif
228
229 # Base compile flags
230 # and prefix or precompiled header added here.
231
232 # The default flags are as follows:
233 #
234 # -c                    compile only, no link
235 # -nosyspath            treat #include <...> like #include "..."
236 # -Cpp_exceptions off   disable C++ exceptions
237 # -RTTI off             disable C++ run-time typing information
238 # -align 4              align on 4 byte bounderies
239 # -w nocmdline          disable command-line driver/parser warnings
240 # -proc PII             generate code base on Pentium II instruction set
241 # -inst mmx             use MMX extensions (Not used)
242
243 CFLAGS = -c -nosyspath -Cpp_exceptions off -RTTI off -align 4 -w nocmdline -proc PII
244
245 ifeq "$(REQUIRE_PROTOTYPES)" "1"
246 CFLAGS += -r
247 endif
248
249 # -g                    generate debugging information
250 # -O0                   level 0 optimizations
251 ifeq "$(RELEASE)" "debug"
252 CFLAGS += -g -O0
253 endif
254
255 # -O4,p                 level 4 optimizations, optimize for speed
256 ifeq "$(RELEASE)" "release"
257 CFLAGS += -O4,p
258 endif
259
260 # -prefix pre_nw.h      #include pre_nw.h for all files
261 CFLAGS += -prefix pre_nw.h
262
263
264 ifneq ($(findstring /sh,$(SHELL)),/sh)
265 PATH:=$(PATH);$(METROWERKS)\bin;$(METROWERKS)\Other Metrowerks Tools\Command Line Tools
266 endif
267
268 #
269 # Declare major project deliverables output directories here
270 #
271
272 ifdef DEST
273 INSTALL = $(DEST)
274 ifeq (\, $(findstring \,$(INSTALL)))
275 INSTDIRS = $(DEST)
276 endif
277 endif
278
279 ifdef dest
280 INSTALL = $(dest)
281 ifeq (\, $(findstring \,$(INSTALL)))
282 INSTDIRS = $(dest)
283 endif
284 endif
285
286 ifndef INSTALL
287 INSTALL = $(AP_WORK)/Dist
288 INSTDIRS = $(AP_WORK)/Dist
289 endif
290
291 ifndef BASEDIR
292 BASEDIR = Apache23
293 export BASEDIR
294 endif
295
296 ifndef PORT
297 PORT = 80
298 endif
299
300 ifndef SSLPORT
301 SSLPORT = 443
302 endif
303
304 # Add support for building IPV6 alongside
305 ifneq "$(IPV6)" ""
306 DEFINES += -DNW_BUILD_IPV6
307 # INCDIRS := $(NOVELLLIBC)\include\winsock\IPV6;$(INCDIRS)
308
309 ifneq "$(findstring IPV6,$(OBJDIR))" "IPV6"
310 OBJDIR := $(OBJDIR)_IPV6
311 endif
312         
313 ifneq "$(findstring IPV6,$(INSTALL))" "IPV6"
314 INSTALL := $(INSTALL)_IPV6
315 endif        
316
317 ifneq "$(findstring IPV6,$(INSTDIRS))" "IPV6"
318 INSTDIRS := $(INSTDIRS)_IPV6
319 endif
320
321 endif
322
323 INSTALLBASE := $(INSTALL)/$(BASEDIR)
324
325 INSTDEVDIRS := \
326         $(INSTDIRS) \
327         $(INSTALLBASE)/include \
328         $(INSTALLBASE)/lib \
329
330 INSTDIRS += \
331         $(INSTALL)/$(BASEDIR) \
332         $(INSTALLBASE)/bin \
333         $(INSTALLBASE)/cgi-bin \
334         $(INSTALLBASE)/conf \
335         $(INSTALLBASE)/conf/extra \
336         $(INSTALLBASE)/error \
337         $(INSTALLBASE)/htdocs \
338         $(INSTALLBASE)/icons \
339         $(INSTALLBASE)/logs \
340         $(INSTALLBASE)/man \
341         $(INSTALLBASE)/manual \
342         $(INSTALLBASE)/modules \
343
344 #
345 # Common directories
346 #
347
348 SRC             = $(subst \,/,$(AP_WORK))
349 APBUILD         = $(SRC)/build
350 STDMOD          = $(SRC)/modules
351 HTTPD           = $(SRC)/modules/http
352 NWOS            = $(SRC)/os/netware
353 SERVER          = $(SRC)/server
354 SUPMOD          = $(SRC)/support
355 APR             = $(APR_WORK)
356 APRUTIL         = $(APU_WORK)
357 APULDAP         = $(APU_WORK)/ldap
358 XML             = $(APU_WORK)/xml
359 APRTEST         = $(APR_WORK)/test
360 PCRE            = $(PCRESRC)
361 PREBUILD_INST   = $(SRC)/nwprebuild
362
363 #
364 # Internal Libraries
365 #
366
367 APRLIB          = $(APR)/$(OBJDIR)/aprlib.lib
368 APRUTLIB        = $(APRUTIL)/$(OBJDIR)/aprutil.lib
369 APULDAPLIB      = $(APULDAP)/$(OBJDIR)/apuldap.lib
370 STMODLIB        = $(STDMOD)/$(OBJDIR)/stdmod.lib
371 PCRELIB         = $(SRC)/$(OBJDIR)/pcre.lib
372 NWOSLIB         = $(NWOS)/$(OBJDIR)/netware.lib
373 SERVLIB         = $(SERVER)/$(OBJDIR)/server.lib
374 HTTPDLIB        = $(HTTPD)/$(OBJDIR)/httpd.lib
375 XMLLIB          = $(XML)/$(OBJDIR)/xmllib.lib
376
377 #
378 # Additional general defines
379 #
380
381 EnvironmentDefined = 1
382 endif # ifndef EnvironmentDefined
383
384 # This is always set so that it will show up in lower directories
385
386 ifdef Path
387 Path = $(PATH)
388 endif
389