[PATCH] Makefile: always include and link with DESTDIR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The top level Makefile adds, if the environment variable DESTDIR is
defined, the according include and link directory to CFLAGS and LDFLAGS
to build all userspace tools against dependencies from this repository
and not the system.
If CFLAGS or LDFLAGS are specified by the user, e.g.

    DESTDIR=~/destdir CFLAGS=-Dfoo LDFLAGS=-Lbar make install

use the override directive to force adding DESTDIR paths to the user
specified CFLAGS or LDFLAGS.

Note that

    DESTDIR=~/destdir make CFLAGS=-Dfoo LDFLAGS=-Lbar install

does not work, since in sub-directories the internal make options take
precedence over the overridden environment variables in the top
Makefile.

Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 2ffba8e9..e05e924b 100644
--- a/Makefile
+++ b/Makefile
@@ -29,8 +29,8 @@ ifneq ($(DESTDIR),)
 	LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
 	LIBSEPOLA ?= $(LIBDIR)/libsepol.a
 
-	CFLAGS += -I$(DESTDIR)$(PREFIX)/include
-	LDFLAGS += -L$(DESTDIR)$(PREFIX)/lib -L$(LIBDIR)
+	override CFLAGS += -I$(DESTDIR)$(PREFIX)/include
+	override LDFLAGS += -L$(DESTDIR)$(PREFIX)/lib -L$(LIBDIR)
 	export CFLAGS
 	export LDFLAGS
 	export LIBSEPOLA
-- 
2.36.1




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux