-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakefile
111 lines (83 loc) · 2.48 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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# basic makefile for installing/uninstall rustyrigs
PREFIX ?= /usr
RES_DIR ?= ${PREFIX}/share/rustyrigs
DOC_DIR ?= ${PREFIX}/share/doc
BIN_DIR ?= ${PREFIX}/bin
LIB_DIR ?= ${PREFIX}/lib/rustyrigs
NEED_PKG := libgtk3-perl libglib-perl libyaml-perl libhamlib-perl libexpect-perl baresip
DEV_NEED_PKG += devscripts dh-make-perl libperl-critic-community-perl libperl-critic-perl
# Documentation
DOCS := $(wildcard doc/*)
# Libraries (perl modules)
LIBS := $(wildcard lib/*.pm lib/RustyRigs/*.pm)
# Resources (icons, data files, etc)
RSRC := $(wildcard res/*)
# files to remove in 'make clean'
clean_files := $(wildcard *~ *.tmp *.out x y z)
SUDO := $(shell command -v sudo 2> /dev/null)
ifneq (root, $(shell whoami))
ifndef SUDO
$(warning sudo is not installed or not found in PATH)
#else
#$(info sudo found at $(SUDO))
endif
endif
bin := rustyrigs
##############################################################
all: world
world:
@echo "Nothing to build right now."
# This cleans up any temporary files/build artifacts, etc
clean:
${RM} ${clean_files}
###########
# Install #
###########
install: install-dirs install-lib install-bin install-docs install-res
uninstall: uninstall-bin uninstall-lib uninstall-res uninstall-docs
install-dirs:
${SUDO} install -d -m 0755 ${DOC_DIR}
${SUDO} install -d -m 0755 ${LIB_DIR}
${SUDO} install -d -m 0755 ${RES_DIR}
install-bin:
${SUDO} install -m 0755 ${bin} ${BIN_DIR}/${bin}
uninstall-bin:
${SUDO} ${RM} ${BIN_DIR}/rustyrigs
install-docs:
ifneq (${DOCS},)
${SUDO} install -m 0644 ${DOCS} ${DOC_DIR}
endif
uninstall-docs:
ifneq (${DOCS},)
${SUDO} ${RM} $(foreach x,${DOCS},${DOC_DIR}/${x})
endif
#install-res: $(addprefix ${RES_DIR}/, $(notdir ${RSRC})) $(addprefix ${RES_DIR}/, $(RSRC_DIRS))
install-res: $(addprefix ${RES_DIR}/,$(notdir ${RSRC}))
install-lib:
${SUDO} install -d -m 0755 ${LIB_DIR}
${SUDO} install -m 0644 ${LIBS} ${LIB_DIR}
uninstall-lib:
${SUDO} ${RM} ${LIB_DIR}
# ${SUDO} ${RM} $(foreach x,$(notdir ${LIBS}),${LIB_DIR}/${x})
${RES_DIR}/%: res/%
@${SUDO} install -m 0644 $< $@
${RES_DIR}/%/: res/%/
@${SUDO} install -d -m 0755 $<
uninstall-res:
ifneq (${RSRC},)
${SUDO} ${RM} $(foreach x,${RSRC},${RES_DIR}/${x})
endif
###############
# Maintenance #
###############
critic:
perlcritic rustyrigs $(shell find lib -name \*.pm)
lines:
cat $(shell find . -name \*.pm) rustyrigs | wc -l
################
# Debian stuff #
################
deb: install-deb-deps
dev-dev: install-deb-dev-deps
install-deb-deps:
${SUDO} apt install -y ${NEED_PKG}