.EXTENSIONS:
.EXTENSIONS: .dll .obj .c

srcbase = ..\..\oops-1.5.24\src
src     = $(srcbase)\modules
mptn   = Q:\WC\H\MPTN
#mptn   = D:\mptn\NewInc 

.c: $(src)
.obj: obj

cc_baseopt = -zp1 -d1 -bm -br -bt=OS2 -sg -wx -os -s -zq -fi=watcom.h -dHAVE_CONFIG_H
cc_all     = @wcc386 -zm -wcd=202 $(cc_baseopt) -fo=obj\ -i=$(%watcom)\h\os2;$(mptn);..\fooinc;..;$(srcbase)\lib\getopt;$(srcbase)\lib\rwlock

all:			&
	ooaufile.dll	&
	ooctl.dll	&
	oodbberk.dll	&
	ooerr.dll	&
	oolang.dll	&
	oologcus.dll	&
	oologdum.dll	&
	oordfast.dll	&
	oordregx.dll	&
	oovary.dll	&
	oopsctl.exe	&
	.SYMBOLIC

perv = l \Work\PERVLIB_OW\WCC003OR
link = wlink deb all system os2v2 dll file {$<} name $@ l tcp32dll l ../oopscore opt map,symf,elim,quiet export _module_type,_module_name,_module_info,mod_load_,mod_unload_,mod_run_,mod_config_,mod_config_beg_,mod_config_end_ $(perv)

ooaufile.dll: passwd_file.obj
	$(link) exp auth_ l crypt opt desc 'Oops! plugin: Auth using passwd file ($[&)'

oodbberk.dll: berkeley_db_api.obj
	$(link) exp db_api_open_,db_api_close_,db_api_get_,db_api_put_,db_api_del_,db_api_cursor_open_,db_api_cursor_close_,db_api_cursor_get_,db_api_cursor_del_,db_api_sync_ l oopsdbs opt desc 'Oops! plugin: BerkeleyDB API/stopper ($[&)'
#	wlib -b -c -n -p=1 $*.lib +$@

ooctl.dll: oopsctl_mod.obj
	$(link) exp process_call_ opt desc 'Oops! plugin: Oops controlling module ($[&)'

ooerr.dll: err.obj
	$(link) exp err_ opt desc 'Oops! plugin: Error reporting module ($[&)'

oolang.dll: lang.obj
	$(link) exp output_,compare_u_agents_ opt desc 'Oops! plugin: National languages handling module ($[&)'

oologcus.dll: custom_log.obj
	$(link) exp mod_log_,mod_reopen_ opt desc 'Oops! plugin: Customized access log ($[&)'

oologdum.dll: log_dummy.obj
	$(link) opt desc 'Oops! plugin: Dummy logging module ($[&)'

oordfast.dll: fastredir.obj
	$(link) exp redir_ opt desc 'Oops! plugin: Fast Substring URL Redirector ($[&)'

oordregx.dll: redir.obj
	$(link) exp redir_ opt desc 'Oops! plugin: Regex URL Redirector ($[&)'

oovary.dll: vary_header.obj
	$(link) exp match_headers_ opt desc ''Oops! plugin: Processing \'Vary:\' header ($[&)'

.c.obj: .AUTODEPEND
	@echo Compile: $<
	$(cc_all) -bd $<

#
# Build oopsctl.exe as EXECUTABLE (do NOT use "-bd" switch!)
#

oopsctl.exe: oopsctl.obj ulibsocks.obj
	wlink deb all system os2v2 file {$<} name $@ l tcp32dll,so32dll opt map,symf,elim,desc 'Oops controlling module' $(perv)

oopsctl.obj: oopsctl.c
	@echo Compile: $<
	$(cc_all) $<

ulibsocks.obj: ../ulibsocks.c
	@echo Compile: $<
	$(cc_all) $<
