2008-10-10 00:05:40 +02:00
|
|
|
CC?=gcc
|
|
|
|
CFLAGS?=
|
|
|
|
|
|
|
|
CFLAGS_DEBUG=
|
2008-02-07 01:58:41 +01:00
|
|
|
|
2008-11-16 13:28:38 +01:00
|
|
|
VERSION_MAJOR=0
|
2009-07-15 21:40:44 +02:00
|
|
|
VERSION_MINOR=3
|
2008-11-16 13:28:38 +01:00
|
|
|
|
|
|
|
SONAME=libtermkey.so.$(VERSION_MAJOR)
|
2008-11-02 15:18:16 +01:00
|
|
|
|
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-18 16:37:37 +01:00
|
|
|
all: termkey.h demo demo-async
|
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
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2008-11-18 17:24:28 +01:00
|
|
|
rm -f *.o libtermkey.so demo demo-async
|
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)
|
2008-11-18 16:57:59 +01:00
|
|
|
install libtermkey.so $(DESTDIR)$(LIBDIR)/$(SONAME).$(VERSION_MINOR)
|
|
|
|
ln -sf $(SONAME).$(VERSION_MINOR) $(DESTDIR)$(LIBDIR)/$(SONAME)
|
2008-11-02 15:22:34 +01:00
|
|
|
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
|
2008-11-06 20:50:53 +01:00
|
|
|
ln -sf termkey_new.3.gz $(DESTDIR)$(MAN3DIR)/termkey_destroy.3.gz
|
2008-11-06 01:02:41 +01:00
|
|
|
ln -sf termkey_getkey.3.gz $(DESTDIR)$(MAN3DIR)/termkey_getkey_force.3.gz
|
2008-11-06 21:29:50 +01:00
|
|
|
ln -sf termkey_set_waittime.3.gz $(DESTDIR)$(MAN3DIR)/termkey_get_waittime.3.gz
|
2008-11-18 16:37:37 +01:00
|
|
|
|
|
|
|
# DIST CUT
|
|
|
|
|
|
|
|
MANSOURCE=$(wildcard *.3.sh)
|
|
|
|
BUILTMAN=$(MANSOURCE:.3.sh=.3)
|
|
|
|
|
2008-12-15 21:49:59 +01:00
|
|
|
VERSION=$(VERSION_MAJOR).$(VERSION_MINOR)
|
|
|
|
|
2008-11-18 16:37:37 +01:00
|
|
|
all: doc
|
|
|
|
|
|
|
|
doc: $(BUILTMAN)
|
|
|
|
|
|
|
|
%.3: %.3.sh
|
|
|
|
sh $< >$@
|
|
|
|
|
|
|
|
clean: clean-built
|
|
|
|
|
|
|
|
clean-built:
|
|
|
|
rm -f $(BUILTMAN) termkey.h
|
|
|
|
|
|
|
|
termkey.h: termkey.h.in Makefile
|
|
|
|
sed -e 's/@@VERSION_MAJOR@@/$(VERSION_MAJOR)/g' \
|
|
|
|
-e 's/@@VERSION_MINOR@@/$(VERSION_MINOR)/g' \
|
|
|
|
$< >$@
|
|
|
|
|
|
|
|
DISTDIR=libtermkey-$(VERSION_MAJOR).$(VERSION_MINOR)
|
|
|
|
|
|
|
|
distdir: all
|
2009-07-15 21:52:35 +02:00
|
|
|
mkdir __distdir
|
|
|
|
cp *.c *.h *.3 __distdir
|
|
|
|
sed "s,@VERSION@,$(VERSION)," <termkey.pc.in >__distdir/termkey.pc.in
|
|
|
|
sed "/^# DIST CUT/Q" <Makefile >__distdir/Makefile
|
|
|
|
mv __distdir $(DISTDIR)
|
2008-11-18 16:46:29 +01:00
|
|
|
|
2008-11-24 22:47:18 +01:00
|
|
|
TARBALL=$(DISTDIR).tar.gz
|
2008-11-18 16:46:29 +01:00
|
|
|
|
|
|
|
dist: distdir
|
2008-11-24 22:47:18 +01:00
|
|
|
tar -czf $(TARBALL) $(DISTDIR)
|
2008-11-18 16:46:29 +01:00
|
|
|
rm -rf $(DISTDIR)
|