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