2018-03-10 17:25:18 +00:00
|
|
|
# by default bmake will cd into ./obj first
|
|
|
|
.OBJDIR: ./
|
|
|
|
|
|
|
|
.BEGIN:
|
|
|
|
# test for cmake, which is the only requirement to be able to run this Makefile
|
|
|
|
# cmake will perform the remaining dependency tests on its own
|
2018-07-01 01:23:23 +00:00
|
|
|
@which cmake >/dev/null 2>/dev/null || (echo 'Please install cmake and then re-run the `make` command!' 1>&2 && false)
|
2018-03-10 17:25:18 +00:00
|
|
|
|
|
|
|
# Use ninja, if it is installed
|
|
|
|
_GENERATOR!=which ninja 2>/dev/null >/dev/null && echo Ninja || echo "'Unix Makefiles'"
|
|
|
|
GENERATOR?=$(_GENERATOR)
|
|
|
|
PREFIX?=/usr/local
|
|
|
|
|
|
|
|
.if $(GENERATOR) == "Ninja"
|
|
|
|
BUILDFILE=build/build.ninja
|
|
|
|
.else
|
|
|
|
BUILDFILE=build/Makefile
|
2017-09-24 20:00:50 +00:00
|
|
|
.endif
|
2017-09-14 19:29:20 +00:00
|
|
|
|
2018-03-10 17:25:18 +00:00
|
|
|
.DEFAULT: build/fish
|
|
|
|
build/fish: build/$(BUILDFILE)
|
2018-03-10 17:37:50 +00:00
|
|
|
cmake --build build
|
2018-03-10 17:25:18 +00:00
|
|
|
|
|
|
|
build:
|
|
|
|
mkdir -p build
|
2017-09-24 20:00:50 +00:00
|
|
|
|
2018-03-10 17:25:18 +00:00
|
|
|
build/$(BUILDFILE): build
|
|
|
|
cd build; cmake .. -G $(GENERATOR) -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DCMAKE_EXPORT_COMPILE_COMMANDS=1
|
2017-10-12 17:45:10 +00:00
|
|
|
|
2018-03-10 17:25:18 +00:00
|
|
|
.PHONY: install
|
|
|
|
install: build/fish
|
2018-03-10 17:37:50 +00:00
|
|
|
cmake --build build --target install
|
2017-09-24 20:00:50 +00:00
|
|
|
|
2018-03-10 17:25:18 +00:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf build
|
2018-03-10 17:41:27 +00:00
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test: build/fish
|
|
|
|
cmake --build build --target test
|
|
|
|
|
|
|
|
.PHONY: run
|
|
|
|
run: build/fish
|
|
|
|
build/fish
|