1# Licensed to the Apache Software Foundation (ASF) under one
2# or more contributor license agreements.  See the NOTICE file
3# distributed with this work for additional information
4# regarding copyright ownership.  The ASF licenses this file
5# to you under the Apache License, Version 2.0 (the
6# "License"); you may not use this file except in compliance
7# with the License.  You may obtain a copy of the License at
8#
9#   http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing,
12# software distributed under the License is distributed on an
13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14# KIND, either express or implied.  See the License for the
15# specific language governing permissions and limitations
16# under the License.
17
18CONFIG=debug
19#CONFIG=release
20# will be appended to 'svn --version --quiet' output; set to zero to suppress
21BUILDDESCR=0
22
23MSBUILD=msbuild subversion_vcnet.sln /nologo /v:q /p:Configuration=$(CONFIG)
24CP=cp
25TEEPATH=C:\Path\To\Parent\Of\tee\dot\exe\and\other\utils\as\needed\see\below.80
26
27SOURCESDIR=C:\Path\To\Dependency\Sources
28SVNDIR=C:\Path\To\Subversion\SourceTree
29TARGETDIR=$(SVNDIR)\dist
30INSTALLDIR=E:\svn
31
32EXPATVER=2.0.0
33HTTPDVER=2.2.13
34SERFVER=1.1.0
35OPENSSLVER=0.9.8k
36SQLITEVER=3.6.3
37ZLIBVER=1.2.3
38#ENABLE_ML=--enable-ml
39
40PATCHESDIR=$(HOME)\mydiffs\svn
41OPENSSLDIR=$(SOURCESDIR)\openssl-$(OPENSSLVER)
42EXPATDIR=$(SOURCESDIR)\expat-$(EXPATVER)
43HTTPDDIR=$(SOURCESDIR)\httpd-$(HTTPDVER)
44#APRDIR=$(SOURCESDIR)\apr
45#APRUTILDIR=$(SOURCESDIR)\apr-util
46#APRICONVDIR=$(SOURCESDIR)\apr-iconv
47APRDIR=$(HTTPDDIR)\srclib\apr
48APRUTILDIR=$(HTTPDDIR)\srclib\apr-util
49APRICONVDIR=$(HTTPDDIR)\srclib\apr-iconv
50SQLITEDIR=$(SOURCESDIR)\sqlite-amalgamation
51ZLIBDIR=$(SOURCESDIR)\zlib-$(ZLIBVER)
52SERFDIR=$(SOURCESDIR)\serf-$(SERFVER)
53
54all:
55	@echo Available targets: newfiles versionstamp
56	@echo Available targets: config
57	@echo Available targets: progname testname
58	@echo Available targets: all1 all2
59	@echo Available targets: buildlog package
60	@echo Available targets: check checklog
61TARGETDIRset: SVNDIRset
62	if X$(TARGETDIR) == X exit 1
63SVNDIRset:
64	if X$(SVNDIR) == X exit 1
65
66removealllocalmods:
67	svn revert -R .
68	svn status --no-ignore | xargs rm -rf --
69	svn status --no-ignore
70	# last, in case of wc format bump
71	rmdir /s /q dist local Release Debug
72
73newfiles: SVNDIRset
74	xcopy /s /y $(PATCHESDIR)\newfiles $(SVNDIR)
75versionstamp:
76	perl tools\dev\windows-build\document-version.pl subversion\include\svn_version.h $(TARGETDIR) $(SVNDIR) $(BUILDDESCR)
77	svn diff subversion\include\svn_version.h
78
79cleanup1: TARGETDIR
80	del log.all-tests log.gen-make.py log.devenv log.win-tests
81	rmdir /s /q $(TARGETDIR)\bin
82
83clean:
84	@echo "Sorry, '$@' target not yet implemented" >&2
85# TODO also copy sqlite3.dll if it's used
86install: TARGETDIRset
87	test ! -d $(INSTALLDIR)
88	mkdir $(INSTALLDIR)\bin
89	pushd $(TARGETDIR)\bin                      &&\
90	$(CP) *.exe        $(INSTALLDIR)/bin        &&\
91	$(CP) libapr*.dll  $(INSTALLDIR)/bin        &&\
92	$(CP) libeay32.dll $(INSTALLDIR)/bin        &&\
93	$(CP) ssleay32.dll $(INSTALLDIR)/bin        &&\
94	$(CP) libsvn*.dll  $(INSTALLDIR)/bin        &&\
95	$(CP) ..\*.diff    $(INSTALLDIR)            &&\
96	popd
97
98targetdir: TARGETDIRset
99	test -d $(TARGETDIR)\bin || mkdir $(TARGETDIR)\bin
100
101# TODO: pass --with-apr-* if you don't have httpd; make --with-* args optional
102config: targetdir
103	python gen-make.py --$(CONFIG) --with-httpd=$(HTTPDDIR) --with-serf=$(SERFDIR) --with-openssl=$(OPENSSLDIR) --with-sqlite=$(SQLITEDIR) --with-zlib=$(ZLIBDIR) $(ENABLE_ML) --vsnet-version=2008 -t vcproj 2>&1 | tee log.gen-make
104
105# Visual Studio 2008
106libsvn_auth_gnome_keyring libsvn_auth_kwallet libsvn_client libsvn_delta libsvn_diff libsvn_fs libsvn_fs_base libsvn_fs_fs libsvn_fs_util libsvn_ra libsvn_ra_local libsvn_ra_serf libsvn_ra_svn libsvn_repos libsvn_subr libsvn_wc: targetdir
107	$(MSBUILD) /t:Libraries\$@
108	$(MAKE) package
109svn svnadmin svndumpfilter svnlook svnmucc svnserve svnsync svnversion svnrdump entries-dump: targetdir
110	$(MSBUILD) /t:Programs\$@
111	$(MAKE) package
112auth-test cache-test changes-test checksum-test client-test compat-test config-test db-test diff-diff3-test dir-delta-editor dirent_uri-test error-test fs-base-test fs-pack-test fs-test hashdump-test key-test locks-test mergeinfo-test opt-test path-test ra-local-test random-test repos-test revision-test skel-test stream-test string-test strings-reps-test svn_test_fs svn_test_main svndiff-test target-test time-test translate-test tree-conflict-data-test utf-test vdelta-test window-test: targetdir
113	$(MSBUILD) /t:Tests\$@
114	$(MAKE) package
115
116__ALL__ __ALL_TESTS__: targetdir
117	$(MSBUILD) /t:$@
118	$(MAKE) package
119all1: targetdir
120	$(MSBUILD) /t:__ALL__
121	$(MAKE) package
122	@echo TODO entries-test
123all2: targetdir
124	$(MSBUILD) /t:__ALL_TESTS__
125	$(MAKE) package
126
127package:
128	test -d $(SVNDIR)\$(CONFIG)\Subversion\tests\cmdline || mkdir $(SVNDIR)\$(CONFIG)\Subversion\tests\cmdline
129	test -d $(TARGETDIR)\bin || mkdir $(TARGETDIR)\bin
130	for %%i in (svn svnadmin svndumpfilter svnlook svnserve svnsync svnversion svnrdump svnmucc) do @$(CP) $(CONFIG)\subversion\%%i\%%i.exe $(TARGETDIR)\bin
131	for %%i in (diff diff3 diff4) do @if exist $(CONFIG)\tools\diff\%%i.exe $(CP) $(CONFIG)\tools\diff\%%i.exe $(TARGETDIR)\bin
132	$(CP) $(APRDIR)\$(CONFIG)/*.dll $(TARGETDIR)\bin
133	$(CP) $(APRUTILDIR)\$(CONFIG)/*.dll $(TARGETDIR)\bin
134	$(CP) $(APRICONVDIR)\$(CONFIG)/*.dll $(TARGETDIR)\bin
135	$(CP) $(OPENSSLDIR)\out32dll/*.dll $(TARGETDIR)\bin
136	for %%i in (client delta diff fs ra repos subr wc) do @$(CP) $(CONFIG)\subversion\libsvn_%%i\*.dll $(TARGETDIR)\bin
137
138buildlog:
139	gvim -c "set autoread nowrap" -c "/\(\<0 \)\@<!error" log.devenv
140# 'make check'
141# TODO: also support svncheck, etc
142check:
143	echo %date% %time% :: Starting fsfs file >> log.all-tests
144	python win-tests.py --verbose --cleanup --bin=$(TARGETDIR)\bin --$(CONFIG) -f fsfs 2>&1 | %TEEPATH%\tee log.win-tests
145	echo %date% %time% :: Finished fsfs file >> log.all-tests
146
147
148# check errors
149checklog:
150	gvim -c "set autoread" -p log.win-tests *\*.log "+silent! /X\@<!FAIL\|XPASS"
151
152tags: .
153	REM vim +Ctags +quit
154	ctags -R .
155	$(CP) tags ..\svntags
156