1
0
mirror of https://github.com/Zygo/bees.git synced 2025-05-17 21:35:45 +02:00
bees/Makefile
Kai Krakow 451f0ad9aa Makefile: Allow installation of fiemap/fiewalk support tools
There's now a new make target called "install_tools" which would not run
by default on installation.

One can add "OPTIONAL_INSTALL_TARGETS=install_tools" into localconf to
install these by default.

fiewalk would be installed to sbin, as only root can run it, the other
goes to bin.

Gentoo can use this to optionally install these tools as a package
feature.

Signed-off-by: Kai Krakow <kai@kaishome.de>
2018-09-08 02:20:59 +02:00

75 lines
2.0 KiB
Makefile

PREFIX ?= /
LIBDIR ?= lib
USR_PREFIX ?= $(PREFIX)/usr
USRLIB_PREFIX ?= $(USR_PREFIX)/$(LIBDIR)
SYSTEMD_LIB_PREFIX ?= $(PREFIX)/lib/systemd
LIBEXEC_PREFIX ?= $(USRLIB_PREFIX)/bees
MARKDOWN := $(firstword $(shell which markdown markdown2 markdown_py 2>/dev/null || echo markdown))
# allow local configuration to override above variables
-include localconf
DEFAULT_MAKE_TARGET ?= reallyall
ifeq ($(DEFAULT_MAKE_TARGET),reallyall)
RUN_INSTALL_TESTS = test
endif
default: $(DEFAULT_MAKE_TARGET)
all: lib src scripts README.html
reallyall: all test
clean: ## Cleanup
git clean -dfx -e localconf
.PHONY: lib src test
lib: ## Build libs
$(MAKE) -C lib
src: ## Build bins
src: lib
$(MAKE) -C src
test: ## Run tests
test: lib src
$(MAKE) -C test
scripts/%: scripts/%.in
sed -e's#@LIBEXEC_PREFIX@#$(LIBEXEC_PREFIX)#' -e's#@PREFIX@#$(PREFIX)#' $< >$@
scripts: scripts/beesd scripts/beesd@.service
README.html: README.md
$(MARKDOWN) README.md > README.html.new
mv -f README.html.new README.html
install_libs: lib
install -Dm644 lib/libcrucible.so $(DESTDIR)$(USRLIB_PREFIX)/libcrucible.so
install_tools: ## Install support tools + libs
install_tools: install_libs src
install -Dm755 bin/fiemap $(DESTDIR)$(USR_PREFIX)/bin/fiemap
install -Dm755 bin/fiewalk $(DESTDIR)$(USR_PREFIX)/sbin/fiewalk
install_bees: ## Install bees + libs
install_bees: install_libs src $(RUN_INSTALL_TESTS)
install -Dm755 bin/bees $(DESTDIR)$(LIBEXEC_PREFIX)/bees
install_scripts: ## Install scipts
install_scripts: scripts
install -Dm755 scripts/beesd $(DESTDIR)$(USR_PREFIX)/sbin/beesd
install -Dm644 scripts/beesd.conf.sample $(DESTDIR)$(PREFIX)/etc/bees/beesd.conf.sample
install -Dm644 scripts/beesd@.service $(DESTDIR)$(SYSTEMD_LIB_PREFIX)/system/beesd@.service
install: ## Install distribution
install: install_bees install_scripts $(OPTIONAL_INSTALL_TARGETS)
help: ## Show help
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/\t/'
bees: all
fly: install