2009-11-25 03:30:24 +01:00
|
|
|
LIBTOOL=libtool
|
|
|
|
|
2008-10-10 00:05:40 +02:00
|
|
|
CFLAGS?=
|
2011-09-24 01:04:01 +02:00
|
|
|
|
|
|
|
ifeq ($(shell pkg-config --atleast-version=0.1.0 unibilium && echo 1),1)
|
|
|
|
CFLAGS +=$(shell pkg-config --cflags unibilium) -DHAVE_UNIBILIUM
|
|
|
|
LDFLAGS+=$(shell pkg-config --libs unibilium)
|
|
|
|
else
|
|
|
|
LDFLAGS+=-lncurses
|
|
|
|
endif
|
2008-10-10 00:05:40 +02:00
|
|
|
|
|
|
|
CFLAGS_DEBUG=
|
2008-02-07 01:58:41 +01:00
|
|
|
|
2008-11-16 13:28:38 +01:00
|
|
|
VERSION_MAJOR=0
|
2011-11-30 18:53:38 +01:00
|
|
|
VERSION_MINOR=11
|
2008-11-16 13:28:38 +01:00
|
|
|
|
2011-11-30 18:53:38 +01:00
|
|
|
VERSION_CURRENT=6
|
2011-08-25 20:13:21 +02:00
|
|
|
VERSION_REVISION=0
|
2011-11-30 18:53:38 +01:00
|
|
|
VERSION_AGE=5
|
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
|
|
|
|
2009-11-25 03:30:24 +01:00
|
|
|
OBJECTS=termkey.lo driver-csi.lo driver-ti.lo
|
|
|
|
LIBRARY=libtermkey.la
|
|
|
|
|
|
|
|
%.lo: %.c termkey.h termkey-internal.h
|
2009-11-25 15:36:44 +01:00
|
|
|
$(LIBTOOL) --mode=compile --tag=CC gcc $(CFLAGS) $(CFLAGS_DEBUG) -Wall -std=c99 -o $@ -c $<
|
2008-11-06 20:33:07 +01:00
|
|
|
|
2009-11-25 03:30:24 +01:00
|
|
|
$(LIBRARY): $(OBJECTS)
|
2011-09-24 00:50:13 +02:00
|
|
|
$(LIBTOOL) --mode=link --tag=CC gcc -rpath $(LIBDIR) -version-info $(VERSION_CURRENT):$(VERSION_REVISION):$(VERSION_AGE) $(LDFLAGS) -o $@ $^
|
2008-11-02 15:18:16 +01:00
|
|
|
|
2009-11-25 03:30:24 +01:00
|
|
|
demo: $(LIBRARY) demo.lo
|
2009-11-25 15:36:44 +01:00
|
|
|
$(LIBTOOL) --mode=link --tag=CC gcc -o $@ $^
|
2008-02-07 01:58:41 +01:00
|
|
|
|
2009-11-25 03:30:24 +01:00
|
|
|
demo-async: $(LIBRARY) demo-async.lo
|
2009-11-25 15:36:44 +01:00
|
|
|
$(LIBTOOL) --mode=link --tag=CC gcc -o $@ $^
|
2008-02-07 01:58:41 +01:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2009-11-25 03:30:24 +01:00
|
|
|
$(LIBTOOL) --mode=clean rm -f $(OBJECTS) demo.lo demo-async.lo
|
|
|
|
$(LIBTOOL) --mode=clean rm -f $(LIBRARY)
|
|
|
|
$(LIBTOOL) --mode=clean rm -rf 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
|
2009-11-25 03:30:24 +01:00
|
|
|
$(LIBTOOL) --mode=finish $(DESTDIR)$(LIBDIR)
|
2008-11-06 01:02:41 +01:00
|
|
|
|
|
|
|
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
|
2011-07-01 18:04:12 +02:00
|
|
|
sed "s,@LIBDIR@,$(LIBDIR),;s,@INCDIR@,$(INCDIR)," <termkey.pc.in >$(DESTDIR)$(LIBDIR)/pkgconfig/termkey.pc
|
2008-11-06 01:02:41 +01:00
|
|
|
|
|
|
|
install-lib:
|
2008-11-02 15:22:34 +01:00
|
|
|
install -d $(DESTDIR)$(LIBDIR)
|
2009-11-25 03:30:24 +01:00
|
|
|
$(LIBTOOL) --mode=install cp libtermkey.la $(DESTDIR)$(LIBDIR)/libtermkey.la
|
2008-11-06 01:02:41 +01:00
|
|
|
|
|
|
|
install-man:
|
|
|
|
install -d $(DESTDIR)$(MAN3DIR)
|
2012-01-18 13:01:38 +01:00
|
|
|
for F in man/*.3; do \
|
|
|
|
gzip <$$F >$(DESTDIR)$(MAN3DIR)/$${F#man/}.gz; \
|
2008-11-06 01:02:41 +01:00
|
|
|
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
|
2011-08-28 18:47:11 +02:00
|
|
|
ln -sf termkey_set_flags.3.gz $(DESTDIR)$(MAN3DIR)/termkey_get_flags.3.gz
|
2011-08-28 18:50:18 +02:00
|
|
|
ln -sf termkey_set_canonflags.3.gz $(DESTDIR)$(MAN3DIR)/termkey_get_canonflags.3.gz
|
2008-11-18 16:37:37 +01:00
|
|
|
|
|
|
|
# DIST CUT
|
|
|
|
|
2012-01-18 13:01:38 +01:00
|
|
|
MANSOURCE=$(wildcard man/*.3.sh)
|
2008-11-18 16:37:37 +01:00
|
|
|
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 $< >$@
|
|
|
|
|
2011-03-31 13:11:19 +02:00
|
|
|
TESTSOURCES=$(wildcard t/[0-9]*.c)
|
2011-03-31 12:38:40 +02:00
|
|
|
TESTFILES=$(TESTSOURCES:.c=.t)
|
|
|
|
|
2011-03-31 13:11:19 +02:00
|
|
|
t/%.t: t/%.c $(LIBRARY) t/taplib.lo
|
2011-03-31 12:38:40 +02:00
|
|
|
$(LIBTOOL) --mode=link --tag=CC gcc -o $@ $^
|
|
|
|
|
2011-03-31 13:11:19 +02:00
|
|
|
t/taplib.lo: t/taplib.c
|
|
|
|
$(LIBTOOL) --mode=compile --tag=CC gcc $(CFLAGS) -o $@ -c $^
|
|
|
|
|
2011-03-31 12:38:40 +02:00
|
|
|
test: $(TESTFILES)
|
|
|
|
prove -e ""
|
|
|
|
|
2008-11-18 16:37:37 +01:00
|
|
|
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' \
|
|
|
|
$< >$@
|
|
|
|
|
2011-09-05 14:52:58 +02:00
|
|
|
DISTDIR=libtermkey-$(VERSION)
|
2008-11-18 16:37:37 +01:00
|
|
|
|
|
|
|
distdir: all
|
2009-07-15 21:52:35 +02:00
|
|
|
mkdir __distdir
|
2011-07-01 18:05:35 +02:00
|
|
|
cp *.c *.h *.3 LICENSE __distdir
|
2009-07-15 21:52:35 +02:00
|
|
|
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)
|
2012-01-18 14:39:50 +01:00
|
|
|
|
2012-01-18 15:11:05 +01:00
|
|
|
HTMLDIR=html
|
|
|
|
|
2012-01-18 14:39:50 +01:00
|
|
|
htmldocs:
|
2012-01-18 15:27:18 +01:00
|
|
|
perl $(HOME)/src/perl/Parse-Man/examples/man-to-html.pl -O $(HTMLDIR) --file-extension tmpl --link-extension html --template home_lou.tt2 --also man/also man/*.3
|