-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (49 loc) · 1.57 KB
/
Makefile
File metadata and controls
64 lines (49 loc) · 1.57 KB
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
#
# makefile for tasknc
#
OUT = tasknc
#variables
CC ?= cc
CFLAGS ?= -Wall -g -Wextra -std=c99 -O2
LDFLAGS = ${CFLAGS}
LDLIBS ?= -lncursesw
VERSION = $(shell git describe)
PREFIX ?= /usr/local
MANPREFIX ?= ${PREFIX}/share/man
MANPAGE = $(OUT).1
SRCDIR = src
INCDIR = include
CFLAGS += -I $(INCDIR)
SRC = $(wildcard $(SRCDIR)/*.c)
OBJ = $(patsubst %.c,%.o,$(SRC))
#detect os and handle
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
ifeq ($(uname_O),Cygwin)
CFLAGS += -I /usr/include/ncurses
endif
uname_O := $(shell sh -c 'uname 2>/dev/null || echo not')
ifeq ($(uname_O),Darwin)
@echo ======> You seem to be building on MacOS. You will probably need to run 'brew install ncurses' or the like.
LDLIBS += -L/usr/local/opt/ncurses/lib/
endif
all: $(OUT) doc
doc: $(MANPAGE)
$(MANPAGE): doc/manual.pod
pod2man --errors=stderr --section=1 --center="tasknc Manual" --name="tasknc" --release="tasknc ${VERSION}" $< > $@
install: $(OUT) $(MANPAGE)
install -D -m755 tasknc ${DESTDIR}${PREFIX}/bin/$(OUT)
install -D -m644 tasknc.1 ${DESTDIR}${MANPREFIX}/man1/$(MANPAGE)
install -D -m644 config ${DESTDIR}${PREFIX}/share/tasknc/config
uninstall:
@echo removing executable file from ${DESTDIR}${PREFIX}/bin
rm -f ${DESTDIR}${PREFIX}/bin/$(OUT)
@echo removing man page from ${DESTDIR}${PREFIX}/man1/$(MANPAGE)
rm -f ${DESTDIR}/${PREFIX}/man1/$(MANPAGE)
$(OBJ): %.o: %.c
$(CC) -c $(CFLAGS) $< -o $@
$(OUT): $(OBJ)
$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
tags: $(SRC)
ctags $(SRC) $(wildcard $(INCDIR)/*.h)
clean:
rm $(OUT) $(MANPAGE) $(OBJ) tags || true