mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-27 20:25:12 +00:00
Switch BSDmakefile to invoke build via cmake
This will use the native BSD bmake build system instead of the previous hack which spawned an instance of `gmake` (GNU Make) if installed to perform the build.
This commit is contained in:
parent
ef728d3c1d
commit
fbed821a5b
1 changed files with 34 additions and 21 deletions
55
BSDmakefile
55
BSDmakefile
|
@ -1,25 +1,38 @@
|
||||||
JARG =
|
# by default bmake will cd into ./obj first
|
||||||
GMAKE = "gmake"
|
|
||||||
#When gmake is called from another make instance, -w is automatically added
|
|
||||||
#which causes extraneous messages about directory changes to be emitted.
|
|
||||||
#--no-print-directory silences these messages.
|
|
||||||
GARGS = "--no-print-directory"
|
|
||||||
|
|
||||||
.if "$(.MAKE.JOBS)" != ""
|
|
||||||
JARG = -j$(.MAKE.JOBS)
|
|
||||||
.endif
|
|
||||||
|
|
||||||
#by default bmake will cd into ./obj first
|
|
||||||
.OBJDIR: ./
|
.OBJDIR: ./
|
||||||
|
|
||||||
.PHONY: FRC
|
.BEGIN:
|
||||||
$(.TARGETS): FRC
|
# test for cmake, which is the only requirement to be able to run this Makefile
|
||||||
$(GMAKE) $(GARGS) $(.TARGETS:S,.DONE,,) $(JARG)
|
# cmake will perform the remaining dependency tests on its own
|
||||||
|
@which cmake >/dev/null 2>/dev/null || (echo "Please install cmake and then re-run the `make` command!" 1>&2 && false)
|
||||||
|
|
||||||
.DONE .DEFAULT: .SILENT
|
# Use ninja, if it is installed
|
||||||
$(GMAKE) $(GARGS) $(.TARGETS:S,.DONE,,) $(JARG)
|
_GENERATOR!=which ninja 2>/dev/null >/dev/null && echo Ninja || echo "'Unix Makefiles'"
|
||||||
|
GENERATOR?=$(_GENERATOR)
|
||||||
|
PREFIX?=/usr/local
|
||||||
|
|
||||||
.ERROR: .SILENT
|
.if $(GENERATOR) == "Ninja"
|
||||||
if ! which $(GMAKE) > /dev/null; then \
|
BUILDFILE=build/build.ninja
|
||||||
echo "GNU Make is required!"; \
|
BUILDCMD=ninja
|
||||||
fi
|
.else
|
||||||
|
BUILDFILE=build/Makefile
|
||||||
|
BUILDCMD=make
|
||||||
|
.endif
|
||||||
|
|
||||||
|
.DEFAULT: build/fish
|
||||||
|
build/fish: build/$(BUILDFILE)
|
||||||
|
cd build; $(BUILDCMD)
|
||||||
|
|
||||||
|
build:
|
||||||
|
mkdir -p build
|
||||||
|
|
||||||
|
build/$(BUILDFILE): build
|
||||||
|
cd build; cmake .. -G $(GENERATOR) -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DCMAKE_EXPORT_COMPILE_COMMANDS=1
|
||||||
|
|
||||||
|
.PHONY: install
|
||||||
|
install: build/fish
|
||||||
|
cd build; $(BUILDCMD) install
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -rf build
|
||||||
|
|
Loading…
Reference in a new issue