-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
71 lines (54 loc) · 2 KB
/
Makefile
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
62
63
64
65
66
67
68
69
70
71
# Copyright © 2017 Vasili Karaev
#
# This file is part of tvsm.
#
# tvsm is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# tvsm is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHENTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with tvsm. If not, see <http://www.gnu.org/licenses/>.
PROGNAME := tvsm
PREFIX := /usr
SCRIPTDIR := scripts
CONFIG := config
CONFIG_DESTDIR := ${DESTDIR}${PREFIX}/share/doc/${PROGNAME}
GUILEINC := ${DESTDIR}$(shell guile -c "(display (%site-dir))")
GUILELIB := ${DESTDIR}$(shell guile -c "(display (%site-ccache-dir))")
GUILEC := guild compile
SUBDIRS := $(shell find ${PROGNAME} -type d -print)
SRC := $(foreach subdir, ${SUBDIRS}, $(wildcard ${subdir}/*.scm))
OBJ := ${SRC:.scm=.go}
.SILENT: OBJ
export GUILE_AUTO_COMPILE = 0
export GUILE_LOAD_PATH = ${CURDIR}
OBJ: ${SRC}
$(foreach object, ${OBJ}, ${GUILEC} -o ${object} ${object:.go=.scm} 2>/dev/null;)
all:
${OBJ}
install:
@mkdir -p ${GUILEINC}
@echo installing source files in ${GUILEINC}/${PROGNAME}
@cp -p --parents ${SRC} ${GUILEINC}
@mkdir -p ${GUILELIB}
@echo installing object files in ${GUILELIB}/${PROGNAME}
@cp -p --parents ${OBJ} ${GUILELIB}
@mkdir -p ${DESTDIR}${PREFIX}/bin
@echo installing executable script in ${DESTDIR}${PREFIX}/bin
@cp -p ${SCRIPTDIR}/${PROGNAME} ${DESTDIR}${PREFIX}/bin/${PROGNAME}
@mkdir -p ${CONFIG_DESTDIR}
@echo installing default config in ${CONFIG_DESTDIR}
@cp -p ${CONFIG} ${CONFIG_DESTDIR}/${CONFIG}
uninstall:
@rm -rf ${GUILEINC}/${PROGNAME}
@rm -rf ${GUILELIB}/${PROGNAME}
@rm -f ${DESTDIR}${PREFIX}/bin/${PROGNAME}
@rm -rf ${CONFIG_DESTDIR}
clean:
@rm ${OBJ}