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# Other options you would like to pass to cmake
21EXTRA_CMAKE_OPTIONS=
22# Command used to remove read only flag for files
23CHMODCMD=attrib -r
24# Command used for copying files
25CP=copy
26# path separator
27SEPARATOR=\\
28
29CMAKE=cmake
30
31CMAKE_ARGS=-G "$(MAKETYPE)" -D PRODUCT_VERSION=$(PRODUCT_VERSION) \
32                            -D BUILD_ENTERPRISE=$(BUILD_ENTERPRISE) \
33                            $(EXTRA_CMAKE_OPTIONS)
34
35
36all: CMakeLists.txt Makefile GNUmakefile build/Makefile compile
37
38compile: build/Makefile
39	(cd build && $(MAKE) all install)
40
41test: all
42	(cd build && $(MAKE) test)
43
44build/Makefile: CMakeLists.txt
45	@-mkdir build
46	(cd build && $(CMAKE) $(CMAKE_ARGS) ..)
47
48CMakeLists.txt: tlm/CMakeLists.txt
49	$(CHMODCMD) CMakeLists.txt
50	$(CP) tlm$(SEPARATOR)CMakeLists.txt CMakeLists.txt
51
52GNUmakefile: tlm/GNUmakefile
53	$(CHMODCMD) GNUmakefile
54	$(CP) tlm$(SEPARATOR)GNUmakefile GNUmakefile
55
56Makefile: tlm/Makefile
57	$(CHMODCMD) Makefile
58	$(CP) tlm$(SEPARATOR)Makefile Makefile
59
60
61# Invoke static analyser. Requires Clang Static Analyser
62# (http://clang-analyzer.llvm.org). See tlm/README.markdown for more
63# information.
64analyze:
65	@-mkdir build-analyzer
66	(cd build-analyzer && 				\
67	 scan-build --use-analyzer=Xcode $(CMAKE) $(CMAKE_ARGS) -DCOUCHBASE_DISABLE_CCACHE=1 .. && \
68	 scan-build --use-analyzer=Xcode -o analyser-results/ $(MAKE) all)
69
70# geocouch needs a special build for running the unit tests
71geocouch-build-for-testing: compile
72	@-mkdir build/geocouch-for-tests
73	(cd build/geocouch-for-tests && \
74	 $(CMAKE) $(CMAKE_ARGS) -D CMAKE_INSTALL_PREFIX="$(PREFIX)" \
75	 -D GEOCOUCH_BUILD_FOR_UNIT_TESTS=1 ../../geocouch && \
76	 $(MAKE))
77
78run-mats:
79	cd testrunner && $(MAKE) simple-test
80
81e2etest:
82	cd testrunner && $(MAKE) test
83
84e2eviewtests:
85	cd testrunner && $(MAKE) test-views
86
87clean:
88	-(cd build && $(MAKE) realclean)
89	-$(RM) $(RMOPTS) build ns_server$(SEPARATOR)build
90
91reset:
92	(cd build && $(MAKE) reset)
93
94clean-xfd: clean
95	-(cd ns_server && git clean -dfxq)
96
97clean-xfd-hard: clean-xfd
98
99clean-all: clean-xfd-hard
100