aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: e12f695097b108994997b0b956b0a58862f5bc6d (plain)
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
# ========================
# =====    ===============
# ======  ================
# ======  ================
# ======  ====   ====   ==
# ======  ===     ==  =  =
# ======  ===  =  ==     =
# =  ===  ===  =  ==  ====
# =  ===  ===  =  ==  =  =
# ==     =====   ====   ==
# ========================
#
# go2work: Makefile
# Mon Apr  4 18:29:15 CEST 2022
# Joe
#
# GNU Makefile

default: build

SHELL		:= /bin/sh
OS			:= $(shell uname)

DESTDIR		:= /usr/local/
SRCS_DIR	:= src/
DATA_DIR	:= share/
MAN_DIR		:= man/

SRCS_NAME	:= c_defs
SRCS_NAME	+= c_go2work
SRCS_NAME	+= c_loop
SRCS_NAME	+= c_player
SRCS_NAME	+= p_options
SRCS_NAME	+= u_checks
SRCS_NAME	+= u_prints
SRCS_NAME	+= u_utils

SRCS		:= $(addprefix ${SRCS_DIR}, $(addsuffix .go, ${SRCS_NAME}))

TARGET		:= go2work
MAN			:= $(addsuffix .1, ${TARGET})

MKDIR		:= mkdir -p
RMDIR		:= rmdir
RM			:= rm -Rf
GZIP		:= gzip
GUNZIP		:= gunzip
INSTALL		:= install

deps:
	go get github.com/BurntSushi/toml@latest

build: ${TARGET}

${TARGET}: deps
	go build -o ${TARGET} ${SRCS}

install-bin: ${TARGET}
	${MKDIR} ${DESTDIR}bin
	${INSTALL} -m0555 ${TARGET} ${DESTDIR}bin

install-data:
	${MKDIR} ${DESTDIR}share/${TARGET}
	${INSTALL} -m0644 ${DATA_DIR}ring01.wav ${DESTDIR}share/${TARGET}
	${INSTALL} -m0644 ${DATA_DIR}ring02.wav ${DESTDIR}share/${TARGET}

install-doc:
	${MKDIR} ${DESTDIR}man/man1
	${GZIP} ${MAN_DIR}${MAN}
	${INSTALL} -m0444 ${MAN_DIR}${MAN}.gz ${DESTDIR}man/man1
	${GUNZIP} ${MAN_DIR}${MAN}

install: install-bin install-data install-doc

uninstall:
	${RM} ${DESTDIR}bin/${TARGET}
	${RM} ${DESTDIR}share/${TARGET}
	${RM} ${DESTDIR}man/man1/${MAN}.gz

clean:
	go clean
	${RM} ${TARGET}

.PHONY:	deps build install-bin install-data install-doc install uninstall clean

# File prefixes info
# ------------------
# c_  -> core program
# p_  -> parsing
# u_  -> utils