File: BSDmakefile

package info (click to toggle)
fish 3.1.2-3%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 38,672 kB
  • sloc: ansic: 80,259; cpp: 47,069; javascript: 17,087; sh: 6,163; python: 3,429; makefile: 669; perl: 367; objc: 78; xml: 18
file content (53 lines) | stat: -rw-r--r-- 1,323 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# This is a very basic `make` wrapper around the CMake build toolchain.
#
# Supported arguments:
#   PREFIX: sets the installation prefix
#   GENERATOR: explicitly specifies the CMake generator to use

# By default, bmake will try to cd into ./obj before anything else. Don't do that.
.OBJDIR: ./

CMAKE?=cmake

# Before anything else, 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.
.BEGIN:
	@which $(CMAKE) >/dev/null 2>/dev/null || \
		(echo 'Please install CMake and then re-run the `make` command!' 1>&2 && false)

# Prefer to use ninja, if it is installed
_GENERATOR!=which ninja 2>/dev/null >/dev/null && echo Ninja || echo "Unix Makefiles"
GENERATOR?=$(_GENERATOR)

.if $(GENERATOR) == "Ninja"
BUILDFILE=build/build.ninja
.else
BUILDFILE=build/Makefile
.endif

PREFIX?=/usr/local

build/fish: build/$(BUILDFILE)
	$(CMAKE) --build build

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
	$(CMAKE) --build build --target install

.PHONY: clean
clean:
	rm -rf build

.PHONY: test
test: build/fish
	$(CMAKE) --build build --target test

.PHONY: run
run: build/fish
	build/fish