2021-03-06 06:45:32 +00:00
|
|
|
PREFIX = /usr/local
|
2020-07-06 20:28:41 +00:00
|
|
|
|
2021-03-06 06:45:32 +00:00
|
|
|
CC = gcc
|
|
|
|
CFLAGS = -O3 -Wall -Wextra
|
2020-08-22 14:56:30 +00:00
|
|
|
|
2021-03-06 06:45:32 +00:00
|
|
|
X11CFLAGS = $(shell pkg-config --cflags x11)
|
|
|
|
X11LIBS = $(shell pkg-config --libs x11)
|
2020-07-03 21:04:11 +00:00
|
|
|
|
2021-02-10 18:46:35 +00:00
|
|
|
all: dwmblocks sigdwmblocks/sigdwmblocks xgetrootname/xgetrootname
|
2020-07-03 21:04:11 +00:00
|
|
|
|
2021-04-22 12:57:19 +00:00
|
|
|
dwmblocks: dwmblocks.c config.h block.h
|
2020-12-23 18:26:34 +00:00
|
|
|
${CC} -o $@ -Wno-missing-field-initializers -Wno-unused-parameter ${CFLAGS} ${X11CFLAGS} $< ${X11LIBS}
|
2020-07-03 21:04:11 +00:00
|
|
|
|
2021-03-05 21:45:24 +00:00
|
|
|
E0BLOCKS = $(abspath blocks)
|
2021-03-07 17:56:16 +00:00
|
|
|
# two level escaping of `\', one for sed and one for C
|
2021-03-05 21:45:24 +00:00
|
|
|
E1BLOCKS = $(subst \,\\\\,${E0BLOCKS})
|
2021-03-07 17:56:16 +00:00
|
|
|
# escaping special character `&' and delimiter `=' for sed
|
2021-03-08 15:21:22 +00:00
|
|
|
E2BLOCKS = $(subst &,\&,${E1BLOCKS})
|
|
|
|
E3BLOCKS = $(subst =,\=,${E2BLOCKS})
|
2021-03-07 17:56:16 +00:00
|
|
|
# escaping `"' for C
|
2021-03-08 15:21:22 +00:00
|
|
|
E4BLOCKS = $(subst ",\\",${E3BLOCKS})
|
2021-03-07 17:56:16 +00:00
|
|
|
# escaping `'' for shell
|
|
|
|
EFBLOCKS = $(subst ','\'',${E4BLOCKS})
|
|
|
|
# this comment is a workaround for syntax highlighting bug in vim')
|
2021-03-05 21:45:24 +00:00
|
|
|
|
|
|
|
config.h:
|
2021-04-22 12:57:19 +00:00
|
|
|
[ -d blocks ] || cp -R blocks.def blocks
|
2021-03-05 21:45:24 +00:00
|
|
|
sed '2s=<path to the folder containing block scripts>=${EFBLOCKS}=' config.def.h >$@
|
|
|
|
|
2021-02-10 15:49:05 +00:00
|
|
|
sigdwmblocks/sigdwmblocks: sigdwmblocks/sigdwmblocks.c
|
2020-07-26 12:38:05 +00:00
|
|
|
${CC} -o $@ ${CFLAGS} $<
|
2020-07-03 21:04:11 +00:00
|
|
|
|
2021-02-10 15:49:05 +00:00
|
|
|
xgetrootname/xgetrootname: xgetrootname/xgetrootname.c
|
2020-08-22 14:56:30 +00:00
|
|
|
${CC} -o $@ ${CFLAGS} ${X11CFLAGS} $< ${X11LIBS}
|
2020-07-03 21:04:11 +00:00
|
|
|
|
|
|
|
clean:
|
2021-02-10 18:46:35 +00:00
|
|
|
rm -f dwmblocks sigdwmblocks/sigdwmblocks xgetrootname/xgetrootname
|
2020-07-03 21:04:11 +00:00
|
|
|
|
2021-03-08 16:42:22 +00:00
|
|
|
BINDIR = ${DESTDIR}${PREFIX}/bin
|
2021-06-21 12:26:36 +00:00
|
|
|
PIDDIR = /var/local/dwmblocks
|
2021-03-08 16:42:22 +00:00
|
|
|
|
2020-07-06 20:28:41 +00:00
|
|
|
install: all
|
2021-03-08 16:42:22 +00:00
|
|
|
mkdir -p ${BINDIR}
|
|
|
|
cp -f dwmblocks sigdwmblocks/sigdwmblocks xgetrootname/xgetrootname ${BINDIR}
|
|
|
|
chmod 755 ${BINDIR}/dwmblocks ${BINDIR}/sigdwmblocks ${BINDIR}/xgetrootname
|
2021-06-21 12:26:36 +00:00
|
|
|
mkdir -p ${PIDDIR}
|
|
|
|
chmod 777 ${PIDDIR}
|
2020-07-03 21:04:11 +00:00
|
|
|
|
|
|
|
uninstall:
|
2021-03-08 16:42:22 +00:00
|
|
|
rm -f ${BINDIR}/dwmblocks ${BINDIR}/sigdwmblocks ${BINDIR}/xgetrootname
|
2021-06-21 12:26:36 +00:00
|
|
|
rm -df ${PIDDIR} || exit 0
|
2020-07-03 21:04:11 +00:00
|
|
|
|
2020-07-06 20:28:41 +00:00
|
|
|
.PHONY: all clean install uninstall
|