blob: 0ea6a52789910fd07a8a9d8650e54e9fddf3fe43 [file] [log] [blame]
Subject: [PATCH] Support separation of SRCDIR and OBJDIR
Typical use of VPATH to locate the sources.
Upstream-Status: Pending
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Maxin B. John <maxin.john@intel.com>
---
diff -Naur iw-4.3-origin/Makefile iw-4.3/Makefile
--- iw-4.3-origin/Makefile 2015-11-20 16:37:58.752077287 +0200
+++ iw-4.3/Makefile 2015-11-20 16:57:15.510615815 +0200
@@ -1,5 +1,7 @@
MAKEFLAGS += --no-print-directory
-
+SRCDIR ?= $(dir $(lastword $(MAKEFILE_LIST)))
+OBJDIR ?= $(PWD)
+VPATH = $(SRCDIR)
PREFIX ?= /usr
SBINDIR ?= $(PREFIX)/sbin
MANDIR ?= $(PREFIX)/share/man
@@ -95,11 +97,11 @@
version.c: version.sh $(patsubst %.o,%.c,$(VERSION_OBJS)) nl80211.h iw.h Makefile \
$(wildcard .git/index .git/refs/tags)
@$(NQ) ' GEN ' $@
- $(Q)./version.sh $@
+ $(Q)cd $(SRCDIR) && ./version.sh $(OBJDIR)/$@
%.o: %.c iw.h nl80211.h
@$(NQ) ' CC ' $@
- $(Q)$(CC) $(CFLAGS) -c -o $@ $<
+ $(Q)$(CC) -I$(SRCDIR) $(CFLAGS) -c -o $@ $<
ifeq ($(IW_ANDROID_BUILD),)
iw: $(OBJS)