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