You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.4 KiB
Makefile

3 years ago
PREFIX := /usr/local
4 years ago
CC := gcc
CFLAGS := -O3 -Wall -Wextra
X11CFLAGS := $(shell pkg-config --cflags x11)
X11LIBS := $(shell pkg-config --libs x11)
all: dwmblocks sigdwmblocks/sigdwmblocks xgetrootname/xgetrootname
dwmblocks: dwmblocks.c config.h block.h
3 years ago
${CC} -o $@ -Wno-missing-field-initializers -Wno-unused-parameter ${CFLAGS} ${X11CFLAGS} $< ${X11LIBS}
E0BLOCKS = $(abspath blocks)
# two level escaping of '\', one for sed and one for C
E1BLOCKS = $(subst \,\\\\,${E0BLOCKS})
# escaping special character '&' and delimiter '=' for sed
E2BLOCKS = $(subst &,\&,${E1BLOCKS})
EFBLOCKS = $(subst =,\=,${E2BLOCKS})
config.h:
sed '2s=<path to the folder containing block scripts>=${EFBLOCKS}=' config.def.h >$@
3 years ago
sigdwmblocks/sigdwmblocks: sigdwmblocks/sigdwmblocks.c
${CC} -o $@ ${CFLAGS} $<
3 years ago
xgetrootname/xgetrootname: xgetrootname/xgetrootname.c
${CC} -o $@ ${CFLAGS} ${X11CFLAGS} $< ${X11LIBS}
clean:
rm -f dwmblocks sigdwmblocks/sigdwmblocks xgetrootname/xgetrootname
4 years ago
install: all
mkdir -p ${DESTDIR}${PREFIX}/bin
install -m 0755 dwmblocks ${DESTDIR}${PREFIX}/bin/dwmblocks
3 years ago
install -m 0755 sigdwmblocks/sigdwmblocks ${DESTDIR}${PREFIX}/bin/sigdwmblocks
install -m 0755 xgetrootname/xgetrootname ${DESTDIR}${PREFIX}/bin/xgetrootname
uninstall:
3 years ago
rm -f ${DESTDIR}${PREFIX}/bin/dwmblocks ${DESTDIR}${PREFIX}/bin/sigdwmblocks ${DESTDIR}${PREFIX}/bin/xgetrootname
4 years ago
.PHONY: all clean install uninstall