aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: d7a788eb238fe69b5a903648dc16a2566c214953 (plain) (blame)
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
PROG = cwm
OBJS = calmwm.o client.o conf.o group.o kbfunc.o menu.o parse.o \
	   reallocarray.o screen.o search.o strlcat.o strlcpy.o strtonum.o \
	   util.o xevents.o xmalloc.o xutil.o
LIBS = x11 xft xrandr

PREFIX ?= /usr/local
BINDIR ?= ${PREFIX}/bin
MANDIR ?= ${PREFIX}/share/man

PKG_CONFIG ?= pkg-config

CFLAGS   ?= -O2
CFLAGS   += -MMD -Wall -Wextra -Wno-unused-parameter
CPPFLAGS += -D_GNU_SOURCE $(shell ${PKG_CONFIG} --cflags ${LIBS})
LDLIBS   += $(shell ${PKG_CONFIG} --libs ${LIBS})

${PROG}: ${OBJS}
	${CC} -o $@ ${CFLAGS} ${OBJS} ${LDLIBS}

install:
	install -D -m 0755 -t '${DESTDIR}${BINDIR}' ${PROG}
	install -D -m 0644 -t '${DESTDIR}${MANDIR}/man1' ${PROG}.1
	install -D -m 0644 -t '${DESTDIR}${MANDIR}/man5' ${PROG}rc.5

clean:
	rm -f ${OBJS} ${OBJS:.o=.d} ${PROG}

.INTERMEDIATE: parse.c
.PHONY: clean install

-include ${OBJS:.o=.d}