2016-07-14 21:10:51 +02:00
|
|
|
#! /usr/bin/make -f
|
2016-11-05 22:00:23 +01:00
|
|
|
|
2019-02-21 20:58:38 +01:00
|
|
|
builds := $(wildcard build*)
|
2018-04-19 13:24:26 +02:00
|
|
|
|
2019-02-21 20:58:38 +01:00
|
|
|
ifeq "$(builds)" ""
|
|
|
|
nobuild:
|
|
|
|
@ echo "error: you don't seem to have any build directory (build*)" >&2
|
|
|
|
@ echo "" >&2
|
|
|
|
@ echo "You can configure one like this:" >&2
|
|
|
|
@ echo " mkdir build && cd build && ../configure [options...]" >&2
|
|
|
|
@ echo "" >&2
|
|
|
|
@ false
|
|
|
|
endif
|
2016-11-05 22:00:23 +01:00
|
|
|
|
2018-04-09 08:31:12 +02:00
|
|
|
#
|
2019-02-21 20:58:38 +01:00
|
|
|
# all targets
|
2018-04-09 08:31:12 +02:00
|
|
|
#
|
2016-11-05 22:00:23 +01:00
|
|
|
|
2019-02-21 20:58:38 +01:00
|
|
|
all-targets := $(foreach b,$(builds),all-$b)
|
2016-07-14 21:10:51 +02:00
|
|
|
|
2019-02-21 20:58:38 +01:00
|
|
|
all: $(all-targets)
|
2016-07-14 21:10:51 +02:00
|
|
|
|
2019-02-21 20:58:38 +01:00
|
|
|
all-build%: build%
|
2020-05-10 14:03:41 +02:00
|
|
|
@ echo -e "$B::$W Making into $<$N"
|
2019-02-21 20:58:38 +01:00
|
|
|
@ $(MAKE) --no-print-directory -C $<
|
2018-04-19 13:24:26 +02:00
|
|
|
|
2018-04-09 08:31:12 +02:00
|
|
|
#
|
2019-02-21 20:58:38 +01:00
|
|
|
# install targets
|
2018-04-09 08:31:12 +02:00
|
|
|
#
|
2016-07-14 21:10:51 +02:00
|
|
|
|
2019-02-21 20:58:38 +01:00
|
|
|
install-targets := $(foreach b,$(builds),install-$b)
|
2016-07-14 21:10:51 +02:00
|
|
|
|
2019-02-21 20:58:38 +01:00
|
|
|
install: $(install-targets)
|
2018-04-19 13:24:26 +02:00
|
|
|
|
2019-02-21 20:58:38 +01:00
|
|
|
install-build%: build%
|
2020-05-10 14:03:41 +02:00
|
|
|
@ echo -e "$B::$W Installing from $<$N"
|
2019-02-21 20:58:38 +01:00
|
|
|
@ $(MAKE) --no-print-directory -C $< install
|
2018-04-19 13:24:26 +02:00
|
|
|
|
2018-04-09 08:31:12 +02:00
|
|
|
#
|
2019-02-21 20:58:38 +01:00
|
|
|
# uninstall targets
|
2018-04-09 08:31:12 +02:00
|
|
|
#
|
2016-07-14 21:10:51 +02:00
|
|
|
|
2019-02-21 20:58:38 +01:00
|
|
|
uninstall-targets := $(foreach b,$(builds),uninstall-$b)
|
2016-07-14 21:10:51 +02:00
|
|
|
|
2019-02-21 20:58:38 +01:00
|
|
|
uninstall: $(uninstall-targets)
|
2016-07-14 21:10:51 +02:00
|
|
|
|
2019-02-21 20:58:38 +01:00
|
|
|
uninstall-build%: build%
|
2020-05-10 14:03:41 +02:00
|
|
|
@ echo -e "$B::$W Uninstalling from $<$N"
|
2019-02-21 20:58:38 +01:00
|
|
|
@ $(MAKE) --no-print-directory -C $< uninstall
|
2018-04-19 13:24:26 +02:00
|
|
|
|
2018-04-09 08:31:12 +02:00
|
|
|
#
|
2019-02-21 20:58:38 +01:00
|
|
|
# Coloring tools
|
2018-04-09 08:31:12 +02:00
|
|
|
#
|
2016-07-14 21:10:51 +02:00
|
|
|
|
2019-02-21 20:58:38 +01:00
|
|
|
B = \e[34;1m
|
|
|
|
W = \e[39;1m
|
|
|
|
N = \e[0m
|
2018-04-09 08:31:12 +02:00
|
|
|
|
2019-02-21 20:58:38 +01:00
|
|
|
.PHONY: nobuild all all-build% install install-build%
|