Makefile.win revision 251886
1# PROGRAMS
2#   test programs invoked via standard user interface, run on all platforms
3# ALL_TESTS
4#   test modules invoked through the abts suite (./testall)
5# OTHER_PROGRAMS
6#   programs such as sendfile, that have to be invoked in a special sequence
7#   or with special parameters
8
9# Windows Specific;
10# MODEL
11#   dynamic or static - refers to which set of bindings are desired
12#   and controls which libraries (apr-1 or libapr-1) will be linked.
13# OUTDIR
14#   the library path of the libraries, and also the path within test/
15#   where all of the tests for that library will be built
16# APROUTDIR
17#   The library path of apr (if different from OUTDIR)
18# APR_PATH
19#   relative or absolute path to locate apr libs and includes
20# API_PATH
21#   relative or absolute path to locate apr-iconv libs and includes
22
23!IFNDEF MODEL
24MODEL=dynamic
25!ENDIF
26
27!IFNDEF OUTDIR
28!IF "$(MODEL)" == "static"
29OUTDIR=LibR
30!ELSE
31OUTDIR=Release
32!ENDIF
33
34!IF [$(COMSPEC) /c cl /nologo /? \
35	| $(SystemRoot)\System32\find.exe "x64" >NUL ] == 0
36OUTDIR=x64\$(OUTDIR)
37!ENDIF
38!ENDIF
39
40!IF !EXIST("$(OUTDIR)\.")
41!IF ([$(COMSPEC) /C mkdir $(OUTDIR)] == 0)
42!ENDIF
43!ENDIF
44
45!IFNDEF INTDIR
46INTDIR=$(OUTDIR)
47!ELSE
48!IF !EXIST("$(INTDIR)\.")
49!IF ([$(COMSPEC) /C mkdir $(INTDIR)] == 0)
50!ENDIF
51!ENDIF
52!ENDIF
53
54!MESSAGE Building tests into $(OUTDIR) for $(MODEL)
55
56ALL_TESTS = $(INTDIR)\teststrmatch.obj $(INTDIR)\testuri.obj \
57	$(INTDIR)\testuuid.obj $(INTDIR)\testutil.obj \
58	$(INTDIR)\testbuckets.obj $(INTDIR)\testpass.obj \
59	$(INTDIR)\testmd4.obj $(INTDIR)\testmd5.obj \
60	$(INTDIR)\testldap.obj $(INTDIR)\testdbd.obj \
61	$(INTDIR)\testdbm.obj $(INTDIR)\testreslist.obj \
62	$(INTDIR)\testxml.obj $(INTDIR)\testqueue.obj \
63	$(INTDIR)\testrmm.obj $(INTDIR)\testxlate.obj \
64	$(INTDIR)\testdate.obj $(INTDIR)\testmemcache.obj
65
66CLEAN_DATA = manyfile.bin testfile.txt data\sqlite*.db
67
68CLEAN_BUILDDIRS = Debug Release LibD LibR 9x x64
69
70PROGRAMS = \
71	$(OUTDIR)\testall.exe
72
73OTHER_PROGRAMS = \
74	$(OUTDIR)\dbd.exe
75
76# bring in rules.mk for standard functionality
77ALL: $(PROGRAMS) $(OTHER_PROGRAMS)
78
79CL = cl.exe
80LD = link.exe 
81
82APR_PATH = ..\..\apr
83API_PATH = ..\..\apr-iconv
84
85APROUTDIR=$(OUTDIR)
86
87!IF "$(MODEL)" == "static"
88PROGRAM_DEPENDENCIES = \
89	$(APR_PATH)\$(APROUTDIR)\apr-1.lib \
90	..\$(OUTDIR)\aprutil-1.lib 
91STATIC_CFLAGS = /D APR_DECLARE_STATIC /D APU_DECLARE_STATIC
92STATIC_LIBS = odbc32.lib odbccp32.lib wldap32.lib 
93!ELSE
94PROGRAM_DEPENDENCIES = \
95	$(APR_PATH)\$(APROUTDIR)\libapr-1.lib \
96	..\$(OUTDIR)\libaprutil-1.lib 
97STATIC_CFLAGS =
98# APR 1.3 doesn't fully abstract ldap_ calls to permit switching providers;
99STATIC_LIBS = wldap32.lib 
100!ENDIF
101
102!IFDEF _DEBUG
103DEBUG_CFLAGS = /MDd
104!ELSE
105DEBUG_CFLAGS = /MD 
106!ENDIF
107
108INCLUDES=/I "../include" /I "$(API_PATH)/include" /I "$(APR_PATH)/include"
109
110CFLAGS = /nologo /c /W3 /Gm /EHsc /Zi /Od $(INCLUDES) \
111	 $(STATIC_CFLAGS) $(DEBUG_CFLAGS) /D "BINPATH=$(OUTDIR:\=/)" \
112	 /D _DEBUG /D WIN32 /Fo"$(INTDIR)/" /FD
113
114LD_LIBS = kernel32.lib advapi32.lib ws2_32.lib wsock32.lib \
115	  ole32.lib shell32.lib rpcrt4.lib $(STATIC_LIBS)
116
117LDFLAGS = /nologo /debug /subsystem:console /incremental:no 
118SHLDFLAGS = /nologo /dll /debug /subsystem:windows /incremental:no
119
120.c{$(INTDIR)}.obj::
121	$(CL) $(CFLAGS) -c $< -Fd$(INTDIR)\ $(INCLUDES)
122
123# PROGRAMS;
124
125abts.c: abts.h abts_tests.h testutil.h
126
127testutil.c: abts.h abts_tests.h testutil.h
128
129$(OUTDIR)\testall.exe: $(ALL_TESTS) $(INTDIR)\abts.obj $(PROGRAM_DEPENDENCIES)
130	$(LD) $(LDFLAGS) /out:"$@" $** $(LD_LIBS)
131	@if exist "$@.manifest" \
132	    mt.exe -manifest "$@.manifest" -outputresource:$@;1
133
134# OTHER_PROGRAMS;
135
136$(OUTDIR)\dbd.exe: $(INTDIR)\dbd.obj $(PROGRAM_DEPENDENCIES)
137	$(LD) $(LDFLAGS) /out:"$@" $** $(LD_LIBS)
138	@if exist "$@.manifest" \
139	    mt.exe -manifest "$@.manifest" -outputresource:$@;1
140
141
142cleandata:
143	@for %f in ($(CLEAN_DATA)) do @if EXIST %f del /f %f
144
145clean: cleandata
146	@if EXIST $(INTDIR)\. rmdir /s /q $(INTDIR)
147	@if EXIST $(OUTDIR)\. rmdir /s /q $(OUTDIR)
148
149cleanall: 
150	@for %d in ($(CLEAN_BUILDDIRS) $(INTDIR) $(OUTDIR)) do \
151	    @if EXIST %d\. rmdir /s /q %d
152
153
154!IF "$(MODEL)" != "static"
155PATH=$(OUTDIR);..\$(OUTDIR);..\ldap\$(OUTDIR);..\dbd\$(OUTDIR);$(API_PATH)\$(OUTDIR);$(APR_PATH)\$(APROUTDIR);$(PATH)
156!ENDIF
157APR_ICONV1_PATH=$(API_PATH)\$(OUTDIR)\iconv
158
159check: $(PROGRAMS) $(OTHER_PROGRAMS)
160	echo Testing dbd sqlite2 && $(OUTDIR)\dbd.exe sqlite2 || echo Failed
161	echo Testing dbd sqlite3 && $(OUTDIR)\dbd.exe sqlite3 || echo Failed
162	@for %p in ($(PROGRAMS)) do @( \
163	    echo Testing %p && %p -v || echo %p failed \
164	)
165
166checkall: check
167
168# DO NOT REMOVE
169