-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
134 lines (113 loc) · 3.02 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
.SUFFIXES: .c .o .dbg
PROG = xfiles
DEBUG_PROG = ${PROG:=_dbg}
OBJS = \
${PROG:=.o} \
widget.o util.o icons.o \
control/dragndrop.o \
control/selection.o \
control/font.o
DEBUG_OBJS = ${OBJS:.o=.dbg}
SRCS = ${OBJS:.o=.c}
MANS = \
xfiles.1 \
control/ctrldnd.3 \
control/ctrlfnt.3 \
control/ctrlsel.3
SCRIPTS = \
examples/xfilesctl \
examples/xfilesthumb
LINTS = \
${SRCS:=.lint} \
${MANS:=.lint} \
${SCRIPTS:=.lint}
WINICONS = \
icons/winicon16x16.abgr \
icons/winicon32x32.abgr \
icons/winicon48x48.abgr \
icons/winicon64x64.abgr
ICONS = \
icons/file-app.xpm \
icons/file-archive.xpm \
icons/file-audio.xpm \
icons/file-code.xpm \
icons/file-config.xpm \
icons/file-core.xpm \
icons/file-gear.xpm \
icons/file-image.xpm \
icons/file-info.xpm \
icons/file-object.xpm \
icons/file-text.xpm \
icons/file-video.xpm \
icons/file.xpm \
icons/folder-apps.xpm \
icons/folder-book.xpm \
icons/folder-code.xpm \
icons/folder-db.xpm \
icons/folder-download.xpm \
icons/folder-game.xpm \
icons/folder-gear.xpm \
icons/folder-home.xpm \
icons/folder-image.xpm \
icons/folder-link.xpm \
icons/folder-mail.xpm \
icons/folder-meme.xpm \
icons/folder-mount.xpm \
icons/folder-music.xpm \
icons/folder-trash.xpm \
icons/folder-up.xpm \
icons/folder-video.xpm \
icons/folder.xpm
PROG_CPPFLAGS = \
-D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE -D_DEFAULT_SOURCE \
-I. -I/usr/local/include -I/usr/X11R6/include \
-I/usr/include/freetype2 -I/usr/X11R6/include/freetype2 \
${CPPFLAGS}
PROG_CFLAGS = \
-std=c99 -pedantic \
${PROG_CPPFLAGS} \
${CFLAGS}
PROG_LDFLAGS = \
-L/usr/local/lib -L/usr/X11R6/lib \
-lfontconfig -lXft -lX11 -lXext -lXcursor -lXrender -lXpm -lpthread \
${LDFLAGS} ${LDLIBS}
DEBUG_FLAGS = \
-g -O0 -DDEBUG -Wall -Wextra -Wpedantic
# -fsanitize=address,undefined
all: ${PROG}
${PROG}: ${OBJS}
${CC} -o $@ ${OBJS} ${PROG_LDFLAGS}
.c.o:
${CC} ${PROG_CFLAGS} -o $@ -c $<
debug: ${DEBUG_PROG}
${DEBUG_PROG}: ${DEBUG_OBJS}
${CC} -o $@ ${DEBUG_OBJS} ${PROG_LDFLAGS} ${DEBUG_FLAGS}
.c.dbg:
${CC} ${PROG_CFLAGS} ${DEBUG_FLAGS} -o $@ -c $<
# Brace expansion in makefile targets is a {GNU,BSD} extension.
# Should we make this portable? (How?)
control/selection.{dbg,o}: control/selection.h
control/dragndrop.{dbg,o}: control/dragndrop.h control/selection.h
control/font.{dbg,o}: control/font.h
xfiles.{dbg,o}: util.h widget.h icons/file.xpm icons/folder.xpm
widget.{dbg,o}: util.h widget.h icons/x.xpm control/selection.h control/dragndrop.h control/font.h
icons.{dbg,o}: ${ICONS} ${WINICONS}
lint: ${LINTS}
${LINTS}: ${@:.lint=}
${SCRIPTS:=.lint}:
@echo LINTING ${@:.lint=}
@-shellcheck ${@:.lint=} | tee $@
${MANS:=.lint}:
@echo LINTING ${@:.lint=}
@-mandoc -T lint -W warning ${@:.lint=} | tee $@
${SRCS:=.lint}:
@echo LINTING ${@:.lint=}
@-clang-tidy ${@:.lint=} -- -std=c99 ${PROG_CPPFLAGS} | tee $@
tags: ${SRCS}
ctags ${SRCS}
clean:
rm -f ${OBJS} ${PROG} ${PROG:=.core}
distclean: clean
rm -f ${DEBUG_OBJS} ${DEBUG_PROG} ${DEBUG_PROG:=.core}
rm -f ${LINTS} tags
.PHONY: all debug lint clean distclean