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