blob: 7310bd9b7ba84351916b14e77b9523d6c45b695b (
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
|
# Inspired from
# `info make`
# MIT https://git.suckless.org/dwm
# GPL-2.0-or-later https://git.joeyh.name/index.cgi/moreutils.git/tree/Makefile
# For a comment inside a Makefile recipe not to echo itself on terminal, put # at very first character
# For a command not to echo itself, prefix @ to the command
# https://unix.stackexchange.com/a/740226/459013
SH = alarm backlight bell ccgp cfg chmodef curlqb dateft dirnameall gita gitfork gitmetap gitmetar gitpu grrc il lastarg loop lsp mll mmi mpra mpva mpvy mvln mvtr mvtu news o orgext pa pq px qg qw rate reco rfp sbar ta time-uuid topa upd vinfo wh wtr xmq prp vip vpn dnd cgm ggm ccp u
PACMAN_HOOKS = setcap-intel_gpu_top.hook setcap-iotop-c.hook setcap-nethogs.hook
PREFIX = /usr/local
all: dynotify
dynotify: dynotify.c
# https://stackoverflow.com/q/28533059
# https://stackoverflow.com/q/3220277
cc -Wall $$(pkg-config --cflags --libs libnotify libcurl json-c) -o $@ $<
clean:
rm -f dynotify
# I think `install: all` makes make all first, since all is `all: dynotify`, it will make dynotify first, then install all
install: all
mkdir -p ${DESTDIR}${PREFIX}/bin
# Another way would be define and use INSTALL INSTALL_PROGRAM INSTALL_DATA instead of use `cp -f` or `install` directly, see `info make`
for i in ${SH}; do cp -f sh/$$i ${DESTDIR}${PREFIX}/bin; done
mkdir -p ${DESTDIR}${PREFIX}/share/libalpm/hooks
# /usr/local/share/libalpm/hooks default does not work, need to change pacman.conf
for i in ${PACMAN_HOOKS}; do cp -f pacman_hooks/$$i ${DESTDIR}${PREFIX}/share/libalpm/hooks; done
cp -f dynotify ${DESTDIR}${PREFIX}/bin
uninstall:
for i in ${SH}; do rm -f ${DESTDIR}${PREFIX}/bin/$$i; done
for i in ${PACMAN_HOOKS}; do rm -f ${DESTDIR}${PREFIX}/share/libalpm/hooks/$$i; done
# RM is default to `rm -f`, see `info make`
# for i in ${SH}; do ${RM} ${DESTDIR}${PREFIX}/bin/$$i; done
rm -f ${DESTDIR}${PREFIX}/bin/dynotify
.PHONY: all clean install uninstall
|