PUD: nmealib: rework Makefile
authorFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 7 Jun 2012 09:10:59 +0000 (11:10 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 7 Jun 2012 13:06:59 +0000 (15:06 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/pud/nmealib/Makefile

index bbe5d2d..13deada 100644 (file)
@@ -14,10 +14,10 @@ include Makefile.inc
 LIBNAME = libnmea.so
 
 DESTDIR ?=
+USRDIR ?= $(DESTDIR)/usr
+INCLUDEDIR ?= $(DESTDIR)/usr/include
+LIBDIR ?= $(USRDIR)/lib
 
-MACHINE=$(shell uname -m)
-LIBDIR_INSTALL = usr/lib
-INCLUDEDIR = usr/include
 
 MODULES = context generate generator gmath info parse parser sentence time tok util
 OBJ = $(MODULES:%=build/%.o)
@@ -65,22 +65,25 @@ clean:
 doc:
        $(MAKE) -C doc all
 
+doc-clean:
+       @$(MAKE) -C doc clean
+
 install: all
-       @mkdir -v -p "$(DESTDIR)/$(LIBDIR_INSTALL)"
-       cp "lib/$(LIBNAME)" "$(DESTDIR)/$(LIBDIR_INSTALL)/$(LIBNAME).$(VERSION)"
-       $(STRIP) "$(DESTDIR)/$(LIBDIR_INSTALL)/$(LIBNAME).$(VERSION)"
-       ldconfig -n "$(DESTDIR)/$(LIBDIR_INSTALL)"
+       @mkdir -v -p "$(LIBDIR)"
+       cp "lib/$(LIBNAME)" "$(LIBDIR)/$(LIBNAME).$(VERSION)"
+       $(STRIP) "$(LIBDIR)/$(LIBNAME).$(VERSION)"
+       ldconfig -n "$(LIBDIR)"
 
 install-headers: all
-       @mkdir -v -p "$(DESTDIR)/$(INCLUDEDIR)"
-       @rm -fr "$(DESTDIR)/$(INCLUDEDIR)/nmea"
-       cp -r include/nmea "$(DESTDIR)/$(INCLUDEDIR)"
+       @mkdir -v -p "$(INCLUDEDIR)"
+       @rm -fr "$(INCLUDEDIR)/nmea"
+       cp -r include/nmea "$(INCLUDEDIR)"
 
 uninstall:
-       rm -f "$(DESTDIR)/$(LIBDIR_INSTALL)/$(LIBNAME)" "$(DESTDIR)/$(LIBDIR_INSTALL)/$(LIBNAME).$(VERSION)"
-       ldconfig -n "$(DESTDIR)/$(LIBDIR_INSTALL)"
-       @rmdir -v -p --ignore-fail-on-non-empty "$(DESTDIR)/$(LIBDIR_INSTALL)"
+       rm -f "$(LIBDIR)/$(LIBNAME)" "$(LIBDIR)/$(LIBNAME).$(VERSION)"
+       ldconfig -n "$(LIBDIR)"
+       @rmdir -v -p --ignore-fail-on-non-empty "$(LIBDIR)"
 
 uninstall-headers:
-       rm -fr "$(DESTDIR)/$(INCLUDEDIR)/nmea"
-       @rmdir -v -p --ignore-fail-on-non-empty "$(DESTDIR)/$(INCLUDEDIR)"
+       rm -fr "$(INCLUDEDIR)/nmea"
+       @rmdir -v -p --ignore-fail-on-non-empty "$(INCLUDEDIR)"