-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
68 lines (55 loc) · 1.76 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
68
PREFIX = /usr/local
INSTALL = install
LN = ln -fs
ifeq ($(shell sh -c 'which gcc>/dev/null 2>/dev/null && echo y'), y)
CC = gcc
CFLAGS = -O2 -Wall
LDFLAGS = -s
endif
ifeq ($(shell sh -c 'uname'), Darwin)
CC = clang
CFLAGS = -O2 -Wall
LDFLAGS =
endif
ifeq ($(shell sh -c 'which ncurses5-config>/dev/null 2>/dev/null && echo y'), y)
DEFS =
CFLAGS += $(shell ncurses5-config --cflags)
LIBS = -lm $(shell ncurses5-config --libs)
else
ifeq ($(shell sh -c 'which ncursesw5-config>/dev/null 2>/dev/null && echo y'), y)
DEFS =
CFLAGS += $(shell ncursesw5-config --cflags)
LIBS = -lm $(shell ncursesw5-config --libs)
else
DEFS = -DNO_CURSES
LIBS = -lm
endif
endif
ifeq ($(shell sh -c 'which MagickWand-config>/dev/null 2>/dev/null && echo y'), y)
WANDCONFIG = MagickWand-config
else
WANDCONFIG = Wand-config
endif
CFLAGS := $(CFLAGS) $(shell $(WANDCONFIG) --cflags)
CPPFLAGS := $(CPPFLAGS) $(DEFS) $(shell $(WANDCONFIG) --cppflags)
LDFLAGS := $(LDFLAGS) $(shell $(WANDCONFIG) --ldflags)
LIBS := $(LIBS) $(shell $(WANDCONFIG) --libs)
all: img2xterm man6/img2xterm.6.gz
img2xterm: img2xterm.c
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $< $(LDFLAGS) $(LIBS)
.PHONY: all install clean
man6:
mkdir man6
man6/img2xterm.6.gz: man6/img2xterm.6 | man6
gzip -fc $< > $@
man6/img2xterm.6: img2xterm.c | man6 img2xterm
help2man -s 6 -N -m " " --version-string="git" ./img2xterm -o $@
install: img2xterm
$(INSTALL) -d $(PREFIX)/bin
$(INSTALL) -m 0755 img2xterm $(PREFIX)/bin/img2xterm
$(LN) $(PREFIX)/bin/img2xterm $(PREFIX)/bin/img2cow
$(INSTALL) -d $(PREFIX)/share/man/man6
$(INSTALL) -m 0644 man6/img2xterm.6.gz $(PREFIX)/share/man/man6/img2xterm.6.gz
$(LN) $(PREFIX)/share/man/man6/img2xterm.6.gz $(PREFIX)/share/man/man6/img2cow.6.gz
clean:
-$(RM) img2xterm man6/img2xterm.6.gz