# # This contains final targets and should be included at the end of any # NWGNUmakefile file # # # If we are going to create an nlm, make sure we have assigned variables to # use during the link. # #echo NLM_NAME=$(NLM_NAME) ifndef NLM_NAME NLM_NAME = $(TARGET_nlm) endif ifndef NLM_DESCRIPTION NLM_DESCRIPTION = $(NLM_NAME) endif ifndef NLM_THREAD_NAME NLM_THREAD_NAME = $(NLM_NAME) Thread endif ifndef NLM_SCREEN_NAME NLM_SCREEN_NAME = DEFAULT endif ifndef NLM_COPYRIGHT NLM_COPYRIGHT = Licensed under the Apache License, Version 2.0 endif # # Create dependency lists based on the files available # CCOPT_DEPENDS = \ $(APRBUILD)/NWGNUhead.inc \ $(APRBUILD)/NWGNUenvironment.inc \ $(APRBUILD)/NWGNUtail.inc \ NWGNUmakefile \ $(CUSTOM_INI) \ $(EOLIST) CPPOPT_DEPENDS = \ $(APRBUILD)/NWGNUhead.inc \ $(APRBUILD)/NWGNUenvironment.inc \ $(APRBUILD)/NWGNUtail.inc \ NWGNUmakefile \ $(CUSTOM_INI) \ $(EOLIST) $(NLM_NAME)_LINKOPT_DEPENDS = \ $(TARGET_lib) \ $(APRBUILD)/NWGNUenvironment.inc \ NWGNUmakefile \ $(APRBUILD)/NWGNUtail.inc \ $(CUSTOM_INI) \ $(VERSION_INC) \ $(EOLIST) ifeq "$(words $(strip $(TARGET_lib)))" "1" LIB_NAME = $(basename $(notdir $(TARGET_lib))) $(LIB_NAME)_LIBLST_DEPENDS = \ $(FILES_lib_objs) \ $(APRBUILD)/NWGNUenvironment.inc \ NWGNUmakefile \ $(APRBUILD)/NWGNUtail.inc \ $(CUSTOM_INI) \ $(EOLIST) endif ifeq "$(wildcard NWGNU$(LIB_NAME))" "NWGNU$(LIB_NAME)" $(LIB_NAME)_LIBLST_DEPENDS += NWGNU$(LIB_NAME) endif ifeq "$(wildcard NWGNU$(NLM_NAME))" "NWGNU$(NLM_NAME)" $(NLM_NAME)_LINKOPT_DEPENDS += NWGNU$(NLM_NAME) CCOPT_DEPENDS += NWGNU$(NLM_NAME) CPPOPT_DEPENDS += NWGNU$(NLM_NAME) endif # # Generic compiler rules # ifneq ($(MAKECMDGOALS),clean) $(APRBUILD)/NWGNUversion.inc : $(APRBUILD)/nw_ver.awk $(APR)/include/apr_version.h @echo Generating $@ @$(AWK) -f $^ > $@ -include $(APRBUILD)/NWGNUversion.inc ifneq "$(strip $(VERSION_STR))" "" VERSION_INC = $(APRBUILD)/NWGNUversion.inc else VERSION = 2,0,0 VERSION_STR = 2.0.0 VERSION_MAJMIN = 20 endif endif ifeq "$(words $(strip $(TARGET_nlm)))" "1" INCLUDE_BLDCMDS = 1 CCOPT_NAME = $(NLM_NAME) endif ifeq "$(words $(strip $(TARGET_lib)))" "1" INCLUDE_BLDCMDS = 1 CCOPT_NAME = $(LIB_NAME) endif ifeq "$(INCLUDE_BLDCMDS)" "1" $(OBJDIR)/%.o: %.c $(OBJDIR)/$(CCOPT_NAME)_cc.opt @echo Compiling $< $(CC) -o $@ $< @$(word 2, $^) $(OBJDIR)/$(CCOPT_NAME)_cc.opt: $(CCOPT_DEPENDS) $(CHK) $(subst /,\,$@) $(DEL) $(subst /,\,$@) @echo CCOPT_DEPENDS=$^ @echo Generating $@ ifneq "$(strip $(CFLAGS))" "" @echo $(CFLAGS) >> $@ endif ifneq "$(strip $(XCFLAGS))" "" @echo $(XCFLAGS) >> $@ endif ifneq "$(strip $(XINCDIRS))" "" @echo $(foreach xincdir,$(strip $(subst ;,$(SPACE),$(XINCDIRS))),-I$(xincdir)) >> $@ endif ifneq "$(strip $(INCDIRS))" "" @echo $(foreach incdir,$(strip $(subst ;,$(SPACE),$(INCDIRS))),-I$(incdir)) >> $@ endif ifneq "$(strip $(DEFINES))" "" @echo $(DEFINES) >> $@ endif ifneq "$(strip $(XDEFINES))" "" @echo $(XDEFINES) >> $@ endif $(OBJDIR)/%.o: %.cpp $(OBJDIR)/$(CCOPT_NAME)_cpp.opt @echo Compiling $< $(CCP) -o $@ $< @$(word 2, $^) $(OBJDIR)/$(CCOPT_NAME)_cpp.opt: $(CPPOPT_DEPENDS) $(CHK) $(subst /,\,$@) $(DEL) $(subst /,\,$@) @echo CPPOPT_DEPENDS=$^ @echo Generating $@ ifneq "$(strip $(CFLAGS))" "" @echo $(CFLAGS) >> $@ endif ifneq "$(strip $(XCFLAGS))" "" @echo $(XCFLAGS) >> $@ endif ifneq "$(strip $(XINCDIRS))" "" @echo $(foreach xincdir,$(strip $(subst ;,$(SPACE),$(XINCDIRS))),-I$(xincdir)) >> $@ endif ifneq "$(strip $(INCDIRS))" "" @echo $(foreach incdir,$(strip $(subst ;,$(SPACE),$(INCDIRS))),-I$(incdir)) >> $@ endif ifneq "$(strip $(DEFINES))" "" @echo $(DEFINES) >> $@ endif ifneq "$(strip $(XDEFINES))" "" @echo $(XDEFINES) >> $@ endif endif # one target nlm or lib # # Rules to build libraries # # If we only have one target library then build it ifeq "$(words $(strip $(TARGET_lib)))" "1" $(TARGET_lib) : $(OBJDIR)/$(LIB_NAME)_lib.lst $(CHK) $(subst /,\,$@) $(DEL) $(subst /,\,$@) @echo Generating $@ $(LIB) -o $@ @$< $(OBJDIR)/aprlib_lib.lst: $(aprlib_LIBLST_DEPENDS) $(CHK) $(subst /,\,$@) $(DEL) $(subst /,\,$@) ifneq "$(strip $(FILES_lib_objs))" "" @echo Generating $@ @echo $(wordlist 1, 10, $(FILES_lib_objs)) >> $@ @echo $(wordlist 11, 20, $(FILES_lib_objs)) >> $@ @echo $(wordlist 21, 30, $(FILES_lib_objs)) >> $@ @echo $(wordlist 31, 40, $(FILES_lib_objs)) >> $@ @echo $(wordlist 41, 50, $(FILES_lib_objs)) >> $@ @echo $(wordlist 51, 60, $(FILES_lib_objs)) >> $@ @echo $(wordlist 61, 70, $(FILES_lib_objs)) >> $@ @echo $(wordlist 71, 80, $(FILES_lib_objs)) >> $@ @echo $(wordlist 81, 90, $(FILES_lib_objs)) >> $@ @echo $(wordlist 91, 100, $(FILES_lib_objs)) >> $@ @echo $(wordlist 101, 110, $(FILES_lib_objs)) >> $@ endif $(OBJDIR)/%_lib.lst: $($(LIB_NAME)_LIBLST_DEPENDS) $(CHK) $(subst /,\,$@) $(DEL) $(subst /,\,$@) ifneq "$(strip $(FILES_lib_objs))" "" @echo Generating $@ @echo CWD $(CURDIR) @echo $(FILES_lib_objs) >> $@ endif else # We must have more than one target library so load the individual makefiles $(OBJDIR)/%.lib: NWGNU% $(APRBUILD)/NWGNUhead.inc $(APRBUILD)/NWGNUtail.inc $(APRBUILD)/NWGNUenvironment.inc FORCE @echo Calling $< $(MAKE) -f $< $(MAKECMDGOALS) RELEASE=$(RELEASE) endif # # Rules to build nlms. # vpath libcpre.o $(NOVELLLIBC)/imports # If we only have one target NLM then build it ifeq "$(words $(strip $(TARGET_nlm)))" "1" $(TARGET_nlm) : $(FILES_nlm_objs) $(FILES_nlm_libs) $(OBJDIR)/$(NLM_NAME)_link.opt @echo Linking $@ $(LINK) @$(OBJDIR)/$(NLM_NAME)_link.opt # This will force the link option file to be rebuilt if we change the # corresponding makefile $(OBJDIR)/$(NLM_NAME)_link.opt : $($(NLM_NAME)_LINKOPT_DEPENDS) $(CHK) $(subst /,\,$@) $(DEL) $(subst /,\,$@) $(CHK) $(subst /,\,$(@:.opt=.def)) $(DEL) $(subst /,\,$(@:.opt=.def)) @echo Generating $@ @echo -warnings off >> $@ @echo -zerobss >> $@ @echo -o $(TARGET_nlm) >> $@ ifneq "$(FILE_nlm_copyright)" "" @-type $(FILE_nlm_copyright) >> $@ endif ifeq "$(RELEASE)" "debug" @echo -g >> $@ @echo -sym internal >> $@ @echo -sym codeview4 >> $@ @echo -osym $(OBJDIR)\$(NLM_NAME).sym >> $@ else @echo -sym internal >> $@ endif @echo -l $(APR)/$(OBJDIR) >> $@ @echo -l $(APRBUCKETS)/$(OBJDIR) >> $@ @echo -l $(APRLDAP)/$(OBJDIR) >> $@ @echo -l $(APRXML)/$(OBJDIR) >> $@ @echo -l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/Runtime" >> $@ @echo -l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/MSL C++" >> $@ ifneq "$(IPV6)" "" @echo -l $(NOVELLLIBC)/include/winsock/IPV6 >> $@ endif @echo -l $(NOVELLLIBC)/imports >> $@ ifneq "$(LDAPSDK)" "" @echo -l $(LDAPSDK)/lib/nlm >> $@ endif @echo -nodefaults >> $@ @echo -map $(OBJDIR)/$(NLM_NAME).map>> $@ ifneq "$(strip $(XLFLAGS))" "" @echo $(XLFLAGS) >> $@ endif ifneq "$(strip $(FILES_nlm_objs))" "" @echo $(foreach objfile,$(strip $(FILES_nlm_objs)),$(subst /,\,$(objfile))) >> $@ endif ifneq "$(FILES_nlm_libs)" "" @echo $(foreach libfile, $(notdir $(strip $(FILES_nlm_libs))),-l$(subst /,\,$(libfile))) >> $@ endif @echo -commandfile $(@:.opt=.def) >> $@ @echo # Do not edit this file - it is created by make! > $(@:.opt=.def) @echo # All your changes will be lost!! >> $(@:.opt=.def) ifneq "$(FILE_nlm_msg)" "" @echo Messages $(FILE_nlm_msg) >> $(@:.opt=.def) endif ifneq "$(FILE_nlm_hlp)" "" @echo Help $(FILE_nlm_hlp) >> $(@:.opt=.def) endif ifeq "$(FILE_nlm_copyright)" "" @echo copyright "$(NLM_COPYRIGHT)" >> $(@:.opt=.def) endif @echo description "$(NLM_DESCRIPTION)" >> $(@:.opt=.def) @echo threadname "$(NLM_THREAD_NAME)" >> $(@:.opt=.def) ifneq "$(NLM_STACK_SIZE)" "" @echo stacksize $(subst K,000,$(subst k,K,$(strip $(NLM_STACK_SIZE)))) >> $(@:.opt=.def) else @echo stacksize 64000 >> $(@:.opt=.def) endif @echo screenname "$(NLM_SCREEN_NAME)" >> $(@:.opt=.def) ifneq "$(NLM_VERSION)" "" @echo version $(NLM_VERSION) >> $(@:.opt=.def) else @echo version $(VERSION) >> $(@:.opt=.def) endif ifneq "$(NLM_ENTRY_SYM)" "" @echo start $(NLM_ENTRY_SYM) >> $(@:.opt=.def) endif ifneq "$(NLM_EXIT_SYM)" "" @echo exit $(NLM_EXIT_SYM) >> $(@:.opt=.def) endif ifneq "$(NLM_CHECK_SYM)" "" @echo check $(NLM_CHECK_SYM) >> $(@:.opt=.def) endif ifneq "$(NLM_FLAGS)" "" @echo $(strip $(NLM_FLAGS)) >> $(@:.opt=.def) endif ifneq "$(FILES_nlm_modules)" "" @echo module $(foreach module,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_modules))),$(subst /,\,$(module))) >> $(@:.opt=.def) endif ifneq "$(FILES_nlm_Ximports)" "" @echo import $(foreach import,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_Ximports))),$(subst /,\,$(import))) >> $(@:.opt=.def) endif ifneq "$(FILES_nlm_exports)" "" @echo export $(foreach export,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_exports))),$(subst /,\,$(export))) >> $(@:.opt=.def) endif # if APACHE_UNIPROC is defined, don't include XDCData ifndef APACHE_UNIPROC ifneq "$(string $(XDCDATA))" "" @echo xdcdata $(XDCDATA) >> $(@:.opt=.def) else @echo xdcdata $(APR)/misc/netware/apr.xdc >> $(@:.opt=.def) endif endif else # more than one target so look for individual makefiles. # Only include these if NO_LICENSE_FILE isn't set to prevent excessive # recursion ifndef NO_LICENSE_FILE $(OBJDIR)/%.nlm: NWGNU% $(APRBUILD)/NWGNUhead.inc $(APRBUILD)/NWGNUtail.inc $(APRBUILD)/NWGNUenvironment.inc $(CUSTOM_INI) $(VERSION_INC) FORCE @echo Calling $< $(MAKE) -f $< $(MAKECMDGOALS) RELEASE=$(RELEASE) $(CMD) echo. else $(TARGET_nlm): endif # NO_LICENSE_FILE endif # multiple targets $(INSTDIRS) :: $(CHKNOT) $@\NUL mkdir $@