-
Notifications
You must be signed in to change notification settings - Fork 1
/
GNUmakefile
38 lines (31 loc) · 1.07 KB
/
GNUmakefile
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
# -*- coding: utf-8; mode: Makefile; tab-width: 3 -*-
#
# Copyright 2024 Raffaello D. Di Napoli <[email protected]>
# Distributed under the terms of the GNU General Public License v3
.POSIX:
.SUFFIXES:
# Configuration ---------------------------------------------------------------
INSTALL?=install
DEFAULT_INSTALL_ROOT:=/usr/local
INSTALL_ROOT?=$(DEFAULT_INSTALL_ROOT)
# Ensure $(INSTALL_ROOT) ends with a backslash.
override INSTALL_ROOT:=$(INSTALL_ROOT:%/=%)/
# Project-specific rules ------------------------------------------------------
.PHONY: help
help:
@echo 'Example invocations:'
@echo
@echo 'make INSTALL_ROOT=$(DEFAULT_INSTALL_ROOT) install'
@echo ' Install scripts into INSTALL_ROOT, which defaults to'\
'$(DEFAULT_INSTALL_ROOT).'
ALL_SCRIPTS:=\
bin/kernel-config-required \
bin/kernel-gen \
bin/kernel-lsoot
.PHONY: install
define script_install_rule
install: $$(INSTALL_ROOT)usr/$(script_file)
$$(INSTALL_ROOT)usr/$(script_file): $(script_file)
$$(INSTALL) -T $$< $$@
endef
$(foreach script_file,$(ALL_SCRIPTS),$(eval $(call script_install_rule)))