
LINK=link /nologo

NONPORTABLE = \
	testshm.exe \
	testglobalmutex.exe

PROGRAMS = \
	client.exe \
	sendfile.exe \
	server.exe \
	proc_child.exe \
	occhild.exe \
	readchild.exe \
	testflock.exe \
	testsock.exe \
	testlockperf.exe \
	testshmproducer.exe \
	testshmconsumer.exe \
	testatomic.exe \
	testmutexscope.exe \
	testall.exe \
	mod_test.so


TARGETS = $(PROGRAMS)

LOCAL_LIBS=..\LibD\apr.lib 
ALL_LIBS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib

CLEAN_TARGETS = mod_test.lib mod_test.exp

INCDIR=../include
INCLUDES=/I "$(INCDIR)"

all: $(TARGETS)

clean:
	-del $(CLEAN_TARGETS) $(PROGRAMS) *.obj *.pdb *.ilk 2>NUL

.c.obj:
	cl /nologo /c /MDd /W3 /GX /Zi /Od /DWIN32 /D_DEBUG /D_WINDOWS /DAPR_DECLARE_STATIC $(INCLUDES) $<

testflock.exe: testflock.obj $(LOCAL_LIBS)
	$(LINK) testflock.obj $(LOCAL_LIBS) $(ALL_LIBS)

occhild.exe: occhild.obj $(LOCAL_LIBS)
	$(LINK) occhild.obj $(LOCAL_LIBS) $(ALL_LIBS)

readchild.exe: readchild.obj $(LOCAL_LIBS)
	$(LINK) readchild.obj $(LOCAL_LIBS) $(ALL_LIBS)

proc_child.exe: proc_child.obj $(LOCAL_LIBS)
	$(LINK) /debug /subsystem:console /machine:I386 \
		proc_child.obj $(LOCAL_LIBS) $(ALL_LIBS)

# FIXME: This is BS ... we should deal with namespace decoration within the
# apr_dso_sym() function or within the test (take y'r pick) since many platforms
# have decoration and decoration issues.
mod_test.so: mod_test.obj
	$(LINK) mod_test.obj /dll /out:mod_test.so $(LOCAL_LIBS) $(ALL_LIBS) \
		/export:print_hello /export:count_reps

testlockperf.exe: testlockperf.obj $(LOCAL_LIBS)
	$(LINK) testlockperf.obj $(LOCAL_LIBS) $(ALL_LIBS)

testsock.exe: testsock.obj client.exe server.exe sendfile.exe $(LOCAL_LIBS)
	$(LINK) testsock.obj $(LOCAL_LIBS) $(ALL_LIBS)

client.exe: client.obj $(LOCAL_LIBS)
	$(LINK) client.obj $(LOCAL_LIBS) $(ALL_LIBS)

server.exe: server.obj $(LOCAL_LIBS)
	$(LINK) server.obj $(LOCAL_LIBS) $(ALL_LIBS)

sendfile.exe: sendfile.obj $(LOCAL_LIBS)
	$(LINK) sendfile.obj $(LOCAL_LIBS) $(ALL_LIBS)

testshm.exe: testshm.obj $(LOCAL_LIBS) testshmproducer.exe testshmconsumer.exe
	$(LINK) testshm.obj $(LOCAL_LIBS) $(ALL_LIBS)

testshmproducer.exe: testshmproducer.obj $(LOCAL_LIBS)
	$(LINK) testshmproducer.obj $(LOCAL_LIBS) $(ALL_LIBS)

testshmconsumer.exe: testshmconsumer.obj $(LOCAL_LIBS)
	$(LINK) testshmconsumer.obj $(LOCAL_LIBS) $(ALL_LIBS)

testprocmutex.exe: testprocmutex.obj $(LOCAL_LIBS)
	$(LINK) testprocmutex.obj $(LOCAL_LIBS) $(ALL_LIBS)

testglobalmutex.exe: testglobalmutex.obj $(LOCAL_LIBS)
	$(LINK) testglobalmutex.obj $(LOCAL_LIBS) $(ALL_LIBS)

testatomic.exe: testatomic.obj $(LOCAL_LIBS)
	$(LINK) testatomic.obj $(LOCAL_LIBS) $(ALL_LIBS)

testmutexscope.exe: testmutexscope.obj $(LOCAL_LIBS)
	$(LINK) testmutexscope.obj $(LOCAL_LIBS) $(ALL_LIBS)

TESTS = testall.obj testtime.obj teststr.obj testvsn.obj testipsub.obj \
	testmmap.obj testud.obj testtable.obj testsleep.obj testpools.obj \
	testfmt.obj testfile.obj testdir.obj testfileinfo.obj testrand.obj \
	testdso.obj testoc.obj testdup.obj testsockets.obj testproc.obj \
	testpoll.obj testlock.obj testsockopt.obj testpipe.obj testthread.obj \
	testhash.obj testargs.obj testnames.obj testuser.obj testpath.obj \
	testenv.obj testprocmutex.obj

testall.exe: $(TESTS) CuTest.obj $(LOCAL_LIBS)
	$(LINK) /debug /subsystem:console /machine:I386 $(TESTS) CuTest.obj \
		$(LOCAL_LIBS) $(ALL_LIBS)


# DO NOT REMOVE
