12f4eaa60STrond Norbye# -*- Mode: makefile -*-
22f4eaa60STrond Norbye
32a1c8057SChris Hillery# PLEASE NOTE: This Makefile is provided as a convenience for those
42a1c8057SChris Hillery# who do not wish to interact with CMake. It is NOT SUPPORTED by the
52a1c8057SChris Hillery# Couchbase build team, and the production builds do NOT make use of
62a1c8057SChris Hillery# it, so bugs filed against it will need to be handled by those devs
72a1c8057SChris Hillery# who care to use it.
82a1c8057SChris Hillery
959ee24c2SChris Hillery# The default destination for installing. CMake will also search for
1059ee24c2SChris Hillery# dependencies in this directory, so you may pre-build dependencies
1159ee24c2SChris Hillery# that you wish to ship with your compiled Couchbase into this
1259ee24c2SChris Hillery# directory.
13466d98a3STrond NorbyePREFIX=$(MAKEDIR)\\install
1451161c96STrond Norbye# The makefile type to generate
152f4eaa60STrond NorbyeMAKETYPE=NMake Makefiles
1651161c96STrond Norbye# The command used to delete directories
172f4eaa60STrond NorbyeRM=rmdir
1851161c96STrond Norbye# Options passed to the command to nuke directories
192f4eaa60STrond NorbyeRMOPTS=/Q /S
2051161c96STrond Norbye# Other options you would like to pass to cmake
2151161c96STrond NorbyeEXTRA_CMAKE_OPTIONS=
22ea48e689STrond Norbye# Command used to remove read only flag for files
23ea48e689STrond NorbyeCHMODCMD=attrib -r
24ea48e689STrond Norbye# Command used for copying files
25ea48e689STrond NorbyeCP=copy
261ec9a843STrond Norbye# path separator
271ec9a843STrond NorbyeSEPARATOR=\\
282f4eaa60STrond Norbye
29d8ec3c8eSMark NunbergCMAKE=cmake
30d8ec3c8eSMark Nunberg
328cdc1b8bSDave Rigby
338cdc1b8bSDave Rigby
34ea48e689STrond Norbyeall: CMakeLists.txt Makefile GNUmakefile build/Makefile compile
352f4eaa60STrond Norbye
36003b3a0aSTrond Norbyecompile: build/Makefile
372f4eaa60STrond Norbye	(cd build && $(MAKE) all install)
382f4eaa60STrond Norbye
392f4eaa60STrond Norbyetest: all
402f4eaa60STrond Norbye	(cd build && $(MAKE) test)
412f4eaa60STrond Norbye
422f4eaa60STrond Norbyebuild/Makefile: CMakeLists.txt
432f4eaa60STrond Norbye	@-mkdir build
448cdc1b8bSDave Rigby	(cd build && $(CMAKE) $(CMAKE_ARGS) ..)
458cdc1b8bSDave Rigby
46ea48e689STrond NorbyeCMakeLists.txt: tlm/CMakeLists.txt
47ea48e689STrond Norbye	$(CHMODCMD) CMakeLists.txt
48f61e2b19STrond Norbye	$(CP) tlm$(SEPARATOR)CMakeLists.txt CMakeLists.txt
49ea48e689STrond Norbye
50ea48e689STrond NorbyeGNUmakefile: tlm/GNUmakefile
51ea48e689STrond Norbye	$(CHMODCMD) GNUmakefile
52f61e2b19STrond Norbye	$(CP) tlm$(SEPARATOR)GNUmakefile GNUmakefile
53ea48e689STrond Norbye
54ea48e689STrond NorbyeMakefile: tlm/Makefile
55ea48e689STrond Norbye	$(CHMODCMD) Makefile
56f61e2b19STrond Norbye	$(CP) tlm$(SEPARATOR)Makefile Makefile
57ea48e689STrond Norbye
58ea48e689STrond Norbye
598cdc1b8bSDave Rigby# Invoke static analyser. Requires Clang Static Analyser
60f053b3b8STrond Norbye# (http://clang-analyzer.llvm.org). See tlm/README.markdown for more
61f053b3b8STrond Norbye# information.
628cdc1b8bSDave Rigbyanalyze:
638cdc1b8bSDave Rigby	@-mkdir build-analyzer
648cdc1b8bSDave Rigby	(cd build-analyzer && 				\
65063d5a88SDave Rigby	 scan-build --use-analyzer=Xcode $(CMAKE) $(CMAKE_ARGS) -DCOUCHBASE_DISABLE_CCACHE=1 .. && \
668cdc1b8bSDave Rigby	 scan-build --use-analyzer=Xcode -o analyser-results/ $(MAKE) all)
672f4eaa60STrond Norbye
6841ff7d74SVolker Mische# geocouch needs a special build for running the unit tests
6941ff7d74SVolker Mischegeocouch-build-for-testing: compile
7041ff7d74SVolker Mische	@-mkdir build/geocouch-for-tests
7141ff7d74SVolker Mische	(cd build/geocouch-for-tests && \
72966412d3SVolker Mische	 $(CMAKE) $(CMAKE_ARGS) -D CMAKE_INSTALL_PREFIX="$(PREFIX)" \
73966412d3SVolker Mische	 -D GEOCOUCH_BUILD_FOR_UNIT_TESTS=1 ../../geocouch && \
7441ff7d74SVolker Mische	 $(MAKE))
7541ff7d74SVolker Mische
7635c00707SChris Hilleryanalytics-install: build/Makefile
7735c00707SChris Hillery	(cd build && make analytics)
7835c00707SChris Hillery
792f4eaa60STrond Norbyerun-mats:
802f4eaa60STrond Norbye	cd testrunner && $(MAKE) simple-test
812f4eaa60STrond Norbye
822f4eaa60STrond Norbyee2etest:
832f4eaa60STrond Norbye	cd testrunner && $(MAKE) test
842f4eaa60STrond Norbye
852f4eaa60STrond Norbyee2eviewtests:
862f4eaa60STrond Norbye	cd testrunner && $(MAKE) test-views
872f4eaa60STrond Norbye
882f4eaa60STrond Norbyeclean:
8924d44145SChris Hillery	-(cd build && $(MAKE) realclean)
907b6f17a5SChris Hillery	-$(RM) $(RMOPTS) build ns_server$(SEPARATOR)build install voltron$(SEPARATOR)build
9124d44145SChris Hillery
9224d44145SChris Hilleryreset:
9324d44145SChris Hillery	(cd build && $(MAKE) reset)
942f4eaa60STrond Norbye
952f4eaa60STrond Norbyeclean-xfd: clean
96471e82f7SDave Rigby	-(cd ns_server && git clean -dfxq)
972f4eaa60STrond Norbye
982f4eaa60STrond Norbyeclean-xfd-hard: clean-xfd
992f4eaa60STrond Norbye
1002f4eaa60STrond Norbyeclean-all: clean-xfd-hard