-
Notifications
You must be signed in to change notification settings - Fork 30
/
Makefile
65 lines (50 loc) · 1.92 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
# cower - a simple AUR downloader
OUT = cower
VERSION = $(shell git describe)
SRC = ${wildcard *.c}
OBJ = ${SRC:.c=.o}
DISTFILES = Makefile README.pod bash_completion zsh_completion config cower.c
PREFIX ?= /usr/local
MANPREFIX ?= ${PREFIX}/share/man
CPPFLAGS := -DCOWER_VERSION=\"${VERSION}\" ${CPPFLAGS}
CFLAGS := --std=c99 -g -pedantic -Wall -Wextra -Werror ${CPPFLAGS} ${CFLAGS}
LDFLAGS := -lcurl -lalpm -lyajl -larchive -pthread ${LDFLAGS}
all: ${OUT} doc
${OUT}: ${OBJ}
${CC} -o $@ ${OBJ} ${LDFLAGS}
doc: cower.1
cower.1: README.pod
pod2man --section=1 --center="Cower Manual" --name="COWER" --release="cower ${VERSION}" $< > $@
strip: ${OUT}
strip --strip-all ${OUT}
install: cower cower.1
install -D -m755 cower ${DESTDIR}${PREFIX}/bin/cower
install -D -m644 cower.1 ${DESTDIR}${MANPREFIX}/man1/cower.1
install -D -m644 bash_completion ${DESTDIR}/etc/bash_completion.d/cower
install -D -m644 zsh_completion ${DESTDIR}${PREFIX}/share/zsh/site-functions/_cower
install -D -m644 config ${DESTDIR}${PREFIX}/share/cower/config
uninstall:
@echo removing executable file from ${DESTDIR}${PREFIX}/bin
rm -f ${DESTDIR}${PREFIX}/bin/cower
@echo removing man page from ${DESTDIR}${PREFIX}/man1/cower.1
rm -f ${DESTDIR}/${PREFIX}/man1/cower.1
@echo removing bash completion
rm -f ${DESTDIR}/etc/bash_completion.d/cower
@echo removing zsh completion
rm -f ${DESTDIR}${PREFIX}/share/zsh/site-functions/_cower
@echo removing sample config
rm -f ${DESTDIR}${PREFIX}/share/cower/config
dist: clean
mkdir cower-${VERSION}
cp ${DISTFILES} cower-${VERSION}
sed "s/\(^VERSION *\)= .*/\1= ${VERSION}/" Makefile > cower-${VERSION}/Makefile
tar czf cower-${VERSION}.tar.gz cower-${VERSION}
rm -rf cower-${VERSION}
distcheck: clean dist cower
tar xf cower-${VERSION}.tar.gz
cd cower-${VERSION} && \
${MAKE}
rm -rf cower-${VERSION}
clean:
${RM} ${OUT} ${OBJ} cower.1
.PHONY: clean dist doc install uninstall