aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-03-12 19:47:30 +0000
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-03-12 19:47:30 +0000
commitd3e56776b7899bea5e8e93f8c39b9367dcb81ee3 (patch)
treebdb964e74f411c54054d73cdd3d2e9f214612c11
parent775806d32b73ebfe7abaec6e172de336431eca0d (diff)
downloadtermo-d3e56776b7899bea5e8e93f8c39b9367dcb81ee3.tar.gz
termo-d3e56776b7899bea5e8e93f8c39b9367dcb81ee3.tar.xz
termo-d3e56776b7899bea5e8e93f8c39b9367dcb81ee3.zip
Consistency updates to Makefile to make it more like libvterm's
-rw-r--r--Makefile42
1 files changed, 27 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index ffe130f..d4f2928 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,23 @@
-LIBTOOL=libtool
+ifeq ($(shell uname),Darwin)
+ LIBTOOL ?= glibtool
+else
+ LIBTOOL ?= libtool
+endif
+
+ifneq ($(VERBOSE),1)
+ LIBTOOL +=--quiet
+endif
+
+CFLAGS +=-Wall -std=c99
-CFLAGS?=
+ifeq ($(DEBUG),1)
+ CFLAGS +=-ggdb -DDEBUG
+endif
+
+ifeq ($(PROFILE),1)
+ CFLAGS +=-pg
+ LDFLAGS+=-pg
+endif
ifeq ($(shell pkg-config --atleast-version=0.1.0 unibilium && echo 1),1)
CFLAGS +=$(shell pkg-config --cflags unibilium) -DHAVE_UNIBILIUM
@@ -12,7 +29,8 @@ else
LDFLAGS+=-lncurses
endif
-CFLAGS_DEBUG=
+OBJECTS=termkey.lo driver-csi.lo driver-ti.lo
+LIBRARY=libtermkey.la
VERSION_MAJOR=0
VERSION_MINOR=13
@@ -28,17 +46,10 @@ MANDIR=$(PREFIX)/share/man
MAN3DIR=$(MANDIR)/man3
MAN7DIR=$(MANDIR)/man7
-ifeq ($(DEBUG),1)
- CFLAGS_DEBUG=-ggdb -DDEBUG
-endif
-
-all: termkey.h demo demo-async
-
-OBJECTS=termkey.lo driver-csi.lo driver-ti.lo
-LIBRARY=libtermkey.la
+all: $(LIBRARY) demo demo-async
%.lo: %.c termkey.h termkey-internal.h
- $(LIBTOOL) --mode=compile --tag=CC gcc $(CFLAGS) $(CFLAGS_DEBUG) -Wall -std=c99 -o $@ -c $<
+ $(LIBTOOL) --mode=compile --tag=CC gcc $(CFLAGS) -o $@ -c $<
$(LIBRARY): $(OBJECTS)
$(LIBTOOL) --mode=link --tag=CC gcc -rpath $(LIBDIR) -version-info $(VERSION_CURRENT):$(VERSION_REVISION):$(VERSION_AGE) $(LDFLAGS) -o $@ $^
@@ -59,15 +70,16 @@ clean:
install: install-inc install-lib install-man
$(LIBTOOL) --mode=finish $(DESTDIR)$(LIBDIR)
-install-inc:
+install-inc: termkey.h
install -d $(DESTDIR)$(INCDIR)
install -m644 termkey.h $(DESTDIR)$(INCDIR)
install -d $(DESTDIR)$(LIBDIR)/pkgconfig
sed "s,@LIBDIR@,$(LIBDIR),;s,@INCDIR@,$(INCDIR)," <termkey.pc.in >$(DESTDIR)$(LIBDIR)/pkgconfig/termkey.pc
-install-lib:
+# rm the old binary first in case it's still in use
+install-lib: $(LIBRARY)
install -d $(DESTDIR)$(LIBDIR)
- $(LIBTOOL) --mode=install cp libtermkey.la $(DESTDIR)$(LIBDIR)/libtermkey.la
+ $(LIBTOOL) --mode=install cp --remove-destination libtermkey.la $(DESTDIR)$(LIBDIR)/libtermkey.la
install-man:
install -d $(DESTDIR)$(MAN3DIR)