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