1# -*- Mode: makefile -*-
2
3# PLEASE NOTE: This Makefile is provided as a convenience for those
4# who do not wish to interact with CMake. It is NOT SUPPORTED by the
5# Couchbase build team, and the production builds do NOT make use of
6# it, so bugs filed against it will need to be handled by those devs
7# who care to use it.
8
9# The default destination for installing. CMake will also search for
10# dependencies in this directory, so you may pre-build dependencies
11# that you wish to ship with your compiled Couchbase into this
12# directory.
13PREFIX=$(MAKEDIR)\\install
14# The makefile type to generate
15MAKETYPE=NMake Makefiles
16# The command used to delete directories
17RM=rmdir
18# Options passed to the command to nuke directories
19RMOPTS=/Q /S
20# The kind of build type: Debug, Release, RelWithDebInfo or MinSizeRel
21BUILD_TYPE=RelWithDebInfo
22# Other options you would like to pass to cmake
23EXTRA_CMAKE_OPTIONS=
24# Command used to remove read only flag for files
25CHMODCMD=attrib -r
26# Command used for copying files
27CP=copy
28# path separator
29SEPARATOR=\\
30
31CMAKE=cmake
32
33CMAKE_ARGS=-G "$(MAKETYPE)" -D CMAKE_INSTALL_PREFIX="$(PREFIX)" \
34                            -D CMAKE_PREFIX_PATH="$(CMAKE_PREFIX_PATH);$(PREFIX)" \
35                            -D PRODUCT_VERSION=$(PRODUCT_VERSION) \
36                            -D BUILD_ENTERPRISE=$(BUILD_ENTERPRISE) \
37                            -D CMAKE_BUILD_TYPE=$(BUILD_TYPE) \
38                            $(EXTRA_CMAKE_OPTIONS)
39
40
41all: CMakeLists.txt Makefile GNUmakefile build/Makefile compile
42
43compile: build/Makefile
44	(cd build && $(MAKE) all install)
45
46test: all
47	(cd build && $(MAKE) test)
48
49build/Makefile: CMakeLists.txt
50	@-mkdir build
51	(cd build && $(CMAKE) $(CMAKE_ARGS) ..)
52
53CMakeLists.txt: tlm/CMakeLists.txt
54	$(CHMODCMD) CMakeLists.txt
55	$(CP) tlm$(SEPARATOR)CMakeLists.txt CMakeLists.txt
56
57GNUmakefile: tlm/GNUmakefile
58	$(CHMODCMD) GNUmakefile
59	$(CP) tlm$(SEPARATOR)GNUmakefile GNUmakefile
60
61Makefile: tlm/Makefile
62	$(CHMODCMD) Makefile
63	$(CP) tlm$(SEPARATOR)Makefile Makefile
64
65
66# Invoke static analyser. Requires Clang Static Analyser
67# (http://clang-analyzer.llvm.org). See tlm/README.markdown for more
68# information.
69analyze:
70	@-mkdir build-analyzer
71	(cd build-analyzer && 				\
72	 scan-build --use-analyzer=Xcode $(CMAKE) $(CMAKE_ARGS) .. && \
73	 scan-build --use-analyzer=Xcode -o analyser-results/ $(MAKE) all)
74
75# geocouch needs a special build for running the unit tests
76geocouch-build-for-testing: compile
77	@-mkdir build/geocouch-for-tests
78	(cd build/geocouch-for-tests && \
79        $(CMAKE) $(CMAKE_ARGS) -D GEOCOUCH_BUILD_FOR_UNIT_TESTS=1 ../../geocouch && \
80	 $(MAKE))
81
82run-mats:
83	cd testrunner && $(MAKE) simple-test
84
85e2etest:
86	cd testrunner && $(MAKE) test
87
88e2eviewtests:
89	cd testrunner && $(MAKE) test-views
90
91clean:
92	-(cd build && $(MAKE) realclean)
93	-$(RM) $(RMOPTS) build $(PREFIX) godeps$(SEPARATOR)pkg goproj$(SEPARATOR)bin goproj$(SEPARATOR)pkg ns_server$(SEPARATOR)/build
94
95reset:
96	(cd build && $(MAKE) reset)
97
98clean-xfd: clean
99	cd ns_server && git clean -dfxq
100
101clean-xfd-hard: clean-xfd
102
103clean-all: clean-xfd-hard
104