2 # This contains final targets and should be included at the end of any
7 # If we are going to create an nlm, make sure we have assigned variables to
10 echo NLM_NAME=$(NLM_NAME)
12 NLM_NAME = $(TARGET_nlm)
15 ifndef NLM_DESCRIPTION
16 NLM_DESCRIPTION = $(NLM_NAME)
19 ifndef NLM_THREAD_NAME
20 NLM_THREAD_NAME = $(NLM_NAME) Thread
23 ifndef NLM_SCREEN_NAME
24 NLM_SCREEN_NAME = DEFAULT
28 NLM_COPYRIGHT = Licensed under the Apache License, Version 2.0
32 # Create dependency lists based on the files available
36 $(AP_WORK)\build\NWGNUhead.inc \
37 $(AP_WORK)\build\NWGNUenvironment.inc \
38 $(AP_WORK)\build\NWGNUtail.inc \
44 $(AP_WORK)\build\NWGNUhead.inc \
45 $(AP_WORK)\build\NWGNUenvironment.inc \
46 $(AP_WORK)\build\NWGNUtail.inc \
51 $(NLM_NAME)_LINKOPT_DEPENDS = \
53 $(AP_WORK)\build\NWGNUenvironment.inc \
55 $(AP_WORK)\build\NWGNUtail.inc \
60 ifeq "$(words $(strip $(TARGET_lib)))" "1"
61 LIB_NAME = $(basename $(notdir $(TARGET_lib)))
62 $(LIB_NAME)_LIBLST_DEPENDS = \
64 $(AP_WORK)\build\NWGNUenvironment.inc \
66 $(AP_WORK)\build\NWGNUtail.inc \
71 ifeq "$(wildcard NWGNU$(LIB_NAME))" "NWGNU$(LIB_NAME)"
72 $(LIB_NAME)_LIBLST_DEPENDS += NWGNU$(LIB_NAME)
75 ifeq "$(wildcard NWGNU$(NLM_NAME))" "NWGNU$(NLM_NAME)"
76 $(NLM_NAME)_LINKOPT_DEPENDS += NWGNU$(NLM_NAME)
77 CCOPT_DEPENDS += NWGNU$(NLM_NAME)
78 CPPOPT_DEPENDS += NWGNU$(NLM_NAME)
82 # Generic compiler rules
85 $(AP_WORK)\build\NWGNUversion.inc : $(AP_WORK)\include\ap_release.h $(AP_WORK)\build\nw_ver.awk
86 @echo Generating $(subst /,\,$@)
87 $(AWK) -f $(AP_WORK)\build\nw_ver.awk $(AP_WORK)\include\ap_release.h > $(AP_WORK)\build\NWGNUversion.inc
89 -include $(AP_WORK)\build\NWGNUversion.inc
91 ifneq "$(strip $(VERSION_STR))" ""
92 VERSION_INC = $(AP_WORK)\build\NWGNUversion.inc
99 ifeq "$(words $(strip $(TARGET_nlm)))" "1"
101 $(OBJDIR)/%.o: %.c $(OBJDIR)\$(NLM_NAME)_cc.opt
103 $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\$(NLM_NAME)_cc.opt
105 $(OBJDIR)\$(NLM_NAME)_cc.opt: $(CCOPT_DEPENDS)
108 ifneq "$(strip $(CFLAGS))" ""
109 @echo $(CFLAGS) >> $@
111 ifneq "$(strip $(XCFLAGS))" ""
112 @echo $(XCFLAGS) >> $@
114 ifneq "$(strip $(XINCDIRS))" ""
115 @echo $(foreach xincdir,$(strip $(subst ;,$(SPACE),$(XINCDIRS))),-I$(xincdir)) >> $@
117 ifneq "$(strip $(INCDIRS))" ""
118 @echo $(foreach incdir,$(strip $(subst ;,$(SPACE),$(INCDIRS))),-I$(incdir)) >> $@
120 ifneq "$(strip $(DEFINES))" ""
121 @echo $(DEFINES) >> $@
123 ifneq "$(strip $(XDEFINES))" ""
124 @echo $(XDEFINES) >> $@
127 $(OBJDIR)/%.o: %.cpp $(OBJDIR)\cpp.opt
129 $(CPP) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cpp.opt
131 $(OBJDIR)\cpp.opt: $(CPPOPT_DEPENDS)
134 ifneq "$(strip $(CFLAGS))" ""
135 @echo $(CFLAGS) >> $@
137 ifneq "$(strip $(XCFLAGS))" ""
138 @echo $(XCFLAGS) >> $@
140 ifneq "$(strip $(XINCDIRS))" ""
141 @echo $(foreach xincdir,$(strip $(subst ;,$(SPACE),$(XINCDIRS))),-I$(xincdir)) >> $@
143 ifneq "$(strip $(INCDIRS))" ""
144 @echo $(foreach incdir,$(strip $(subst ;,$(SPACE),$(INCDIRS))),-I$(incdir)) >> $@
146 ifneq "$(strip $(DEFINES))" ""
147 @echo $(DEFINES) >> $@
149 ifneq "$(strip $(XDEFINES))" ""
150 @echo $(XDEFINES) >> $@
153 endif # one target nlm
156 # Rules to build libraries
159 # If we only have one target library then build it
161 ifeq "$(words $(strip $(TARGET_lib)))" "1"
163 $(TARGET_lib) : $(OBJDIR)\$(LIB_NAME)_lib.lst
165 $(CHK) $(OBJDIR)\$(@F) $(DEL) $(OBJDIR)\$(@F)
166 $(LIB) -o $(OBJDIR)\$(@F) @$?
168 $(OBJDIR)\$(LIB_NAME)_lib.lst: $($(LIB_NAME)_LIBLST_DEPENDS)
171 ifneq "$(strip $(FILES_lib_objs))" ""
172 @echo $(foreach objfile,$(FILES_lib_objs),$(subst /,\,$(objfile)) ) >> $@
175 else # We must have more than one target library so load the individual makefiles
177 $(OBJDIR)/%.lib: NWGNU% $(AP_WORK)\build\NWGNUhead.inc $(AP_WORK)\build\NWGNUtail.inc $(AP_WORK)\build\NWGNUenvironment.inc FORCE
179 $(MAKE) -f $< $(MAKECMDGOALS) RELEASE=$(RELEASE)
184 # Rules to build nlms.
187 vpath libcpre.o $(NOVELLLIBC)\imports
189 # If we only have one target NLM then build it
190 ifeq "$(words $(strip $(TARGET_nlm)))" "1"
192 $(TARGET_nlm) : $(FILES_nlm_objs) $(FILES_nlm_libs) $(OBJDIR)\$(NLM_NAME)_link.opt
194 $(LINK) @$(OBJDIR)\$(NLM_NAME)_link.opt
196 # This will force the link option file to be rebuilt if we change the
197 # corresponding makefile
199 $(OBJDIR)\$(NLM_NAME)_link.opt : $($(NLM_NAME)_LINKOPT_DEPENDS)
200 $(CHK) $(OBJDIR)\$(@F) $(DEL) $(OBJDIR)\$(@F)
201 $(CHK) $(OBJDIR)\$(NLM_NAME)_link.def $(DEL) $(OBJDIR)\$(NLM_NAME)_link.def
203 @echo -warnings off >> $@
205 @echo -o $(TARGET_nlm) >> $@
206 ifneq "$(FILE_nlm_copyright)" ""
207 @-type $(FILE_nlm_copyright) >> $@
209 ifeq "$(RELEASE)" "debug"
211 @echo -sym internal >> $@
212 @echo -sym codeview4 >> $@
213 @echo -osym $(OBJDIR)\$(NLM_NAME).sym >> $@
215 @echo -sym internal >> $@
217 @echo -l $(NWOS) >> $@
218 @echo -l $(AP)/$(OBJDIR) >> $@
219 @echo -l $(APR)/$(OBJDIR) >> $@
220 @echo -l $(APRUTIL)/$(OBJDIR) >> $@
221 @echo -l $(PCRE)/$(OBJDIR) >> $@
222 @echo -l $(HTTPD)/$(OBJDIR) >> $@
223 @echo -l $(SERVER)/$(OBJDIR) >> $@
224 @echo -l $(STDMOD)/$(OBJDIR) >> $@
225 @echo -l $(NWOS)/$(OBJDIR) >> $@
226 @echo -l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/Runtime" >> $@
227 @echo -l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/MSL C++" >> $@
229 @echo -l $(NOVELLLIBC)\include\winsock\IPV6 >> $@
231 @echo -l $(NOVELLLIBC)/imports >> $@
232 ifneq "$(LDAPSDK)" ""
233 @echo -l $(LDAPSDK)/lib/nlm >> $@
235 @echo -l $(APULDAP)/$(OBJDIR) >> $@
236 @echo -l $(XML)/$(OBJDIR) >> $@
237 @echo -nodefaults >> $@
238 @echo -map $(OBJDIR)\$(NLM_NAME).map>> $@
239 ifneq "$(strip $(XLFLAGS))" ""
240 @echo $(XLFLAGS) >> $@
242 ifneq "$(strip $(FILES_nlm_objs))" ""
243 @echo $(foreach objfile,$(strip $(FILES_nlm_objs)),$(subst /,\,$(objfile))) >> $@
245 ifneq "$(FILES_nlm_libs)" ""
246 @echo $(foreach libfile, $(notdir $(strip $(FILES_nlm_libs))),-l$(subst /,\,$(libfile))) >> $@
248 @echo -commandfile $(OBJDIR)\$(NLM_NAME)_link.def >> $@
249 @echo # Do not edit this file - it is created by make! > $(OBJDIR)\$(NLM_NAME)_link.def
250 @echo # All your changes will be lost!! >> $(OBJDIR)\$(NLM_NAME)_link.def
251 ifneq "$(FILE_nlm_msg)" ""
252 @echo Messages $(FILE_nlm_msg) >> $(OBJDIR)\$(NLM_NAME)_link.def
254 ifneq "$(FILE_nlm_hlp)" ""
255 @echo Help $(FILE_nlm_hlp) >> $(OBJDIR)\$(NLM_NAME)_link.def
257 ifeq "$(FILE_nlm_copyright)" ""
258 @echo copyright "$(NLM_COPYRIGHT)" >> $(OBJDIR)\$(NLM_NAME)_link.def
260 @echo description "$(NLM_DESCRIPTION)" >> $(OBJDIR)\$(NLM_NAME)_link.def
261 @echo threadname "$(NLM_THREAD_NAME)" >> $(OBJDIR)\$(NLM_NAME)_link.def
262 ifneq "$(NLM_STACK_SIZE)" ""
263 @echo stacksize $(subst K,000,$(subst k,K,$(strip $(NLM_STACK_SIZE)))) >> $(OBJDIR)\$(NLM_NAME)_link.def
265 @echo stacksize 64000 >> $(OBJDIR)\$(NLM_NAME)_link.def
267 @echo screenname "$(NLM_SCREEN_NAME)" >> $(OBJDIR)\$(NLM_NAME)_link.def
268 ifneq "$(NLM_VERSION)" ""
269 @echo version $(NLM_VERSION) >> $(OBJDIR)\$(NLM_NAME)_link.def
271 @echo version $(VERSION) >> $(OBJDIR)\$(NLM_NAME)_link.def
273 ifneq "$(NLM_ENTRY_SYM)" ""
274 @echo start $(NLM_ENTRY_SYM) >> $(OBJDIR)\$(NLM_NAME)_link.def
276 ifneq "$(NLM_EXIT_SYM)" ""
277 @echo exit $(NLM_EXIT_SYM) >> $(OBJDIR)\$(NLM_NAME)_link.def
279 ifneq "$(NLM_CHECK_SYM)" ""
280 @echo check $(NLM_CHECK_SYM) >> $(OBJDIR)\$(NLM_NAME)_link.def
282 ifneq "$(NLM_FLAGS)" ""
283 @echo $(strip $(NLM_FLAGS)) >> $(OBJDIR)\$(NLM_NAME)_link.def
285 ifneq "$(FILES_nlm_modules)" ""
286 @echo module $(foreach module,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_modules))),$(subst /,\,$(module))) >> $(OBJDIR)\$(NLM_NAME)_link.def
288 ifneq "$(FILES_nlm_Ximports)" ""
289 @echo import $(foreach import,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_Ximports))),$(subst /,\,$(import))) >> $(OBJDIR)\$(NLM_NAME)_link.def
291 ifneq "$(FILES_nlm_exports)" ""
292 @echo export $(foreach export,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_exports))),$(subst /,\,$(export))) >> $(OBJDIR)\$(NLM_NAME)_link.def
295 # if APACHE_UNIPROC is defined, don't include XDCData
296 ifndef APACHE_UNIPROC
297 ifneq "$(string $(XDCDATA))" ""
298 @echo xdcdata $(XDCDATA) >> $(OBJDIR)\$(NLM_NAME)_link.def
300 @echo xdcdata $(NWOS)\apache.xdc >> $(OBJDIR)\$(NLM_NAME)_link.def
304 else # more than one target so look for individual makefiles.
306 # Only include these if NO_LICENSE_FILE isn't set to prevent excessive
309 ifndef NO_LICENSE_FILE
311 $(OBJDIR)/%.nlm: NWGNU% $(AP_WORK)\build\NWGNUhead.inc $(AP_WORK)\build\NWGNUtail.inc $(AP_WORK)\build\NWGNUenvironment.inc $(CUSTOM_INI) $(VERSION_INC) FORCE
313 $(MAKE) -f $< $(MAKECMDGOALS) RELEASE=$(RELEASE)
320 endif # NO_LICENSE_FILE