-
Notifications
You must be signed in to change notification settings - Fork 131
/
Makefile
59 lines (48 loc) · 1.67 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
#TTY-Clock MakeFile
#Under BSD License
#See clock.c for the license detail.
SRC = ttyclock.c ttyclock.h
CC ?= gcc
BIN ?= tty-clock
PREFIX ?= /usr/local
INSTALLPATH ?= ${DESTDIR}${PREFIX}/bin
MANPATH ?= ${DESTDIR}${PREFIX}/share/man/man1
ifeq ($(shell sh -c 'which ncurses6-config>/dev/null 2>/dev/null && echo y'), y)
CFLAGS += -Wall -g $$(ncurses6-config --cflags)
LDFLAGS += $$(ncurses6-config --libs)
else ifeq ($(shell sh -c 'which ncursesw6-config>/dev/null 2>/dev/null && echo y'), y)
CFLAGS += -Wall -g $$(ncursesw6-config --cflags)
LDFLAGS += $$(ncursesw6-config --libs)
else ifeq ($(shell sh -c 'which ncurses5-config>/dev/null 2>/dev/null && echo y'), y)
CFLAGS += -Wall -g $$(ncurses5-config --cflags)
LDFLAGS += $$(ncurses5-config --libs)
else ifeq ($(shell sh -c 'which ncursesw5-config>/dev/null 2>/dev/null && echo y'), y)
CFLAGS += -Wall -g $$(ncursesw5-config --cflags)
LDFLAGS += $$(ncursesw5-config --libs)
else
CFLAGS += -Wall -g $$(pkg-config --cflags ncurses)
LDFLAGS += $$(pkg-config --libs ncurses)
endif
tty-clock : ${SRC}
@echo "building ${SRC}"
${CC} ${CFLAGS} ${SRC} -o ${BIN} ${LDFLAGS}
install : ${BIN}
@echo "installing binary file to ${INSTALLPATH}/${BIN}"
@mkdir -p ${INSTALLPATH}
@cp ${BIN} ${INSTALLPATH}
@chmod 0755 ${INSTALLPATH}/${BIN}
@echo "installing manpage to ${MANPATH}/${BIN}.1"
@mkdir -p ${MANPATH}
@cp ${BIN}.1 ${MANPATH}
@chmod 0644 ${MANPATH}/${BIN}.1
@echo "installed"
uninstall :
@echo "uninstalling binary file (${INSTALLPATH})"
@rm -f ${INSTALLPATH}/${BIN}
@echo "uninstalling manpage (${MANPATH})"
@rm -f ${MANPATH}/${BIN}.1
@echo "${BIN} uninstalled"
clean :
@echo "cleaning ${BIN}"
@rm -f ${BIN}
@echo "${BIN} cleaned"