PUD: wireformat: rework Makefile
authorFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 7 Jun 2012 09:11:08 +0000 (11:11 +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/wireformat/Makefile

index d3b1fd6..13e0c70 100644 (file)
@@ -12,17 +12,19 @@ include $(TOPDIR)/Makefile.inc
 #
 ######################
 
-MACHINE=$(shell uname -m)
-LIBDIR_INSTALL = usr/lib
+DESTDIR ?=
+USRDIR ?= $(DESTDIR)/usr
+INCLUDEDIR ?= $(DESTDIR)/usr/include
+LIBDIR ?= $(USRDIR)/lib
 
 BUILD_DIR = build
+LIBDIR_BUILD = lib
+
 
-INC_DIR_BASE_C = include
+INC_DIR_BASE_C = ./include
 INC_DIR_C = $(INC_DIR_BASE_C)/$(PROJECT)
 INC_DIR_OLSRD = ../../../src
 
-LIBDIR_BUILD = lib
-
 MODULES = nodeIdConversion wireFormat
 
 SRC_DIR_C = src
@@ -31,8 +33,6 @@ OBJECTS_C = $(MODULES:%=$(BUILD_DIR)/%.o)
 INCLUDES = -I "$(INC_DIR_BASE_C)" -I "$(INC_DIR_OLSRD)"
 LIBRARIES = -lm
 
-DESTDIR ?=
-INC_DIR_INSTALL = usr/$(INC_DIR_C)
 
 
 ifneq ($(OS),linux)
@@ -89,26 +89,26 @@ doc-clean:
        @$(MAKE) -C doc clean
 
 install: all
-       mkdir -v -p "$(DESTDIR)/$(LIBDIR_INSTALL)"
-       cp "$(LIBDIR_BUILD)/$(SONAME)" "$(DESTDIR)/$(LIBDIR_INSTALL)/$(SONAME).$(PLUGIN_VER)"
-       $(STRIP) "$(DESTDIR)/$(LIBDIR_INSTALL)/$(SONAME).$(PLUGIN_VER)"
-       ldconfig -n "$(DESTDIR)/$(LIBDIR_INSTALL)"
+       mkdir -v -p "$(LIBDIR)"
+       cp "$(LIBDIR_BUILD)/$(SONAME)" "$(LIBDIR)/$(SONAME).$(PLUGIN_VER)"
+       $(STRIP) "$(LIBDIR)/$(SONAME).$(PLUGIN_VER)"
+       ldconfig -n "$(LIBDIR)"
 
 install-headers:
-       rm -fr "$(DESTDIR)/$(INC_DIR_INSTALL)"
-       mkdir -v -p "$(DESTDIR)/$(INC_DIR_INSTALL)"
-       cp -t "$(DESTDIR)/$(INC_DIR_INSTALL)" $(INC_DIR_C)/*.h
+       rm -fr "$(INCLUDEDIR)/$(PROJECT)"
+       mkdir -v -p "$(INCLUDEDIR)/$(PROJECT)"
+       cp -t "$(INCLUDEDIR)/$(PROJECT)" $(INC_DIR_C)/*.h
 
 uninstall:
-       rm -f "$(DESTDIR)/$(LIBDIR_INSTALL)/$(SONAME)" \
-             "$(DESTDIR)/$(LIBDIR_INSTALL)/$(SONAME).$(PLUGIN_VER)"
-       ldconfig -n "$(DESTDIR)/$(LIBDIR_INSTALL)"
+       rm -f "$(LIBDIR)/$(SONAME)" \
+             "$(LIBDIR)/$(SONAME).$(PLUGIN_VER)"
+       ldconfig -n "$(LIBDIR)"
        rmdir -v -p --ignore-fail-on-non-empty \
-         "$(DESTDIR)/$(LIBDIR_INSTALL)"
+         "$(LIBDIR)"
 
 uninstall-headers:
-       rm -fr "$(DESTDIR)/$(INC_DIR_INSTALL)/"*.h
+       rm -fr "$(INCLUDEDIR)/$(PROJECT)/"*.h
        rmdir -v -p --ignore-fail-on-non-empty \
-         "$(DESTDIR)/$(INC_DIR_INSTALL)"
+         "$(INCLUDEDIR)/$(PROJECT)"
 
 endif