fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
f43a79bc1
master
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 7CMAKE ?= cmake 8 9GENERATOR ?= $( shell (which ninja> /dev/null2 > /dev/null&& echo Ninja) || \ 10echo 'Unix Makefiles' ) 11prefix ?= /usr/local 12PREFIX ?= $( prefix ) 13 14ifeq ($( GENERATOR ) , Ninja) 15BUILDFILE = build.ninja 16else 17BUILDFILE = Makefile 18endif 19 20 21# If CMake has generated an in-tree Makefile, use that instead (issue #6264) 22MAKE_DIR :=$( shell dirname $( realpath $( firstword $( MAKEFILE_LIST ))) ) 23ifeq ($( shell test -f $( MAKE_DIR ) /Makefile&& echo 1), 1) 24 25all : 26@ + $( MAKE ) -f $( MAKE_DIR ) /Makefile$( MAKECMDGOALS ) --no-print-directory 27% : 28@ + $( MAKE ) -f $( MAKE_DIR ) /Makefile$( MAKECMDGOALS ) --no-print-directory 29 30else 31 32all : .begin build/fish 33 34.PHONY : .begin 35.begin : 36@ which $( CMAKE ) > /dev/null2 > /dev/null || \ 37 (echo 'Please install CMake and then re-run the `make` command!' 1 >&2&& false ) 38 39.PHONY : build/fish 40build/fish : build/$( BUILDFILE ) 41$( CMAKE ) --build build 42 43# Use build as an order-only dependency. This prevents the target from always being outdated 44# after a make run, and more importantly, doesn't clobber manually specified CMake options. 45build/$( BUILDFILE ): | build 46cd build;$( CMAKE ) ..-G " $( GENERATOR ) " \ 47-DCMAKE_INSTALL_PREFIX= " $( PREFIX ) " -DCMAKE_EXPORT_COMPILE_COMMANDS=1 48 49build : 50mkdir -p build 51 52.PHONY : clean 53clean : 54rm -rf build 55 56.PHONY : test 57test : build/fish 58$( CMAKE ) --build build--target fish_run_tests 59 60.PHONY : fish_run_tests 61fish_run_tests : build/fish 62$( CMAKE ) --build build--target fish_run_tests 63 64.PHONY : install 65install : build/fish 66$( CMAKE ) --build build--target install 67 68.PHONY : run 69run : build/fish 70./build/fish ||true 71 72.PHONY : exec 73exec : build/fish 74exec ./build/fish 75 76endif # CMake in-tree build check