]> granicus.if.org Git - apache/blob - build/NWGNUtail.inc
Add support for an "epoch" in the RPM spec file. This epoch is a discrete
[apache] / build / NWGNUtail.inc
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 #
10 echo NLM_NAME=$(NLM_NAME)
11 ifndef NLM_NAME
12 NLM_NAME = $(TARGET_nlm)
13 endif
14
15 ifndef NLM_DESCRIPTION
16 NLM_DESCRIPTION = $(NLM_NAME)
17 endif
18
19 ifndef NLM_THREAD_NAME
20 NLM_THREAD_NAME = $(NLM_NAME) Thread
21 endif
22
23 ifndef NLM_SCREEN_NAME
24 NLM_SCREEN_NAME = DEFAULT
25 endif
26
27 ifndef NLM_COPYRIGHT
28 NLM_COPYRIGHT = Licensed under the Apache License, Version 2.0
29 endif
30
31 #
32 # Create dependency lists based on the files available
33 #
34
35 CCOPT_DEPENDS   = \
36                                 $(AP_WORK)\build\NWGNUhead.inc \
37                                 $(AP_WORK)\build\NWGNUenvironment.inc \
38                                 $(AP_WORK)\build\NWGNUtail.inc \
39                                 NWGNUmakefile \
40                                 $(CUSTOM_INI) \
41                                 $(EOLIST)
42
43 CPPOPT_DEPENDS  = \
44                                 $(AP_WORK)\build\NWGNUhead.inc \
45                                 $(AP_WORK)\build\NWGNUenvironment.inc \
46                                 $(AP_WORK)\build\NWGNUtail.inc \
47                                 NWGNUmakefile \
48                                 $(CUSTOM_INI) \
49                                 $(EOLIST)
50
51 $(NLM_NAME)_LINKOPT_DEPENDS     = \
52                                 $(TARGET_lib) \
53                                 $(AP_WORK)\build\NWGNUenvironment.inc \
54                                 NWGNUmakefile \
55                                 $(AP_WORK)\build\NWGNUtail.inc \
56                                 $(CUSTOM_INI) \
57                                 $(VERSION_INC) \
58                                 $(EOLIST)
59
60 ifeq "$(words $(strip $(TARGET_lib)))" "1"
61 LIB_NAME                        = $(basename $(notdir $(TARGET_lib)))
62 $(LIB_NAME)_LIBLST_DEPENDS      = \
63                                 $(FILES_lib_objs) \
64                                 $(AP_WORK)\build\NWGNUenvironment.inc \
65                                 NWGNUmakefile \
66                                 $(AP_WORK)\build\NWGNUtail.inc \
67                                 $(CUSTOM_INI) \
68                                 $(EOLIST)
69 endif
70
71 ifeq "$(wildcard NWGNU$(LIB_NAME))" "NWGNU$(LIB_NAME)"
72 $(LIB_NAME)_LIBLST_DEPENDS      += NWGNU$(LIB_NAME)
73 endif
74
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)
79 endif
80
81 #
82 # Generic compiler rules
83 #
84
85 ifneq ($(MAKECMDGOALS),clean)
86 $(AP_WORK)/build/NWGNUversion.inc : $(AP_WORK)/build/nw_ver.awk $(AP_WORK)/include/ap_release.h
87         @echo Generating $(subst /,\,$@)
88         $(AWK) -f $^ > $@
89
90 -include $(AP_WORK)/build/NWGNUversion.inc
91
92 ifneq "$(strip $(VERSION_STR))" ""
93 VERSION_INC = $(AP_WORK)/build/NWGNUversion.inc
94 else
95 VERSION         = 2,3,0
96 VERSION_STR     = 2.3.0
97 VERSION_MAJMIN  = 23
98 endif
99 endif
100
101
102 ifeq "$(words $(strip $(TARGET_nlm)))" "1"
103
104 $(OBJDIR)/%.o: %.c $(OBJDIR)\$(NLM_NAME)_cc.opt
105         @echo Compiling $<
106         $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\$(NLM_NAME)_cc.opt
107
108 $(OBJDIR)\$(NLM_NAME)_cc.opt: $(CCOPT_DEPENDS)
109         $(CHK) $@ $(DEL) $@
110         @echo Generating $@
111 ifneq "$(strip $(CFLAGS))" ""
112         @echo $(CFLAGS) >> $@
113 endif
114 ifneq "$(strip $(XCFLAGS))" ""
115         @echo $(XCFLAGS) >> $@
116 endif
117 ifneq "$(strip $(XINCDIRS))" ""
118         @echo $(foreach xincdir,$(strip $(subst ;,$(SPACE),$(XINCDIRS))),-I$(xincdir)) >> $@
119 endif
120 ifneq "$(strip $(INCDIRS))" ""
121         @echo $(foreach incdir,$(strip $(subst ;,$(SPACE),$(INCDIRS))),-I$(incdir)) >> $@
122 endif
123 ifneq "$(strip $(DEFINES))" ""
124         @echo $(DEFINES) >> $@
125 endif
126 ifneq "$(strip $(XDEFINES))" ""
127         @echo $(XDEFINES) >> $@
128 endif
129
130 $(OBJDIR)/%.o: %.cpp $(OBJDIR)\cpp.opt
131         @echo Compiling $<
132         $(CPP) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cpp.opt
133
134 $(OBJDIR)\cpp.opt: $(CPPOPT_DEPENDS)
135         $(CHK) $@ $(DEL) $@
136         @echo Generating $@
137 ifneq "$(strip $(CFLAGS))" ""
138         @echo $(CFLAGS) >> $@
139 endif
140 ifneq "$(strip $(XCFLAGS))" ""
141         @echo $(XCFLAGS) >> $@
142 endif
143 ifneq "$(strip $(XINCDIRS))" ""
144         @echo $(foreach xincdir,$(strip $(subst ;,$(SPACE),$(XINCDIRS))),-I$(xincdir)) >> $@
145 endif
146 ifneq "$(strip $(INCDIRS))" ""
147         @echo $(foreach incdir,$(strip $(subst ;,$(SPACE),$(INCDIRS))),-I$(incdir)) >> $@
148 endif
149 ifneq "$(strip $(DEFINES))" ""
150         @echo $(DEFINES) >> $@
151 endif
152 ifneq "$(strip $(XDEFINES))" ""
153         @echo $(XDEFINES) >> $@
154 endif
155
156 endif # one target nlm
157
158 #
159 # Rules to build libraries
160 #
161
162 # If we only have one target library then build it
163
164 ifeq "$(words $(strip $(TARGET_lib)))" "1"
165
166 $(TARGET_lib) : $(OBJDIR)\$(LIB_NAME)_lib.lst
167         @echo Generating $@
168         $(CHK) $(OBJDIR)\$(@F) $(DEL) $(OBJDIR)\$(@F)
169         $(LIB) -o $(OBJDIR)\$(@F) @$?
170
171 $(OBJDIR)\$(LIB_NAME)_lib.lst: $($(LIB_NAME)_LIBLST_DEPENDS)
172         $(CHK) $@ $(DEL) $@
173         @echo Generating $@
174 ifneq "$(strip $(FILES_lib_objs))" ""
175         @echo $(foreach objfile,$(FILES_lib_objs),$(subst /,\,$(objfile)) ) >> $@
176 endif
177
178 else # We must have more than one target library so load the individual makefiles
179
180 $(OBJDIR)/%.lib: NWGNU% $(AP_WORK)\build\NWGNUhead.inc $(AP_WORK)\build\NWGNUtail.inc $(AP_WORK)\build\NWGNUenvironment.inc FORCE
181         @echo Calling $<
182         $(MAKE) -f $< $(MAKECMDGOALS) RELEASE=$(RELEASE)
183
184 endif
185
186 #
187 # Rules to build nlms.
188 #
189
190 vpath libcpre.o $(NOVELLLIBC)\imports
191
192 # If we only have one target NLM then build it
193 ifeq "$(words $(strip $(TARGET_nlm)))" "1"
194
195 $(TARGET_nlm) : $(FILES_nlm_objs) $(FILES_nlm_libs) $(OBJDIR)\$(NLM_NAME)_link.opt
196         @echo Linking $@
197         $(LINK) @$(OBJDIR)\$(NLM_NAME)_link.opt
198
199 # This will force the link option file to be rebuilt if we change the
200 # corresponding makefile
201
202 $(OBJDIR)\$(NLM_NAME)_link.opt : $($(NLM_NAME)_LINKOPT_DEPENDS)
203         $(CHK) $(OBJDIR)\$(@F) $(DEL) $(OBJDIR)\$(@F)
204         $(CHK) $(OBJDIR)\$(NLM_NAME)_link.def $(DEL) $(OBJDIR)\$(NLM_NAME)_link.def
205         @echo Generating $@
206         @echo -warnings off >> $@
207         @echo -zerobss >> $@
208         @echo -o $(TARGET_nlm) >> $@
209 ifneq "$(FILE_nlm_copyright)" ""
210         @-type $(FILE_nlm_copyright) >> $@
211 endif
212 ifeq "$(RELEASE)" "debug"
213         @echo -g >> $@
214         @echo -sym internal >> $@
215         @echo -sym codeview4 >> $@
216         @echo -osym $(OBJDIR)\$(NLM_NAME).sym >> $@
217 else
218         @echo -sym internal >> $@
219 endif
220         @echo -l $(NWOS) >> $@
221         @echo -l $(AP)/$(OBJDIR) >> $@
222         @echo -l $(APR)/$(OBJDIR) >> $@
223         @echo -l $(APRUTIL)/$(OBJDIR) >> $@
224         @echo -l $(PCRE)/$(OBJDIR) >> $@
225         @echo -l $(HTTPD)/$(OBJDIR) >> $@
226         @echo -l $(SERVER)/$(OBJDIR) >> $@
227         @echo -l $(STDMOD)/$(OBJDIR) >> $@
228         @echo -l $(NWOS)/$(OBJDIR) >> $@
229         @echo -l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/Runtime" >> $@
230         @echo -l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/MSL C++" >> $@
231 ifneq "$(IPV6)" ""
232         @echo -l $(NOVELLLIBC)\include\winsock\IPV6 >> $@
233 endif
234         @echo -l $(NOVELLLIBC)/imports >> $@
235 ifneq "$(LDAPSDK)" ""
236         @echo -l $(LDAPSDK)/lib/nlm >> $@
237 endif
238         @echo -l $(APULDAP)/$(OBJDIR) >> $@
239         @echo -l $(XML)/$(OBJDIR) >> $@
240         @echo -nodefaults >> $@
241         @echo -map $(OBJDIR)\$(NLM_NAME).map>> $@
242 ifneq "$(strip $(XLFLAGS))" ""
243         @echo $(XLFLAGS) >> $@
244 endif
245 ifneq "$(strip $(FILES_nlm_objs))" ""
246         @echo $(foreach objfile,$(strip $(FILES_nlm_objs)),$(subst /,\,$(objfile))) >> $@
247 endif
248 ifneq "$(FILES_nlm_libs)" ""
249         @echo $(foreach libfile, $(notdir $(strip $(FILES_nlm_libs))),-l$(subst /,\,$(libfile))) >> $@
250 endif
251         @echo -commandfile $(OBJDIR)\$(NLM_NAME)_link.def >> $@
252         @echo # Do not edit this file - it is created by make! > $(OBJDIR)\$(NLM_NAME)_link.def 
253         @echo # All your changes will be lost!! >> $(OBJDIR)\$(NLM_NAME)_link.def 
254 ifneq "$(FILE_nlm_msg)" ""
255         @echo Messages $(FILE_nlm_msg) >> $(OBJDIR)\$(NLM_NAME)_link.def
256 endif
257 ifneq "$(FILE_nlm_hlp)" ""
258         @echo Help $(FILE_nlm_hlp) >> $(OBJDIR)\$(NLM_NAME)_link.def
259 endif
260 ifeq "$(FILE_nlm_copyright)" ""
261         @echo copyright "$(NLM_COPYRIGHT)" >> $(OBJDIR)\$(NLM_NAME)_link.def
262 endif
263         @echo description "$(NLM_DESCRIPTION)" >> $(OBJDIR)\$(NLM_NAME)_link.def
264         @echo threadname "$(NLM_THREAD_NAME)" >> $(OBJDIR)\$(NLM_NAME)_link.def
265 ifneq "$(NLM_STACK_SIZE)" ""
266         @echo stacksize $(subst K,000,$(subst k,K,$(strip $(NLM_STACK_SIZE)))) >> $(OBJDIR)\$(NLM_NAME)_link.def
267 else
268         @echo stacksize 64000 >> $(OBJDIR)\$(NLM_NAME)_link.def
269 endif
270         @echo screenname "$(NLM_SCREEN_NAME)" >> $(OBJDIR)\$(NLM_NAME)_link.def
271 ifneq "$(NLM_VERSION)" ""
272         @echo version $(NLM_VERSION) >> $(OBJDIR)\$(NLM_NAME)_link.def
273 else
274         @echo version $(VERSION) >> $(OBJDIR)\$(NLM_NAME)_link.def
275 endif
276 ifneq "$(NLM_ENTRY_SYM)" ""
277         @echo start $(NLM_ENTRY_SYM) >> $(OBJDIR)\$(NLM_NAME)_link.def
278 endif
279 ifneq "$(NLM_EXIT_SYM)" ""
280         @echo exit $(NLM_EXIT_SYM) >> $(OBJDIR)\$(NLM_NAME)_link.def
281 endif
282 ifneq "$(NLM_CHECK_SYM)" ""
283         @echo check $(NLM_CHECK_SYM) >> $(OBJDIR)\$(NLM_NAME)_link.def
284 endif
285 ifneq "$(NLM_FLAGS)" ""
286         @echo $(strip $(NLM_FLAGS)) >> $(OBJDIR)\$(NLM_NAME)_link.def
287 endif
288 ifneq "$(FILES_nlm_modules)" ""
289         @echo module $(foreach module,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_modules))),$(subst /,\,$(module))) >> $(OBJDIR)\$(NLM_NAME)_link.def
290 endif
291 ifneq "$(FILES_nlm_Ximports)" ""
292         @echo import $(foreach import,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_Ximports))),$(subst /,\,$(import))) >> $(OBJDIR)\$(NLM_NAME)_link.def
293 endif
294 ifneq "$(FILES_nlm_exports)" ""
295         @echo export $(foreach export,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_exports))),$(subst /,\,$(export))) >> $(OBJDIR)\$(NLM_NAME)_link.def
296 endif
297
298 # if APACHE_UNIPROC is defined, don't include XDCData
299 ifndef APACHE_UNIPROC
300 ifneq "$(string $(XDCDATA))" ""
301         @echo xdcdata $(XDCDATA) >> $(OBJDIR)\$(NLM_NAME)_link.def
302 else
303         @echo xdcdata $(NWOS)\apache.xdc >> $(OBJDIR)\$(NLM_NAME)_link.def
304 endif
305 endif
306
307 else # more than one target so look for individual makefiles.
308
309 # Only include these if NO_LICENSE_FILE isn't set to prevent excessive
310 # recursion
311
312 ifndef NO_LICENSE_FILE
313
314 $(OBJDIR)/%.nlm: NWGNU% $(AP_WORK)\build\NWGNUhead.inc $(AP_WORK)\build\NWGNUtail.inc $(AP_WORK)\build\NWGNUenvironment.inc $(CUSTOM_INI) $(VERSION_INC) FORCE
315         @echo Calling $<
316         $(MAKE) -f $< $(MAKECMDGOALS) RELEASE=$(RELEASE)
317         $(CMD) echo.
318
319 else
320
321 $(TARGET_nlm):
322
323 endif # NO_LICENSE_FILE
324
325 endif
326