1#
2# Define our required macro's if not already done.
3#
4
5ifndef AP_WORK
6export AP_WORK = $(CURDIR)
7endif
8
9ifndef APR_WORK
10ifeq "$(wildcard $(AP_WORK)/srclib/apr)" "$(AP_WORK)/srclib/apr"
11export APR_WORK = $(AP_WORK)/srclib/apr
12endif
13endif
14ifneq "$(wildcard $(APR_WORK)/include/apr_version.h)" "$(APR_WORK)/include/apr_version.h"
15$(error APR_WORK does not point to a valid APR source tree) 
16endif
17
18ifndef APU_WORK
19ifeq "$(wildcard $(AP_WORK)/srclib/apr-util)" "$(AP_WORK)/srclib/apr-util"
20export APU_WORK = $(AP_WORK)/srclib/apr-util
21endif
22endif
23ifndef APU_WORK
24ifeq "$(wildcard $(APR_WORK)/include/apu_version.h)" "$(APR_WORK)/include/apu_version.h"
25export APU_WORK = $(APR_WORK)
26endif
27endif
28ifneq "$(wildcard $(APU_WORK)/include/apu_version.h)" "$(APU_WORK)/include/apu_version.h"
29$(error APU_WORK does not point to a valid APU source tree) 
30endif
31
32#
33# Declare the sub-directories to be built here
34#
35
36SUBDIRS = \
37	$(APR_WORK) \
38	build \
39	support \
40	modules \
41	$(EOLIST)
42
43#
44# Get the 'head' of the build environment.  This includes default targets and
45# paths to tools
46#
47
48include $(AP_WORK)/build/NWGNUhead.inc
49
50#
51# build this level's files
52
53#
54# Make sure all needed macro's are defined
55#
56
57#
58# These directories will be at the beginning of the include list, followed by
59# INCDIRS
60#
61XINCDIRS	+= \
62			$(APR)/include \
63			$(APRUTIL)/include \
64			$(SRC)/include \
65			$(STDMOD)/aaa \
66			$(STDMOD)/core \
67			$(STDMOD)/filters \
68			$(STDMOD)/generators \
69			$(STDMOD)/http \
70			$(STDMOD)/loggers \
71			$(STDMOD)/mappers \
72			$(STDMOD)/proxy \
73			$(STDMOD)/ssl \
74			$(SERVER) \
75			$(SERVER)/mpm/netware \
76			$(PCRE) \
77			$(NWOS) \
78			$(EOLIST)
79
80#
81# These flags will come after CFLAGS
82#
83XCFLAGS		+= \
84			-DHAVE_CONFIG_H \
85			$(EOLIST)
86
87#
88# These defines will come after DEFINES
89#
90XDEFINES	+= \
91			$(EOLIST)
92
93#
94# These flags will be added to the link.opt file
95#
96XLFLAGS		+= \
97			$(EOLIST)
98
99#
100# These values will be appended to the correct variables based on the value of
101# RELEASE
102#
103ifeq "$(RELEASE)" "debug"
104XINCDIRS	+= \
105			$(EOLIST)
106
107XCFLAGS		+= \
108			$(EOLIST)
109
110XDEFINES	+= \
111			$(EOLIST)
112
113XLFLAGS		+= \
114			$(EOLIST)
115endif
116
117ifeq "$(RELEASE)" "noopt"
118XINCDIRS	+= \
119			$(EOLIST)
120
121XCFLAGS		+= \
122			$(EOLIST)
123
124XDEFINES	+= \
125			$(EOLIST)
126
127XLFLAGS		+= \
128			$(EOLIST)
129endif
130
131ifeq "$(RELEASE)" "release"
132XINCDIRS	+= \
133			$(EOLIST)
134
135XCFLAGS		+= \
136			$(EOLIST)
137
138XDEFINES	+= \
139			$(EOLIST)
140
141XLFLAGS		+= \
142			$(EOLIST)
143endif
144
145#
146# These are used by the link target if an NLM is being generated
147# This is used by the link 'name' directive to name the nlm.  If left blank
148# TARGET_nlm (see below) will be used.
149#
150NLM_NAME	= Apache2
151
152#
153# This is used by the link '-desc ' directive.
154# If left blank, NLM_NAME will be used.
155#
156NLM_DESCRIPTION	= Apache Web Server $(VERSION_STR) $(VERSION_SKT)
157
158#
159# This is used by the '-threadname' directive.  If left blank,
160# NLM_NAME Thread will be used.
161#
162NLM_THREAD_NAME	= $(NLM_NAME)
163
164#
165# This is used by the '-screenname' directive.  If left blank,
166# 'Apache for NetWare' Thread will be used.
167#
168NLM_SCREEN_NAME = Apache $(VERSION_STR) for NetWare
169
170
171#
172# If this is specified, it will override VERSION value in
173# $(AP_WORK)/build/NWGNUenvironment.inc
174#
175NLM_VERSION	=
176
177#
178# If this is specified, it will override the default of 64K
179#
180NLM_STACK_SIZE	= 65536
181
182
183#
184# If this is specified it will be used by the link '-entry' directive
185#
186NLM_ENTRY_SYM	=
187
188#
189# If this is specified it will be used by the link '-exit' directive
190#
191NLM_EXIT_SYM	=
192
193#
194# If this is specified it will be used by the link '-check' directive
195#
196NLM_CHECK_SYM	= _LibCCheckUnload
197
198#
199# If these are specified it will be used by the link '-flags' directive
200#
201NLM_FLAGS	= PSEUDOPREEMPTION
202
203#
204# If this is specified it will be linked in with the XDCData option in the def
205# file instead of the default of $(NWOS)/apache.xdc.  XDCData can be disabled
206# by setting APACHE_UNIPROC in the environment
207#
208XDCDATA		=
209
210#
211# If there is an NLM target, put it here
212#
213TARGET_nlm = \
214	$(OBJDIR)/$(NLM_NAME).nlm \
215	$(EOLIST)
216
217#
218# If there is an LIB target, put it here
219#
220TARGET_lib = \
221	$(PCRELIB) \
222	$(EOLIST)
223
224#
225# These are the OBJ files needed to create the NLM target above.
226# Paths must all use the '/' character
227#
228FILES_nlm_objs = \
229	$(OBJDIR)/buildmark.o \
230	$(OBJDIR)/config.o \
231	$(OBJDIR)/connection.o \
232	$(OBJDIR)/core.o \
233	$(OBJDIR)/core_filters.o \
234	$(OBJDIR)/eoc_bucket.o \
235	$(OBJDIR)/eor_bucket.o \
236	$(OBJDIR)/error_bucket.o \
237	$(OBJDIR)/http_core.o \
238	$(OBJDIR)/http_protocol.o \
239	$(OBJDIR)/http_request.o \
240	$(OBJDIR)/byterange_filter.o \
241	$(OBJDIR)/chunk_filter.o \
242	$(OBJDIR)/http_etag.o \
243	$(OBJDIR)/http_filters.o \
244	$(OBJDIR)/listen.o \
245	$(OBJDIR)/log.o \
246	$(OBJDIR)/main.o \
247	$(OBJDIR)/mod_authn_core.o \
248	$(OBJDIR)/mod_authz_core.o \
249	$(OBJDIR)/mod_authz_host.o \
250	$(OBJDIR)/mod_alias.o \
251	$(OBJDIR)/mod_dir.o \
252	$(OBJDIR)/mod_env.o \
253	$(OBJDIR)/mod_include.o \
254	$(OBJDIR)/mod_log_config.o \
255	$(OBJDIR)/mod_mime.o \
256	$(OBJDIR)/mod_negotiation.o \
257	$(OBJDIR)/mod_netware.o \
258	$(OBJDIR)/mod_setenvif.o \
259	$(OBJDIR)/mod_so.o \
260	$(OBJDIR)/mod_watchdog.o \
261	$(OBJDIR)/modules.o \
262	$(OBJDIR)/mpm_common.o \
263	$(OBJDIR)/mpm_netware.o \
264	$(OBJDIR)/protocol.o \
265	$(OBJDIR)/provider.o \
266	$(OBJDIR)/request.o \
267	$(OBJDIR)/scoreboard.o \
268	$(OBJDIR)/util.o \
269	$(OBJDIR)/util_cfgtree.o \
270	$(OBJDIR)/util_charset.o \
271	$(OBJDIR)/util_cookies.o \
272	$(OBJDIR)/util_debug.o \
273	$(OBJDIR)/util_expr_eval.o \
274	$(OBJDIR)/util_expr_parse.o \
275	$(OBJDIR)/util_expr_scan.o \
276	$(OBJDIR)/util_fcgi.o \
277	$(OBJDIR)/util_filter.o \
278	$(OBJDIR)/util_md5.o \
279	$(OBJDIR)/util_mutex.o \
280	$(OBJDIR)/util_nw.o \
281	$(OBJDIR)/util_pcre.o \
282	$(OBJDIR)/util_regex.o \
283	$(OBJDIR)/util_script.o \
284	$(OBJDIR)/util_time.o \
285	$(OBJDIR)/util_xml.o \
286	$(OBJDIR)/vhost.o \
287	$(EOLIST)
288
289# Build in mod_nw_ssl if Winsock is being used
290ifndef USE_STDSOCKETS
291FILES_nlm_objs += $(OBJDIR)/mod_nw_ssl.o \
292	$(EOLIST)
293endif
294
295#
296# These are the LIB files needed to create the NLM target above.
297# These will be added as a library command in the link.opt file.
298#
299FILES_nlm_libs = \
300	$(PCRELIB) \
301	$(PRELUDE) \
302	$(EOLIST)
303
304#
305# These are the modules that the above NLM target depends on to load.
306# These will be added as a module command in the link.opt file.
307#
308FILES_nlm_modules = \
309	aprlib \
310	Libc \
311	$(EOLIST)
312
313#
314# If the nlm has a msg file, put it's path here
315#
316FILE_nlm_msg =
317
318#
319# If the nlm has a hlp file put it's path here
320#
321FILE_nlm_hlp =
322
323#
324# If this is specified, it will override $(NWOS)\copyright.txt.
325#
326FILE_nlm_copyright =
327
328#
329# Any additional imports go here
330#
331FILES_nlm_Ximports = \
332	@aprlib.imp \
333	@libc.imp \
334	@netware.imp \
335	GetCurrentAddressSpace \
336	$(EOLIST)
337
338# Don't link with Winsock if standard sockets are being used
339ifndef USE_STDSOCKETS
340FILES_nlm_Ximports += @ws2nlm.imp \
341	$(EOLIST)
342endif
343
344#
345# Any symbols exported to here
346#
347FILES_nlm_exports = \
348	@httpd.imp \
349	$(EOLIST)
350
351#
352# These are the OBJ files needed to create the LIB target above.
353# Paths must all use the '/' character
354#
355ifeq "$(wildcard $(PCRE)/pcre.c)" "$(PCRE)/pcre.c"
356
357FILES_lib_objs = \
358	$(OBJDIR)/pcre.o \
359	$(EOLIST)
360
361else
362
363FILES_lib_objs = \
364	$(OBJDIR)/chartables.o \
365	$(OBJDIR)/pcre_compile.o \
366	$(OBJDIR)/pcre_exec.o \
367	$(OBJDIR)/pcre_fullinfo.o \
368	$(OBJDIR)/pcre_globals.o \
369	$(OBJDIR)/pcre_newline.o \
370	$(OBJDIR)/pcre_tables.o \
371	$(OBJDIR)/pcre_version.o \
372	$(EOLIST)
373ifeq "$(wildcard $(PCRE)/pcre_try_flipped.c)" "$(PCRE)/pcre_try_flipped.c"
374FILES_lib_objs += \
375	$(OBJDIR)/pcre_try_flipped.o \
376	$(EOLIST)
377endif 
378
379endif
380
381#
382# implement targets and dependancies (leave this section alone)
383#
384
385libs :: $(OBJDIR) $(TARGET_lib)
386
387nlms :: libs $(TARGET_nlm)
388
389#
390# Updated this target to create necessary directories and copy files to the
391# correct place.  (See $(AP_WORK)/build/NWGNUhead.inc for examples)
392#
393MKCNF	= $(AWK) -v BDIR=$(BASEDIR) -v PORT=$(PORT) -v SSLPORT=$(SSLPORT) -v MODSSL=$(WITH_SSL) -v BSDSKT=$(USE_STDSOCKETS) -f build/mkconfNW.awk $1 > $2
394
395install :: nlms instscripts FORCE
396	$(call COPY,$(OBJDIR)/$(NLM_NAME).nlm,                         $(INSTALLBASE)/)
397	$(call COPY,ABOUT_APACHE,                                      $(INSTALLBASE)/)
398	$(call COPY,CHANGES,                                           $(INSTALLBASE)/)
399	$(call COPY,LICENSE,                                           $(INSTALLBASE)/)
400	$(call COPY,README,                                            $(INSTALLBASE)/)
401	$(call COPY,VERSIONING,                                        $(INSTALLBASE)/)
402	$(call COPY,STATUS,                                            $(INSTALLBASE)/)
403	$(call COPY,support/dbmmanage.in,                              $(INSTALLBASE)/bin/dbmmanage.pl)
404	$(call COPY,support/logresolve.pl.in,                          $(INSTALLBASE)/bin/logresolve.pl)
405	$(call COPY,support/split-logfile.in,                          $(INSTALLBASE)/bin/split-logfile.pl)
406	$(call COPY,support/check_forensic,                            $(INSTALLBASE)/bin/check_forensic.sh)
407	$(call COPY,docs/conf/magic,                                   $(INSTALLBASE)/conf/)
408	$(call COPY,docs/conf/mime.types,                              $(INSTALLBASE)/conf/)
409	$(call COPY,docs/conf/charset.conv,                            $(INSTALLBASE)/conf/)
410	$(call COPY,docs/cgi-examples/printenv,                        $(INSTALLBASE)/cgi-bin/printenv.pl)
411	$(call MKCNF,docs/conf/httpd.conf.in,                          $(INSTALLBASE)/conf/httpd.conf)
412	$(call MKCNF,docs/conf/extra/httpd-autoindex.conf.in,          $(INSTALLBASE)/conf/extra/httpd-autoindex.conf)
413	$(call MKCNF,docs/conf/extra/httpd-dav.conf.in,                $(INSTALLBASE)/conf/extra/httpd-dav.conf)
414	$(call MKCNF,docs/conf/extra/httpd-default.conf.in,            $(INSTALLBASE)/conf/extra/httpd-default.conf)
415	$(call MKCNF,docs/conf/extra/httpd-info.conf.in,               $(INSTALLBASE)/conf/extra/httpd-info.conf)
416	$(call MKCNF,docs/conf/extra/httpd-languages.conf.in,          $(INSTALLBASE)/conf/extra/httpd-languages.conf)
417	$(call MKCNF,docs/conf/extra/httpd-manual.conf.in,             $(INSTALLBASE)/conf/extra/httpd-manual.conf)
418	$(call MKCNF,docs/conf/extra/httpd-mpm.conf.in,                $(INSTALLBASE)/conf/extra/httpd-mpm.conf)
419	$(call MKCNF,docs/conf/extra/httpd-multilang-errordoc.conf.in, $(INSTALLBASE)/conf/extra/httpd-multilang-errordoc.conf)
420	$(call MKCNF,docs/conf/extra/httpd-userdir.conf.in,            $(INSTALLBASE)/conf/extra/httpd-userdir.conf)
421	$(call MKCNF,docs/conf/extra/httpd-vhosts.conf.in,             $(INSTALLBASE)/conf/extra/httpd-vhosts.conf)
422	$(call MKCNF,docs/conf/extra/httpd-ssl.conf.in,                $(INSTALLBASE)/conf/extra/httpd-ssl.conf)
423	$(call MKCNF,docs/conf/extra/proxy-html.conf.in,               $(INSTALLBASE)/conf/extra/proxy-html.conf)
424	$(call COPYR,docs/docroot,                                     $(INSTALLBASE)/htdocs)
425	$(call COPYR,docs/error,                                       $(INSTALLBASE)/error)
426	$(call COPYR,docs/icons,                                       $(INSTALLBASE)/icons)
427	$(call COPYR,docs/man,                                         $(INSTALLBASE)/man)
428	$(call COPYR,docs/manual,                                      $(INSTALLBASE)/manual)
429
430installdev :: FORCE
431	$(call COPY,$(SRC)/include/*.h,                                $(INSTALLBASE)/include/)
432	$(call COPY,$(NWOS)/*.h,                                       $(INSTALLBASE)/include/)
433	$(call COPY,$(APR)/include/*.h,                                $(INSTALLBASE)/include/)
434	$(call COPY,$(APRUTIL)/include/*.h,                            $(INSTALLBASE)/include/)
435	$(call COPY,$(STDMOD)/core/mod_so.h,                           $(INSTALLBASE)/include/)
436	$(call COPY,$(STDMOD)/core/mod_watchdog.h,                     $(INSTALLBASE)/include/)
437	$(call COPY,$(STDMOD)/cache/mod_cache.h,                       $(INSTALLBASE)/include/)
438	$(call COPY,$(STDMOD)/cache/cache_common.h,                    $(INSTALLBASE)/include/)
439	$(call COPY,$(STDMOD)/database/mod_dbd.h,                      $(INSTALLBASE)/include/)
440	$(call COPY,$(STDMOD)/dav/main/mod_dav.h,                      $(INSTALLBASE)/include/)
441	$(call COPY,$(STDMOD)/filters/mod_include.h,                   $(INSTALLBASE)/include/)
442	$(call COPY,$(STDMOD)/generators/mod_cgi.h,                    $(INSTALLBASE)/include/)
443	$(call COPY,$(STDMOD)/generators/mod_status.h,                 $(INSTALLBASE)/include/)
444	$(call COPY,$(STDMOD)/loggers/mod_log_config.h,                $(INSTALLBASE)/include/)
445	$(call COPY,$(STDMOD)/mappers/mod_rewrite.h,                   $(INSTALLBASE)/include/)
446	$(call COPY,$(STDMOD)/proxy/mod_proxy.h,                       $(INSTALLBASE)/include/)
447	$(call COPY,$(STDMOD)/session/mod_session.h,                   $(INSTALLBASE)/include/)
448	$(call COPY,$(STDMOD)/ssl/mod_ssl.h,                           $(INSTALLBASE)/include/)
449	$(call COPY,$(APR)/*.imp,                                      $(INSTALLBASE)/lib/)
450	$(call COPY,$(NWOS)/*.imp,                                     $(INSTALLBASE)/lib/)
451	$(call COPY,$(NWOS)/*.xdc,                                     $(INSTALLBASE)/lib/)
452	$(call COPY,$(APBUILD)/NWGNU*.inc,                             $(INSTALLBASE)/build/)
453
454prebuild :: FORCE
455	$(MAKE) -C $(SERVER) -f NWGNUmakefile
456	$(MAKE) -C $(PCRE) -f NWGNUmakefile
457	$(call MKDIR,$(PREBUILD_INST))
458	$(call COPY,$(SERVER)/$(OBJDIR)/*.nlm,                         $(PREBUILD_INST)/)
459	$(call COPY,$(PCRE)/$(OBJDIR)/*.nlm,                           $(PREBUILD_INST)/)
460
461#
462# Any specialized rules here
463#
464
465vpath %.c server:modules/arch/netware:modules/http:modules/aaa:modules/mappers
466vpath %.c modules/generators:modules/metadata:modules/filters:modules/loggers
467vpath %.c modules/core:os/netware:server/mpm/netware:$(PCRE)
468
469$(OBJDIR)/chartables.o: os/netware/chartables.c
470
471#
472# Include the 'tail' makefile that has targets that depend on variables defined
473# in this makefile
474#
475
476include $(APBUILD)/NWGNUtail.inc
477
478include $(APBUILD)/NWGNUscripts.inc
479
480
481