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