-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathMakefile
59 lines (45 loc) · 1.38 KB
/
Makefile
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
PROG = xmenu
OBJS = ${PROG:=.o} ctrlfnt.o
SRCS = ${OBJS:.o=.c}
MAN = ${PROG:=.1}
DOC = README.md
PREFIX ?= /usr/local
MANPREFIX ?= ${PREFIX}/share/man
LOCALINC = /usr/local/include
LOCALLIB = /usr/local/lib
X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib
DEFS = -D_POSIX_C_SOURCE=200809L -DGNU_SOURCE -D_BSD_SOURCE
INCS = -I${LOCALINC} -I${X11INC} -I/usr/include/freetype2 -I${X11INC}/freetype2
LIBS = -L${LOCALLIB} -L${X11LIB} -lfontconfig -lXft -lX11 -lXinerama -lXrender -lImlib2
bindir = ${DESTDIR}${PREFIX}/bin
mandir = ${DESTDIR}${MANPREFIX}/man1
all: ${PROG}
# update README.md with manual; you do not need to run this
${DOC}: ${MAN} ${DOC}
printf "/## Manual/\n\
;d\n\
a\n## Manual\n\n.\n\
r !mandoc -I os=UNIX -T ascii ${MAN} | col -b | expand -t 8 | sed -E 's,^.+,\t&,'\n\
w\n" | ed -s README.md
${PROG}: ${OBJS}
${CC} -o $@ ${OBJS} ${LIBS} ${LDFLAGS}
.c.o:
${CC} -std=c99 -pedantic ${DEFS} ${INCS} ${CFLAGS} ${CPPFLAGS} -o $@ -c $<
${OBJS}: ctrlfnt.h
tags: ${SRCS}
ctags ${SRCS}
lint: ${SRCS}
-mandoc -T lint -W warning ${MAN}
-clang-tidy ${SRCS} -- -std=c99 ${DEFS} ${INCS} ${CPPFLAGS}
clean:
rm -f ${OBJS} ${PROG} ${PROG:=.core} tags
install: all
mkdir -p ${bindir}
mkdir -p ${mandir}
install -m 755 ${PROG} ${bindir}/${PROG}
install -m 644 ${MAN} ${mandir}/${MAN}
uninstall:
-rm ${bindir}/${PROG}
-rm ${mandir}/${MAN}
.PHONY: all tags clean install uninstall lint