-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (34 loc) · 1.03 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
SRC = cli-timer.c
CC ?= gcc
BIN = cli-timer
PREFIX ?= /usr/local
INSTALLPATH = ${DESTDIR}${PREFIX}/bin
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
cli-timer: ${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 "removing binary"
rm cli-timer
@echo "installed"
uninstall:
@echo "uninstalling binary file (${INSTALLPATH})"
@rm -f ${INSTALLPATH}/${BIN}
@echo "${BIN} uninstalled"
clean:
@echo "cleaning ${BIN}"
@rm -f ${BIN}
@echo "${BIN} cleaned"