From: "Maxin B. John" <[email protected]>
Support separation of SRCDIR and OBJDIR
Signed-off-by: Christopher Larson <[email protected]>
Signed-off-by: Maxin B. John <[email protected]>
---
Makefile | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index e61825e..1bc27c1 100644
--- a/Makefile
+++ b/Makefile
@@ -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)
--
2.4.0
Hi Johannes,
On Thu, Jun 9, 2016 at 11:25 AM, Johannes Berg
<[email protected]> wrote:
> 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)
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
> johannes
Best Regards,
Maxin
On Fri, 2016-06-10 at 13:58 +0300, Maxin B. John wrote:
> Hi Johannes,
>
> On Thu, Jun 9, 2016 at 11:25 AM, Johannes Berg
> <[email protected]> wrote:
> > 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)
>
> 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
Hi,
On Tue, Jun 21, 2016 at 12:41 PM, Johannes Berg
<[email protected]> wrote:
> On Fri, 2016-06-10 at 13:58 +0300, Maxin B. John wrote:
>> Hi Johannes,
>>
>> On Thu, Jun 9, 2016 at 11:25 AM, Johannes Berg
>> <[email protected]> wrote:
>> > 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)
>>
>> 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?
I will look into that. Thanks for the suggestion !
> johannes
Best Regards,
Maxin
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