blob: 5a0863041bc5b223b89d9476f23b38c08066fdf0 (
plain)
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
|
CC?=gcc
CFLAGS?=
CFLAGS_DEBUG=
SONAME=libtermkey.so.0
PREFIX=/usr/local
LIBDIR=$(PREFIX)/lib
INCDIR=$(PREFIX)/include
MANDIR=$(PREFIX)/share/man
MAN3DIR=$(MANDIR)/man3
ifeq ($(DEBUG),1)
CFLAGS_DEBUG=-ggdb -DDEBUG
endif
all: demo demo-async doc
demo: libtermkey.so demo.c
$(CC) $(CFLAGS) $(CFLAGS_DEBUG) -o $@ $^
demo-async: libtermkey.so demo-async.c
$(CC) $(CFLAGS) $(CFLAGS_DEBUG) -o $@ $^
libtermkey.so: termkey.o driver-csi.o driver-ti.o
$(LD) -shared -soname=$(SONAME) -o $@ $^ -lncurses
%.o: %.c termkey.h termkey-internal.h
$(CC) $(CFLAGS) $(CFLAGS_DEBUG) -Wall -std=c99 -fPIC -o $@ -c $<
doc: termkey_waitkey.3 termkey_getkey.3
%.3: %.3.sh
sh $< >$@
.PHONY: clean
clean:
rm -f *.o demo
.PHONY: install
install: install-inc install-lib install-man
install-inc:
install -d $(DESTDIR)$(INCDIR)
install -m644 termkey.h $(DESTDIR)$(INCDIR)
install -d $(DESTDIR)$(LIBDIR)/pkgconfig
sed "s,@PREFIX@,$(PREFIX)," <termkey.pc.in >$(DESTDIR)$(LIBDIR)/pkgconfig/termkey.pc
install-lib:
install -d $(DESTDIR)$(LIBDIR)
install libtermkey.so $(DESTDIR)$(LIBDIR)/$(SONAME)
ln -sf $(SONAME) $(DESTDIR)$(LIBDIR)/libtermkey.so
install-man:
install -d $(DESTDIR)$(MAN3DIR)
for F in *.3; do \
gzip <$$F >$(DESTDIR)$(MAN3DIR)/$$F.gz; \
done
ln -sf termkey_new.3.gz $(DESTDIR)$(MAN3DIR)/termkey_free.3.gz
ln -sf termkey_getkey.3.gz $(DESTDIR)$(MAN3DIR)/termkey_getkey_force.3.gz
ln -sf termkey_setwaittime.3.gz $(DESTDIR)$(MAN3DIR)/termkey_getwaittime.3.gz
|