1# 2# This contains final targets and should be included at the end of any 3# NWGNUmakefile file 4# 5 6# 7# If we are going to create an nlm, make sure we have assigned variables to 8# use during the link. 9# 10ifndef NLM_NAME 11NLM_NAME = $(TARGET_nlm) 12endif 13 14ifndef NLM_DESCRIPTION 15NLM_DESCRIPTION = $(NLM_NAME) 16endif 17 18ifndef NLM_THREAD_NAME 19NLM_THREAD_NAME = $(NLM_NAME) Thread 20endif 21 22ifndef NLM_SCREEN_NAME 23NLM_SCREEN_NAME = DEFAULT 24endif 25 26ifndef NLM_COPYRIGHT 27NLM_COPYRIGHT = Licensed under the Apache License, Version 2.0 28endif 29 30ifeq "$(NLM_FLAGS)" "" 31NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION 32endif 33 34ifeq "$(NLM_STACK_SIZE)" "" 35NLM_STACK_SIZE = 65536 36endif 37 38ifeq "$(NLM_ENTRY_SYM)" "" 39NLM_ENTRY_SYM = _LibCPrelude 40endif 41 42ifeq "$(NLM_EXIT_SYM)" "" 43NLM_EXIT_SYM = _LibCPostlude 44endif 45 46ifeq "$(NLM_VERSION)" "" 47NLM_VERSION = $(VERSION) 48endif 49 50# 51# Create dependency lists based on the files available 52# 53 54 55CCOPT_DEPENDS = \ 56 $(APRBUILD)/NWGNUhead.inc \ 57 $(APRBUILD)/NWGNUenvironment.inc \ 58 $(APRBUILD)/NWGNUtail.inc \ 59 NWGNUmakefile \ 60 $(CUSTOM_INI) \ 61 $(EOLIST) 62 63CPPOPT_DEPENDS = \ 64 $(APRBUILD)/NWGNUhead.inc \ 65 $(APRBUILD)/NWGNUenvironment.inc \ 66 $(APRBUILD)/NWGNUtail.inc \ 67 NWGNUmakefile \ 68 $(CUSTOM_INI) \ 69 $(EOLIST) 70 71$(NLM_NAME)_LINKOPT_DEPENDS = \ 72 $(TARGET_lib) \ 73 $(APRBUILD)/NWGNUenvironment.inc \ 74 NWGNUmakefile \ 75 $(APRBUILD)/NWGNUtail.inc \ 76 $(CUSTOM_INI) \ 77 $(VERSION_INC) \ 78 $(EOLIST) 79 80ifeq "$(words $(strip $(TARGET_lib)))" "1" 81LIB_NAME = $(basename $(notdir $(TARGET_lib))) 82$(LIB_NAME)_LIBLST_DEPENDS = \ 83 $(FILES_lib_objs) \ 84 $(APRBUILD)/NWGNUenvironment.inc \ 85 NWGNUmakefile \ 86 $(APRBUILD)/NWGNUtail.inc \ 87 $(CUSTOM_INI) \ 88 $(EOLIST) 89endif 90 91ifeq "$(wildcard NWGNU$(LIB_NAME))" "NWGNU$(LIB_NAME)" 92$(LIB_NAME)_LIBLST_DEPENDS += NWGNU$(LIB_NAME) 93endif 94 95ifeq "$(wildcard NWGNU$(NLM_NAME))" "NWGNU$(NLM_NAME)" 96$(NLM_NAME)_LINKOPT_DEPENDS += NWGNU$(NLM_NAME) 97CCOPT_DEPENDS += NWGNU$(NLM_NAME) 98CPPOPT_DEPENDS += NWGNU$(NLM_NAME) 99endif 100 101# 102# Generic compiler rules 103# 104 105ifneq "$(MAKECMDGOALS)" "clean" 106ifneq "$(findstring clobber_,$(MAKECMDGOALS))" "clobber_" 107$(APRBUILD)/NWGNUversion.inc : $(APRBUILD)/nw_ver.awk $(APR)/include/apr_version.h 108# @echo Generating $@ 109 @echo GEN $@ 110 @$(AWK) -f $^ > $@ 111 112-include $(APRBUILD)/NWGNUversion.inc 113 114ifneq "$(strip $(VERSION_STR))" "" 115VERSION_INC = $(APRBUILD)/NWGNUversion.inc 116else 117VERSION = 1,4,0 118VERSION_STR = 1.4.0 119VERSION_MAJMIN = 14 120endif 121endif 122endif 123 124ifeq "$(words $(strip $(TARGET_nlm)))" "1" 125INCLUDE_BLDCMDS = 1 126CCOPT_NAME = $(NLM_NAME) 127endif 128 129ifeq "$(words $(strip $(TARGET_lib)))" "1" 130INCLUDE_BLDCMDS = 1 131CCOPT_NAME = $(LIB_NAME) 132endif 133 134ifeq "$(INCLUDE_BLDCMDS)" "1" 135 136$(OBJDIR)/%.o: %.c $(OBJDIR)/$(CCOPT_NAME)_cc.opt 137# @echo Compiling $< 138 @echo $(DL)CC $<$(DL) 139 $(CC) -o $@ $< @$(word 2, $^) 140 141$(OBJDIR)/$(CCOPT_NAME)_cc.opt: $(CCOPT_DEPENDS) 142 $(call DEL,$@) 143ifdef VERBOSE 144 @echo $(DL)CCOPT_DEPENDS=$^$(DL) 145endif 146# @echo Generating $@ 147 @echo $(DL)GEN $@$(DL) 148ifneq "$(strip $(CFLAGS))" "" 149 @echo $(DL)$(CFLAGS)$(DL)>> $@ 150endif 151ifneq "$(strip $(XCFLAGS))" "" 152 @echo $(DL)$(XCFLAGS)$(DL)>> $@ 153endif 154ifneq "$(strip $(XINCDIRS))" "" 155 @echo $(DL)$(foreach xincdir,$(strip $(subst ;,$(SPACE),$(XINCDIRS))),-I$(xincdir))$(DL)>> $@ 156endif 157ifneq "$(strip $(INCDIRS))" "" 158 @echo $(DL)$(foreach incdir,$(strip $(subst ;,$(SPACE),$(INCDIRS))),-I$(incdir))$(DL)>> $@ 159endif 160ifneq "$(strip $(DEFINES))" "" 161 @echo $(DL)$(DEFINES)$(DL)>> $@ 162endif 163ifneq "$(strip $(XDEFINES))" "" 164 @echo $(DL)$(XDEFINES)$(DL)>> $@ 165endif 166 167$(OBJDIR)/%.o: %.cpp $(OBJDIR)/$(CCOPT_NAME)_cpp.opt 168# @echo Compiling $< 169 @echo $(DL)CPP $<$(DL) 170 $(CCP) -o $@ $< @$(word 2, $^) 171 172$(OBJDIR)/$(CCOPT_NAME)_cpp.opt: $(CPPOPT_DEPENDS) 173 $(call DEL,$@) 174ifdef VERBOSE 175 @echo $(DL)CPPOPT_DEPENDS=$^$(DL) 176endif 177# @echo Generating $@ 178 @echo $(DL)GEN $@$(DL) 179ifneq "$(strip $(CFLAGS))" "" 180 @echo $(DL)$(CFLAGS)$(DL)>> $@ 181endif 182ifneq "$(strip $(XCFLAGS))" "" 183 @echo $(DL)$(XCFLAGS)$(DL)>> $@ 184endif 185ifneq "$(strip $(XINCDIRS))" "" 186 @echo $(DL)$(foreach xincdir,$(strip $(subst ;,$(SPACE),$(XINCDIRS))),-I$(xincdir))$(DL)>> $@ 187endif 188ifneq "$(strip $(INCDIRS))" "" 189 @echo $(DL)$(foreach incdir,$(strip $(subst ;,$(SPACE),$(INCDIRS))),-I$(incdir))$(DL)>> $@ 190endif 191ifneq "$(strip $(DEFINES))" "" 192 @echo $(DL)$(DEFINES)$(DL)>> $@ 193endif 194ifneq "$(strip $(XDEFINES))" "" 195 @echo $(DL)$(XDEFINES)$(DL)>> $@ 196endif 197 198endif # one target nlm or lib 199 200# 201# Rules to build libraries 202# 203 204# If we only have one target library then build it 205 206ifeq "$(words $(strip $(TARGET_lib)))" "1" 207 208$(TARGET_lib) : $(OBJDIR)/$(LIB_NAME)_lib.lst 209 $(call DEL,$@) 210# @echo Generating $@ 211 @echo $(DL)AR $@$(DL) 212 $(LIB) -o $@ @$< 213 214$(OBJDIR)/aprlib_lib.lst: $(aprlib_LIBLST_DEPENDS) 215 $(call DEL,$@) 216ifneq "$(strip $(FILES_lib_objs))" "" 217# @echo Generating $@ 218 @echo $(DL)GEN $@$(DL) 219ifdef VERBOSE 220 @echo $(DL)FILES_lib_objs=$(words $(FILES_lib_objs))$(DL) 221endif 222 @echo $(DL)$(wordlist 1, 20, $(FILES_lib_objs))$(DL)>> $@ 223 @echo $(DL)$(wordlist 21, 40, $(FILES_lib_objs))$(DL)>> $@ 224 @echo $(DL)$(wordlist 41, 60, $(FILES_lib_objs))$(DL)>> $@ 225 @echo $(DL)$(wordlist 61, 80, $(FILES_lib_objs))$(DL)>> $@ 226endif 227 228$(OBJDIR)/%_lib.lst: $($(LIB_NAME)_LIBLST_DEPENDS) 229 $(call DEL,$@) 230ifneq "$(strip $(FILES_lib_objs))" "" 231# @echo Generating $@ 232 @echo $(DL)GEN $@$(DL) 233ifdef VERBOSE 234 @echo FILES_lib_objs=$(words $(FILES_lib_objs)) 235endif 236 @echo $(DL)$(FILES_lib_objs)$(DL)>> $@ 237endif 238 239else # We must have more than one target library so load the individual makefiles 240 241$(OBJDIR)/%.lib: NWGNU% $(APRBUILD)/NWGNUhead.inc $(APRBUILD)/NWGNUtail.inc $(APRBUILD)/NWGNUenvironment.inc FORCE 242 @echo $(DL)Calling $<$(DL) 243 $(MAKE) -f $< $(MAKECMDGOALS) RELEASE=$(RELEASE) 244 245endif 246 247# 248# Rules to build nlms. 249# 250 251# If we only have one target NLM then build it 252ifeq "$(words $(strip $(TARGET_nlm)))" "1" 253 254$(TARGET_nlm) : $(FILES_nlm_objs) $(FILES_nlm_libs) $(OBJDIR)/$(NLM_NAME)_link.opt 255# @echo Linking $@ 256 @echo $(DL)LINK $@$(DL) 257 $(LINK) @$(OBJDIR)/$(NLM_NAME)_link.opt 258 259# This will force the link option file to be rebuilt if we change the 260# corresponding makefile 261 262$(OBJDIR)/$(NLM_NAME)_link.opt : $($(NLM_NAME)_LINKOPT_DEPENDS) 263 $(call DEL,$@) 264 $(call DEL,$(@:.opt=.def)) 265# @echo Generating $@ 266 @echo $(DL)GEN $@$(DL) 267 @echo $(DL)# Do not edit this file - it is created by make!$(DL) > $@ 268 @echo $(DL)# All your changes will be lost!!$(DL)>> $@ 269 @echo $(DL)-warnings off$(DL)>> $@ 270 @echo $(DL)-zerobss$(DL)>> $@ 271 @echo $(DL)-o $(TARGET_nlm)$(DL)>> $@ 272ifneq "$(FILE_nlm_copyright)" "" 273 @-$(CAT) $(FILE_nlm_copyright) >> $@ 274endif 275ifeq "$(RELEASE)" "debug" 276 @echo $(DL)-g$(DL)>> $@ 277 @echo $(DL)-sym internal$(DL)>> $@ 278 @echo $(DL)-sym codeview4$(DL)>> $@ 279 @echo $(DL)-osym $(OBJDIR)/$(NLM_NAME).sym$(DL)>> $@ 280else 281 @echo $(DL)-sym internal$(DL)>> $@ 282endif 283 @echo $(DL)-l $(APR)/$(OBJDIR)$(DL)>> $@ 284 @echo $(DL)-l $(APU)/$(OBJDIR)$(DL)>> $@ 285 @echo $(DL)-l $(APULDAP)/$(OBJDIR)$(DL)>> $@ 286 @echo $(DL)-l $(APUXML)/$(OBJDIR)$(DL)>> $@ 287 @echo $(DL)-l $(APR)/misc/netware$(DL)>> $@ 288 @echo $(DL)-l $(APR)$(DL)>> $@ 289 @echo $(DL)-l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/Runtime"$(DL)>> $@ 290 @echo $(DL)-l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/MSL C++"$(DL)>> $@ 291ifneq "$(IPV6)" "" 292 @echo $(DL)-l $(NOVELLLIBC)/include/winsock/IPV6$(DL)>> $@ 293endif 294 @echo $(DL)-l $(NOVELLLIBC)/imports$(DL)>> $@ 295ifneq "$(LDAPSDK)" "" 296 @echo $(DL)-l $(LDAPSDK)/imports$(DL)>> $@ 297endif 298 @echo $(DL)-nodefaults$(DL)>> $@ 299 @echo $(DL)-map $(OBJDIR)/$(NLM_NAME).map$(DL)>> $@ 300ifneq "$(strip $(XLFLAGS))" "" 301 @echo $(DL)$(XLFLAGS)$(DL)>> $@ 302endif 303ifneq "$(strip $(FILES_nlm_objs))" "" 304 @echo $(DL)$(foreach objfile,$(strip $(FILES_nlm_objs)),$(objfile))$(DL)>> $@ 305endif 306ifneq "$(FILES_nlm_libs)" "" 307 @echo $(DL)$(foreach libfile, $(notdir $(strip $(FILES_nlm_libs))),-l$(libfile))$(DL)>> $@ 308endif 309 @echo $(DL)-commandfile $(@:.opt=.def)$(DL)>> $@ 310 @echo $(DL)# Do not edit this file - it is created by make!$(DL)> $(@:.opt=.def) 311 @echo $(DL)# All your changes will be lost!!$(DL)>> $(@:.opt=.def) 312ifneq "$(FILE_nlm_msg)" "" 313 @echo $(DL)Messages $(FILE_nlm_msg)$(DL)>> $(@:.opt=.def) 314endif 315ifneq "$(FILE_nlm_hlp)" "" 316 @echo $(DL)Help $(FILE_nlm_hlp)$(DL)>> $(@:.opt=.def) 317endif 318ifeq "$(FILE_nlm_copyright)" "" 319 @echo $(DL)copyright "$(NLM_COPYRIGHT)"$(DL)>> $(@:.opt=.def) 320endif 321 @echo $(DL)description "$(NLM_DESCRIPTION)"$(DL)>> $(@:.opt=.def) 322 @echo $(DL)threadname "$(NLM_THREAD_NAME)"$(DL)>> $(@:.opt=.def) 323 @echo $(DL)screenname "$(NLM_SCREEN_NAME)"$(DL)>> $(@:.opt=.def) 324 @echo $(DL)stacksize $(subst K,000,$(subst k,K,$(strip $(NLM_STACK_SIZE))))$(DL)>> $(@:.opt=.def) 325 @echo $(DL)version $(NLM_VERSION) $(DL)>> $(@:.opt=.def) 326 @echo $(DL)$(strip $(NLM_FLAGS))$(DL)>> $(@:.opt=.def) 327 @echo $(DL)start $(NLM_ENTRY_SYM)$(DL)>> $(@:.opt=.def) 328 @echo $(DL)exit $(NLM_EXIT_SYM)$(DL)>> $(@:.opt=.def) 329ifneq "$(NLM_CHECK_SYM)" "" 330 @echo $(DL)check $(NLM_CHECK_SYM)$(DL)>> $(@:.opt=.def) 331endif 332ifneq "$(FILES_nlm_modules)" "" 333 @echo $(DL)module $(foreach module,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_modules))),$(module))$(DL)>> $(@:.opt=.def) 334endif 335ifneq "$(FILES_nlm_Ximports)" "" 336 @echo $(DL)import $(foreach import,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_Ximports))),$(import))$(DL)>> $(@:.opt=.def) 337endif 338ifneq "$(FILES_nlm_exports)" "" 339 @echo $(DL)export $(foreach export,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_exports))),$(export))$(DL)>> $(@:.opt=.def) 340endif 341# if APACHE_UNIPROC is defined, don't include XDCData 342ifndef APACHE_UNIPROC 343ifneq "$(string $(XDCDATA))" "" 344 @echo $(DL)xdcdata $(XDCDATA)$(DL)>> $(@:.opt=.def) 345else 346 @echo $(DL)xdcdata apr.xdc$(DL)>> $(@:.opt=.def) 347endif 348endif 349 350else # more than one target so look for individual makefiles. 351 352# Only include these if NO_LICENSE_FILE isn't set to prevent excessive 353# recursion 354 355ifndef NO_LICENSE_FILE 356 357$(OBJDIR)/%.nlm: NWGNU% $(APRBUILD)/NWGNUhead.inc $(APRBUILD)/NWGNUtail.inc $(APRBUILD)/NWGNUenvironment.inc $(CUSTOM_INI) $(VERSION_INC) FORCE 358 @echo $(DL)Calling $<$(DL) 359 $(MAKE) -f $< $(MAKECMDGOALS) RELEASE=$(RELEASE) 360 @$(ECHONL) 361 362else 363 364$(TARGET_nlm): 365 366endif # NO_LICENSE_FILE 367 368endif # multiple targets 369 370$(INSTDIRS) :: 371 $(call MKDIR,$@) 372 373 374