2008-10-10 00:05:40 +02:00
|
|
|
CC?=gcc
|
|
|
|
CFLAGS?=
|
|
|
|
|
|
|
|
CFLAGS_DEBUG=
|
2008-02-07 01:58:41 +01:00
|
|
|
|
2008-11-02 15:18:16 +01:00
|
|
|
SONAME=libtermkey.so.0
|
|
|
|
|
2008-11-02 15:22:34 +01:00
|
|
|
PREFIX=/usr/local
|
|
|
|
LIBDIR=$(PREFIX)/lib
|
|
|
|
INCDIR=$(PREFIX)/include
|
2008-11-06 01:02:41 +01:00
|
|
|
MANDIR=$(PREFIX)/share/man
|
|
|
|
MAN3DIR=$(MANDIR)/man3
|
2008-11-02 15:22:34 +01:00
|
|
|
|
2008-10-07 00:24:54 +02:00
|
|
|
ifeq ($(DEBUG),1)
|
2008-10-10 00:05:40 +02:00
|
|
|
CFLAGS_DEBUG=-ggdb -DDEBUG
|
2008-10-07 00:24:54 +02:00
|
|
|
endif
|
|
|
|
|
2008-11-06 20:40:28 +01:00
|
|
|
all: demo demo-async doc
|
2008-02-07 01:58:41 +01:00
|
|
|
|
2008-11-02 15:18:16 +01:00
|
|
|
demo: libtermkey.so demo.c
|
|
|
|
$(CC) $(CFLAGS) $(CFLAGS_DEBUG) -o $@ $^
|
2008-11-06 20:33:07 +01:00
|
|
|
|
|
|
|
demo-async: libtermkey.so demo-async.c
|
|
|
|
$(CC) $(CFLAGS) $(CFLAGS_DEBUG) -o $@ $^
|
2008-11-02 15:18:16 +01:00
|
|
|
|
|
|
|
libtermkey.so: termkey.o driver-csi.o driver-ti.o
|
|
|
|
$(LD) -shared -soname=$(SONAME) -o $@ $^ -lncurses
|
2008-02-07 01:58:41 +01:00
|
|
|
|
2008-11-03 22:22:47 +01:00
|
|
|
%.o: %.c termkey.h termkey-internal.h
|
|
|
|
$(CC) $(CFLAGS) $(CFLAGS_DEBUG) -Wall -std=c99 -fPIC -o $@ -c $<
|
2008-02-07 01:58:41 +01:00
|
|
|
|
2008-11-06 20:40:28 +01:00
|
|
|
doc: termkey_waitkey.3 termkey_getkey.3
|
|
|
|
|
|
|
|
%.3: %.3.sh
|
|
|
|
sh $< >$@
|
|
|
|
|
2008-02-07 01:58:41 +01:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -f *.o demo
|
2008-11-02 15:22:34 +01:00
|
|
|
|
|
|
|
.PHONY: install
|
2008-11-06 01:02:41 +01:00
|
|
|
install: install-inc install-lib install-man
|
|
|
|
|
|
|
|
install-inc:
|
2008-11-02 15:22:34 +01:00
|
|
|
install -d $(DESTDIR)$(INCDIR)
|
|
|
|
install -m644 termkey.h $(DESTDIR)$(INCDIR)
|
2008-11-06 01:02:41 +01:00
|
|
|
install -d $(DESTDIR)$(LIBDIR)/pkgconfig
|
|
|
|
sed "s,@PREFIX@,$(PREFIX)," <termkey.pc.in >$(DESTDIR)$(LIBDIR)/pkgconfig/termkey.pc
|
|
|
|
|
|
|
|
install-lib:
|
2008-11-02 15:22:34 +01:00
|
|
|
install -d $(DESTDIR)$(LIBDIR)
|
|
|
|
install libtermkey.so $(DESTDIR)$(LIBDIR)/$(SONAME)
|
|
|
|
ln -sf $(SONAME) $(DESTDIR)$(LIBDIR)/libtermkey.so
|
2008-11-06 01:02:41 +01:00
|
|
|
|
|
|
|
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
|