1# -*- Mode: makefile -*-
2
3# The default destination for installing. CMake will also search for
4# dependencies in this directory, so you may pre-build dependencies
5# that you wish to ship with your compiled Couchbase into this
6# directory.
7PREFIX=$(MAKEDIR)\\install
8# The makefile type to generate
9MAKETYPE=NMake Makefiles
10# The command used to delete directories
11RM=rmdir
12# Options passed to the command to nuke directories
13RMOPTS=/Q /S
14# The kind of build type: Debug, Release, RelWithDebInfo or MinSizeRel
15BUILD_TYPE=Debug
16# Other options you would like to pass to cmake
17EXTRA_CMAKE_OPTIONS=
18# Command used to remove read only flag for files
19CHMODCMD=attrib -r
20# Command used for copying files
21CP=copy
22
23CMAKE=cmake
24
25CMAKE_ARGS=-G "$(MAKETYPE)" -D CMAKE_INSTALL_PREFIX="$(PREFIX)" \
26                            -D CMAKE_PREFIX_PATH="$(CMAKE_PREFIX_PATH);$(PREFIX)" \
27                            -D PRODUCT_VERSION=$(PRODUCT_VERSION) \
28                            -D BUILD_ENTERPRISE=$(BUILD_ENTERPRISE) \
29                            -D CMAKE_BUILD_TYPE=$(BUILD_TYPE) \
30                            $(EXTRA_CMAKE_OPTIONS)
31
32
33all: CMakeLists.txt Makefile GNUmakefile build/Makefile compile
34
35compile: build/Makefile
36	(cd build && $(MAKE) all install)
37
38test: all
39	(cd build && $(MAKE) test)
40
41build/Makefile: CMakeLists.txt
42	@-mkdir build
43	(cd build && $(CMAKE) $(CMAKE_ARGS) ..)
44
45CMakeLists.txt: tlm/CMakeLists.txt
46	$(CHMODCMD) CMakeLists.txt
47	$(CP) tlm/CMakeLists.txt CMakeLists.txt
48
49GNUmakefile: tlm/GNUmakefile
50	$(CHMODCMD) GNUmakefile
51	$(CP) tlm/GNUmakefile GNUmakefile
52
53Makefile: tlm/Makefile
54	$(CHMODCMD) Makefile
55	$(CP) tlm/Makefile Makefile
56
57
58# Invoke static analyser. Requires Clang Static Analyser
59# (http://clang-analyzer.llvm.org). See tlm/README.markdown for more
60# information.
61analyze:
62	@-mkdir build-analyzer
63	(cd build-analyzer && 				\
64	 scan-build --use-analyzer=Xcode $(CMAKE) $(CMAKE_ARGS) .. && \
65	 scan-build --use-analyzer=Xcode -o analyser-results/ $(MAKE) all)
66
67run-mats:
68	cd testrunner && $(MAKE) simple-test
69
70e2etest:
71	cd testrunner && $(MAKE) test
72
73e2eviewtests:
74	cd testrunner && $(MAKE) test-views
75
76clean:
77	-$(RM) $(RMOPTS) build $(PREFIX)
78
79clean-xfd: clean
80	cd couchdb && git clean -dfxq
81	cd ns_server && git clean -dfxq
82	cd geocouch && git clean -dfxq
83
84clean-xfd-hard: clean-xfd
85
86clean-all: clean-xfd-hard
87