fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

David AdamBSD/GNUmakefile: update to use new fish_run_tests target15ca16477

master
1.7 KiB59 linesraw
1# This is a very basic `make` wrapper around the CMake build toolchain.
2#
3# Supported arguments:
4#   PREFIX: sets the installation prefix
5#   GENERATOR: explicitly specifies the CMake generator to use
6
7# By default, bmake will try to cd into ./obj before anything else. Don't do that.
8.OBJDIR: ./
9
10CMAKE?=cmake
11
12# Before anything else, test for CMake, which is the only requirement to be able to run
13# this Makefile CMake will perform the remaining dependency tests on its own.
14.BEGIN:
15	@which $(CMAKE) >/dev/null 2>/dev/null || \
16		(echo 'Please install CMake and then re-run the `make` command!' 1>&2 && false)
17
18# Prefer to use ninja, if it is installed
19_GENERATOR!=which ninja 2>/dev/null >/dev/null && echo Ninja || echo "Unix Makefiles"
20GENERATOR?=$(_GENERATOR)
21
22.if $(GENERATOR) == "Ninja"
23BUILDFILE=build.ninja
24.else
25BUILDFILE=Makefile
26.endif
27
28PREFIX?=/usr/local
29
30.PHONY: build/fish
31build/fish: build/$(BUILDFILE)
32	$(CMAKE) --build build
33
34# Don't split the mkdir into its own rule because that would cause CMake to regenerate the build
35# files after each build (because it adds the mdate of the build directory into the out-of-date
36# calculation tree). GNUmake supports order-only dependencies, BSDmake does not seem to.
37build/$(BUILDFILE):
38	mkdir -p build
39	cd build; $(CMAKE) .. -G "$(GENERATOR)" -DCMAKE_INSTALL_PREFIX="$(PREFIX)" -DCMAKE_EXPORT_COMPILE_COMMANDS=1
40
41.PHONY: install
42install: build/fish
43	$(CMAKE) --build build --target install
44
45.PHONY: clean
46clean:
47	rm -rf build
48
49.PHONY: test
50test: build/fish
51	$(CMAKE) --build build --target fish_run_tests
52
53.PHONY: fish_run_tests
54fish_run_tests: build/fish
55	$(CMAKE) --build build --target fish_run_tests
56
57.PHONY: run
58run: build/fish
59	build/fish