Skip to contentSkip to conversation

iw: support and enable separate build dir

PATCH In review [email protected] 2 participants 5 messages Jun 1, 2016 – Jun 21, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iw: support and enable separate build dir

From: "Maxin B. John" <[email protected]>

Support separation of SRCDIR and OBJDIR

---
 Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Makefile +5 -3
index e61825e..1bc27c1 100644
@@ -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
@@ -96,11 +98,11 @@ VERSION_OBJS := $(filter-out version.o, $(OBJS))
 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)
Signature · 1 line
2.4.0
#1 lore raw
Quoted 4 lines · On Wed, 2016-06-01 at 11:40 +0300, [email protected] wrote:

From: "Maxin B. John" <[email protected]>

Support separation of SRCDIR and OBJDIR

Doesn't seem to work:

$ mkdir /tmp/obj
$ make clean
$ make OBJDIR=/tmp/obj
[...]
 GEN  version.c
 CC   version.o
cc: error: version.c: No such file or directory
cc: fatal error: no input files
compilation terminated.
Makefile:104: recipe for target 'version.o' failed
make: *** [version.o] Error 1
$ ls *.o
event.o  genl.o  ibss.o  info.o  interface.o  iw.o  mesh.o  mpath.o
mpp.o  ocb.o  phy.o  reg.o  scan.o  station.o  survey.o  util.o

(object files are in the wrong place too)

johannes

#2 lore raw

Hi Johannes,

Quoted 22 lines · Johannes Berg
Quoted 4 lines · On Wed, 2016-06-01 at 11:40 +0300, [email protected] wrote:

From: "Maxin B. John" <[email protected]>

Support separation of SRCDIR and OBJDIR

Doesn't seem to work:

$ mkdir /tmp/obj
$ make clean
$ make OBJDIR=/tmp/obj
[...]
 GEN  version.c
 CC   version.o
cc: error: version.c: No such file or directory
cc: fatal error: no input files
compilation terminated.
Makefile:104: recipe for target 'version.o' failed
make: *** [version.o] Error 1
$ ls *.o
event.o  genl.o  ibss.o  info.o  interface.o  iw.o  mesh.o  mpath.o
mpp.o  ocb.o  phy.o  reg.o  scan.o  station.o  survey.o  util.o
Quoted 1 line

(object files are in the wrong place too)

I was following the below listed steps to verify this patch:

# mkdir build
# cd build
#  make -f <path>/iw/Makefile
# ls *.o
bitrate.o  coalesce.o  connect.o  cqm.o  event.o  genl.o  ibss.o  info.o
interface.o  iw  iw.o  link.o  mesh.o  mpath.o  mpp.o  ocb.o  offch.o  p2p.o
phy.o  ps.o  reason.o  reg.o  roc.o  scan.o  sections.o  station.o  status.o
survey.o  util.o  vendor.o  version.c  version.o  wowlan.o
Quoted 1 line

johannes

Best Regards,
Maxin

#3 lore raw
Quoted 26 lines · Maxin B. John

Hi Johannes,

Quoted 22 lines · Johannes Berg
Quoted 4 lines · On Wed, 2016-06-01 at 11:40 +0300, [email protected] wrote:

From: "Maxin B. John" <[email protected]>

Support separation of SRCDIR and OBJDIR

Doesn't seem to work:

$ mkdir /tmp/obj
$ make clean
$ make OBJDIR=/tmp/obj
[...]
 GEN  version.c
 CC   version.o
cc: error: version.c: No such file or directory
cc: fatal error: no input files
compilation terminated.
Makefile:104: recipe for target 'version.o' failed
make: *** [version.o] Error 1
$ ls *.o
event.o  genl.o  ibss.o  info.o  interface.o  iw.o  mesh.o  mpath.o
mpp.o  ocb.o  phy.o  reg.o  scan.o  station.o  survey.o  util.o
Quoted 8 lines
Quoted 1 line

(object files are in the wrong place too)

I was following the below listed steps to verify this patch:

# mkdir build
# cd build
#  make -f <path>/iw/Makefile

Oh. Any chance you could make both work, since the "make O=..." is something kernel people are used to/familiar with?

johannes

#4 lore raw

Hi,

Quoted 31 lines · Johannes Berg
Quoted 30 lines · Maxin B. John

Hi Johannes,

Quoted 22 lines · Johannes Berg
Quoted 4 lines · On Wed, 2016-06-01 at 11:40 +0300, [email protected] wrote:

From: "Maxin B. John" <[email protected]>

Support separation of SRCDIR and OBJDIR

Doesn't seem to work:

$ mkdir /tmp/obj
$ make clean
$ make OBJDIR=/tmp/obj
[...]
 GEN  version.c
 CC   version.o
cc: error: version.c: No such file or directory
cc: fatal error: no input files
compilation terminated.
Makefile:104: recipe for target 'version.o' failed
make: *** [version.o] Error 1
$ ls *.o
event.o  genl.o  ibss.o  info.o  interface.o  iw.o  mesh.o  mpath.o
mpp.o  ocb.o  phy.o  reg.o  scan.o  station.o  survey.o  util.o
Quoted 1 line

(object files are in the wrong place too)

I was following the below listed steps to verify this patch:

Quoted 7 lines
Quoted 4 lines
# mkdir build
# cd build
#  make -f <path>/iw/Makefile

Oh. Any chance you could make both work, since the "make O=..." is something kernel people are used to/familiar with?

I will look into that. Thanks for the suggestion !

Quoted 1 line

johannes

Best Regards,
Maxin