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