This repository has been archived by the owner on Jan 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.mk
61 lines (50 loc) · 2.13 KB
/
install.mk
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
54
55
56
57
58
59
60
61
#
# SPDX-FileCopyrightText: 2019 Dmytro Kolomoiets <amerlyq@gmail.com> and contributors
#
# SPDX-License-Identifier: Apache-2.0
#
#%USAGE: $ make --file=./$0 pkgname=kirie check-reuse
#%DEBUG: $ make prefix=/tmp/_install install
#%DEPS(optional): |aur/reuse|
#%
.POSIX:
.DEFAULT_GOAL = help
MAKEFLAGS += -rR --silent
this := $(lastword $(MAKEFILE_LIST))
here := $(patsubst %/,%,$(dir $(realpath $(this))))
d_pj := $(patsubst %/,%,$(dir $(here)))
.PHONY: $(shell sed -rn 's/^([A-Za-z0-9-]+):(\s.*|$$)/\1/p' '$(this)')
# ALSO: move site scripts into kirie/_www and unrelated repo-specific site data into ./_www
ifname = $(if $(pkgname),$(1),$(error "required var 'pkgname' is empty -- impossible to continue"))
ifabbr = $(if $(pkgabbr),$(1),$(warning "optional var 'pkgabbr' is empty -- app alias won't be created"))
prefix := /usr/local
bindir := $(DESTDIR)$(prefix)/bin
libexecdir := $(DESTDIR)$(prefix)/libexec
datadir := $(DESTDIR)$(prefix)/share
dexe := $(libexecdir)/$(call ifname,$(pkgname))
# BUG: "install" omits suggested symlinks/aliases -- they must be installed separately
install:
install -d '$(bindir)' '$(libexecdir)' '$(datadir)'
'$(here)/suggest' ./ ./ -xtype f -exec install -vT -Dm755 -- '{}' '$(dexe)/{}' \;
'$(here)/suggest' ./ ./ -xtype d -type l -exec cp -vfdT -- '{}' '$(dexe)/{}' \;
ln -svrfPT '$(dexe)/kirie/kirie' '$(bindir)/$(pkgname)'
$(call ifabbr,ln -svfPT '$(pkgname)' '$(bindir)/$(pkgabbr)')
install -d '$(datadir)/zsh/site-functions'
install -vDm644 '$(here)/zsh-completion' '$(datadir)/zsh/site-functions/_$(pkgname)'
install -vDm644 LICENSE -t '$(datadir)/licenses/$(pkgname)'
install -vDm644 README.md -t '$(datadir)/doc/$(pkgname)'
dev-install:
install -d '$(libexecdir)'
ln -svfT '$(d_pj)' '$(dexe)'
ln -svfT '$(dexe)/kirie/kirie' '$(bindir)/$(pkgname)'
$(call ifabbr,ln -svfPT '$(pkgname)' '$(bindir)/$(pkgabbr)')
install -d '$(datadir)/zsh/site-functions'
ln -svfT '$(here)/zsh-completion' '$(datadir)/zsh/site-functions/_$(pkgname)'
dev-uninstall:
rm -v \
'$(bindir)/$(pkgname)' \
$(call ifabbr,'$(bindir)/$(pkgabbr)') \
'$(dexe)' \
'$(datadir)/zsh/site-functions/_$(pkgname)' \
check-reuse:
reuse lint