-
Notifications
You must be signed in to change notification settings - Fork 53
/
Makefile
67 lines (48 loc) · 1.84 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
-include config.mk
VERSION = 0.6
CFLAGS_STD ?= -std=c99 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -DNDEBUG
CFLAGS_STD += -DVERSION=\"${VERSION}\"
LDFLAGS_STD ?= -lc -lutil
STRIP ?= strip
INSTALL ?= install
PREFIX ?= /usr/local
SHAREDIR ?= ${PREFIX}/share
SRC = abduco.c
all: abduco
config.h:
cp config.def.h config.h
config.mk:
@touch $@
abduco: config.h config.mk *.c
${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_AUTO} ${CFLAGS_EXTRA} ${SRC} ${LDFLAGS} ${LDFLAGS_STD} ${LDFLAGS_AUTO} -o $@
debug: clean
make CFLAGS_EXTRA='${CFLAGS_DEBUG}'
clean:
@echo cleaning
@rm -f abduco abduco-*.tar.gz
dist: clean
@echo creating dist tarball
@git archive --prefix=abduco-${VERSION}/ -o abduco-${VERSION}.tar.gz HEAD
installdirs:
@${INSTALL} -d ${DESTDIR}${PREFIX}/bin \
${DESTDIR}${MANPREFIX}/man1
install: abduco installdirs
@echo installing executable file to ${DESTDIR}${PREFIX}/bin
@${INSTALL} -m 0755 abduco ${DESTDIR}${PREFIX}/bin
@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
@mkdir -p ${DESTDIR}${MANPREFIX}/man1
@sed "s/VERSION/${VERSION}/g" < abduco.1 > ${DESTDIR}${MANPREFIX}/man1/abduco.1
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/abduco.1
install-strip: install
${STRIP} ${DESTDIR}${PREFIX}/bin/abduco
install-completion:
@echo installing zsh completion file to ${DESTDIR}${SHAREDIR}/zsh/site-functions
@install -Dm644 contrib/abduco.zsh ${DESTDIR}${SHAREDIR}/zsh/site-functions/_abduco
uninstall:
@echo removing executable file from ${DESTDIR}${PREFIX}/bin
@rm -f ${DESTDIR}${PREFIX}/bin/abduco
@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
@rm -f ${DESTDIR}${MANPREFIX}/man1/abduco.1
@echo removing zsh completion file from ${DESTDIR}${SHAREDIR}/zsh/site-functions
@rm -f ${DESTDIR}${SHAREDIR}/zsh/site-functions/_abduco
.PHONY: all clean dist install installdirs install-strip install-completion uninstall debug