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