mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
Preserve CMake options when make
is invoked
This commit is contained in:
parent
9ee5075fc3
commit
af157dea67
12
BSDmakefile
12
BSDmakefile
|
@ -20,20 +20,22 @@ _GENERATOR!=which ninja 2>/dev/null >/dev/null && echo Ninja || echo "Unix Makef
|
||||||
GENERATOR?=$(_GENERATOR)
|
GENERATOR?=$(_GENERATOR)
|
||||||
|
|
||||||
.if $(GENERATOR) == "Ninja"
|
.if $(GENERATOR) == "Ninja"
|
||||||
BUILDFILE=build/build.ninja
|
BUILDFILE=build.ninja
|
||||||
.else
|
.else
|
||||||
BUILDFILE=build/Makefile
|
BUILDFILE=Makefile
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
PREFIX?=/usr/local
|
PREFIX?=/usr/local
|
||||||
|
|
||||||
|
.PHONY: build/fish
|
||||||
build/fish: build/$(BUILDFILE)
|
build/fish: build/$(BUILDFILE)
|
||||||
$(CMAKE) --build build
|
$(CMAKE) --build build
|
||||||
|
|
||||||
build:
|
# Don't split the mkdir into its own rule because that would cause CMake to regenerate the build
|
||||||
|
# files after each build (because it adds the mdate of the build directory into the out-of-date
|
||||||
|
# calculation tree). GNUmake supports order-only dependencies, BSDmake does not seem to.
|
||||||
|
build/$(BUILDFILE):
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
|
|
||||||
build/$(BUILDFILE): build
|
|
||||||
cd build; $(CMAKE) .. -G "$(GENERATOR)" -DCMAKE_INSTALL_PREFIX="$(PREFIX)" -DCMAKE_EXPORT_COMPILE_COMMANDS=1
|
cd build; $(CMAKE) .. -G "$(GENERATOR)" -DCMAKE_INSTALL_PREFIX="$(PREFIX)" -DCMAKE_EXPORT_COMPILE_COMMANDS=1
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
|
|
|
@ -31,15 +31,18 @@ else
|
||||||
|
|
||||||
all: .begin build/fish
|
all: .begin build/fish
|
||||||
|
|
||||||
PHONY: .begin
|
.PHONY: .begin
|
||||||
.begin:
|
.begin:
|
||||||
@which $(CMAKE) > /dev/null 2> /dev/null || \
|
@which $(CMAKE) > /dev/null 2> /dev/null || \
|
||||||
(echo 'Please install CMake and then re-run the `make` command!' 1>&2 && false)
|
(echo 'Please install CMake and then re-run the `make` command!' 1>&2 && false)
|
||||||
|
|
||||||
|
.PHONY: build/fish
|
||||||
build/fish: build/$(BUILDFILE)
|
build/fish: build/$(BUILDFILE)
|
||||||
$(CMAKE) --build build
|
$(CMAKE) --build build
|
||||||
|
|
||||||
build/$(BUILDFILE): build
|
# Use build as an order-only dependency. This prevents the target from always being outdated
|
||||||
|
# after a make run, and more importantly, doesn't clobber manually specified CMake options.
|
||||||
|
build/$(BUILDFILE): | build
|
||||||
cd build; $(CMAKE) .. -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -G "$(GENERATOR)" \
|
cd build; $(CMAKE) .. -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -G "$(GENERATOR)" \
|
||||||
-DCMAKE_INSTALL_PREFIX="$(PREFIX)" -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
|
-DCMAKE_INSTALL_PREFIX="$(PREFIX)" -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
|
||||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
|
|
Loading…
Reference in New Issue
Block a user