diff options
author | Sam Chudnick <sam@chudnick.com> | 2023-02-16 20:53:20 -0500 |
---|---|---|
committer | Sam Chudnick <sam@chudnick.com> | 2023-02-16 20:53:20 -0500 |
commit | 07109bb861018f4de7785c082262c1e0ff3fede0 (patch) | |
tree | d4e90ebfb6aa88006afb978658add050a9cdbdce /Makefile |
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f9a5d9e --- /dev/null +++ b/Makefile | |||
@@ -0,0 +1,69 @@ | |||
1 | .POSIX: | ||
2 | |||
3 | NAME = tabbed | ||
4 | VERSION = 0.7 | ||
5 | |||
6 | # paths | ||
7 | PREFIX = /usr/local | ||
8 | MANPREFIX = ${PREFIX}/share/man | ||
9 | DOCPREFIX = ${PREFIX}/share/doc/${NAME} | ||
10 | |||
11 | # use system flags. | ||
12 | TABBED_CFLAGS = -I/usr/X11R6/include -I/usr/include/freetype2 ${CFLAGS} | ||
13 | TABBED_LDFLAGS = -L/usr/X11R6/lib -lX11 -lfontconfig -lXft -lXrender ${LDFLAGS} | ||
14 | TABBED_CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE | ||
15 | |||
16 | # OpenBSD (uncomment) | ||
17 | #TABBED_CFLAGS = -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 ${CFLAGS} | ||
18 | |||
19 | SRC = tabbed.c xembed.c | ||
20 | OBJ = ${SRC:.c=.o} | ||
21 | BIN = ${OBJ:.o=} | ||
22 | MAN1 = ${BIN:=.1} | ||
23 | HDR = arg.h config.def.h | ||
24 | DOC = LICENSE README | ||
25 | |||
26 | all: ${BIN} | ||
27 | |||
28 | .c.o: | ||
29 | ${CC} -o $@ -c $< ${TABBED_CFLAGS} ${TABBED_CPPFLAGS} | ||
30 | |||
31 | ${OBJ}: config.h | ||
32 | |||
33 | config.h: | ||
34 | cp config.def.h $@ | ||
35 | |||
36 | .o: | ||
37 | ${CC} -o $@ $< ${TABBED_LDFLAGS} | ||
38 | |||
39 | clean: | ||
40 | rm -f ${BIN} ${OBJ} "${NAME}-${VERSION}.tar.gz" | ||
41 | |||
42 | dist: clean | ||
43 | mkdir -p "${NAME}-${VERSION}" | ||
44 | cp -fR Makefile ${MAN1} ${DOC} ${HDR} ${SRC} "${NAME}-${VERSION}" | ||
45 | tar -cf - "${NAME}-${VERSION}" | gzip -c > "${NAME}-${VERSION}.tar.gz" | ||
46 | rm -rf ${NAME}-${VERSION} | ||
47 | |||
48 | install: all | ||
49 | # installing executable files. | ||
50 | mkdir -p "${DESTDIR}${PREFIX}/bin" | ||
51 | cp -f ${BIN} "${DESTDIR}${PREFIX}/bin" | ||
52 | for f in ${BIN}; do chmod 755 "${DESTDIR}${PREFIX}/bin/$$f"; done | ||
53 | # installing doc files. | ||
54 | mkdir -p "${DESTDIR}${DOCPREFIX}" | ||
55 | cp -f README "${DESTDIR}${DOCPREFIX}" | ||
56 | # installing manual pages for general commands: section 1. | ||
57 | mkdir -p "${DESTDIR}${MANPREFIX}/man1" | ||
58 | for m in ${MAN1}; do sed "s/VERSION/${VERSION}/g" < $$m > "${DESTDIR}${MANPREFIX}/man1/$$m"; done | ||
59 | |||
60 | uninstall: | ||
61 | # removing executable files. | ||
62 | for f in ${BIN}; do rm -f "${DESTDIR}${PREFIX}/bin/$$f"; done | ||
63 | # removing doc files. | ||
64 | rm -f "${DESTDIR}${DOCPREFIX}/README" | ||
65 | # removing manual pages. | ||
66 | for m in ${MAN1}; do rm -f "${DESTDIR}${MANPREFIX}/man1/$$m"; done | ||
67 | -rmdir "${DESTDIR}${DOCPREFIX}" | ||
68 | |||
69 | .PHONY: all clean dist install uninstall | ||