* [B.A.T.M.A.N.] [RFC] batman-adv: Move build compat stuff to Makefile
@ 2011-11-24 10:40 Sven Eckelmann
2011-11-24 13:01 ` Marek Lindner
0 siblings, 1 reply; 8+ messages in thread
From: Sven Eckelmann @ 2011-11-24 10:40 UTC (permalink / raw)
To: b.a.t.m.a.n
Hi,
I looked at the new patches from ordex and thought about using the Makefile
from the kernel as the Makefile.kbuild in the standalone distribution. The
Makefile is only the user friendly compatibility layer over the kbuild stuff.
The problem is: The OpenWRT buildscript only uses the Makefile.kbuild (for a
reason I don't know right now) and "adds" those extra includes for OpenWRT
specific rules to the Makefile.kbuild (another part I never understood and only
saw in the batman-adv makefiles).
So maybe it is possible to discuss those different points and maybe find a
solution for it. Things which are done here:
* Import of kernel Makefile as Makefile.kbuild
- Removes OpenWRT specific include of Rules.make
- Removes place to manually set -DCONFIG_BATMAN_ADV_DEBUG
- Removes compat.c build
* Removal of the automatic detection of CPUs (see the discussion of the batctl
patch)
* Enabling of the batman-adv module build and adding of compat.o to the build
through Makefile instead of Makefile.kbuild
* Introducing the "new" way to enable optional features through
`make CONFIG_BATMAN_ADV_FEATURE=y`
* Fix of source revision "branding" when directly calling `make install` in
the clean source directory
Kind regards,
Sven
---
diff --git a/Makefile b/Makefile
index 3374687..b4159ed 100644
--- a/Makefile
+++ b/Makefile
@@ -33,15 +33,19 @@ REVISION= $(shell if [ -d .git ]; then \
echo $$(git describe --always --dirty --match "v*" |sed 's/^v//' 2> /dev/null || echo "[unknown]"); \
fi)
-NUM_CPUS = $(shell nproc 2> /dev/null || echo 1)
-
+CONFIG_BATMAN_ADV=m
+batman-adv-y += compat.o
+ifneq ($(REVISION),)
+ccflags-y += -DSOURCE_VERSION=\"$(REVISION)\"
+endif
+ccflags-$(CONFIG_BATMAN_ADV_DEBUG) += -DCONFIG_BATMAN_ADV_DEBUG
include $(PWD)/Makefile.kbuild
all:
- $(MAKE) -C $(KERNELPATH) REVISION=$(REVISION) M=$(PWD) PWD=$(PWD) -j $(NUM_CPUS) modules
+ $(MAKE) -C $(KERNELPATH) REVISION=$(REVISION) M=$(PWD) PWD=$(PWD) modules
clean:
$(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) clean
install:
- $(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) INSTALL_MOD_DIR=kernel/net/batman-adv/ modules_install
+ $(MAKE) -C $(KERNELPATH) REVISION=$(REVISION) M=$(PWD) PWD=$(PWD) INSTALL_MOD_DIR=kernel/net/batman-adv/ modules_install
diff --git a/Makefile.kbuild b/Makefile.kbuild
index bd7e93c..ce68611 100644
--- a/Makefile.kbuild
+++ b/Makefile.kbuild
@@ -18,20 +18,7 @@
# 02110-1301, USA
#
-
-
-# openwrt integration
-ifeq ($(MAKING_MODULES),1)
--include $(TOPDIR)/Rules.make
-endif
-
-# ccflags-y += -DCONFIG_BATMAN_ADV_DEBUG
-
-ifneq ($(REVISION),)
-ccflags-y += -DSOURCE_VERSION=\"$(REVISION)\"
-endif
-
-obj-m += batman-adv.o
+obj-$(CONFIG_BATMAN_ADV) += batman-adv.o
batman-adv-y += bat_debugfs.o
batman-adv-y += bat_iv_ogm.o
batman-adv-y += bat_sysfs.o
@@ -50,4 +37,3 @@ batman-adv-y += soft-interface.o
batman-adv-y += translation-table.o
batman-adv-y += unicast.o
batman-adv-y += vis.o
-batman-adv-y += compat.o
diff --git a/README b/README
index 7404c0a..ddc9569 100644
--- a/README
+++ b/README
@@ -207,10 +207,10 @@ times necessary to see more detail debug messages. This must be
enabled when compiling the batman-adv module. When building bat-
man-adv as part of kernel, use "make menuconfig" and enable the
option "B.A.T.M.A.N. debugging". When compiling outside of the
-kernel tree it is necessary to edit the file Makefile.kbuild and
-uncomment the line
+kernel tree it is necessary to enable it using the make option
+CONFIG_BATMAN_ADV_DEBUG=y
-#ccflags-y += -DCONFIG_BATMAN_ADV_DEBUG
+# make CONFIG_BATMAN_ADV_DEBUG=y
Those additional debug messages can be accessed using a special
file in debugfs
--
1.7.7.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv: Move build compat stuff to Makefile
2011-11-24 10:40 [B.A.T.M.A.N.] [RFC] batman-adv: Move build compat stuff to Makefile Sven Eckelmann
@ 2011-11-24 13:01 ` Marek Lindner
2011-11-24 13:18 ` Sven Eckelmann
2011-11-24 13:18 ` Marek Lindner
0 siblings, 2 replies; 8+ messages in thread
From: Marek Lindner @ 2011-11-24 13:01 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
Hi,
> I looked at the new patches from ordex and thought about using the Makefile
> from the kernel as the Makefile.kbuild in the standalone distribution. The
> Makefile is only the user friendly compatibility layer over the kbuild
> stuff.
I thought the main idea behind this separation was to have one Makefile for
the kernel folks and one for the out-of-tree users ? Are they going to accept
a single Makefile which contains more than what is needed for in-kernel
development ?
Regards,
Marek
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv: Move build compat stuff to Makefile
2011-11-24 13:01 ` Marek Lindner
@ 2011-11-24 13:18 ` Sven Eckelmann
2011-11-24 13:26 ` Andrew Lunn
2011-11-24 13:18 ` Marek Lindner
1 sibling, 1 reply; 8+ messages in thread
From: Sven Eckelmann @ 2011-11-24 13:18 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Marek Lindner
[-- Attachment #1: Type: text/plain, Size: 1277 bytes --]
On Thursday 24 November 2011 21:01:21 Marek Lindner wrote:
> Hi,
>
> > I looked at the new patches from ordex and thought about using the
> > Makefile from the kernel as the Makefile.kbuild in the standalone
> > distribution. The Makefile is only the user friendly compatibility
> > layer over the kbuild stuff.
>
> I thought the main idea behind this separation was to have one Makefile for
> the kernel folks and one for the out-of-tree users ? Are they going to
> accept a single Makefile which contains more than what is needed for
> in-kernel development ?
What?
I moved the kernel's Makefile the standalone version and called it
Makefile.kbuild... a 1:1 copy and not some kind of "a little bit like the
other thing from the standalone repos". Maybe you already noticed that this
thing is one reason for the merge conflicts which need additional work to get
it into the kernel. So the concept would be:
* Makefile.kbuild == the thing called Makefile in the kernel under
net/batman-adv/
* Makefile == the thing which does the magic things to get a "good" user
experience and the compatibility stuff
I would be even happier when we also could remove the '#include "compat.h"'
from main.h somehow, but I had no good (and working) idea.
Kind regards,
Sven
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv: Move build compat stuff to Makefile
2011-11-24 13:01 ` Marek Lindner
2011-11-24 13:18 ` Sven Eckelmann
@ 2011-11-24 13:18 ` Marek Lindner
2011-11-24 13:32 ` Sven Eckelmann
1 sibling, 1 reply; 8+ messages in thread
From: Marek Lindner @ 2011-11-24 13:18 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Thursday, November 24, 2011 21:01:21 Marek Lindner wrote:
> > I looked at the new patches from ordex and thought about using the
> > Makefile from the kernel as the Makefile.kbuild in the standalone
> > distribution. The Makefile is only the user friendly compatibility layer
> > over the kbuild stuff.
>
> I thought the main idea behind this separation was to have one Makefile for
> the kernel folks and one for the out-of-tree users ? Are they going to
> accept a single Makefile which contains more than what is needed for
> in-kernel development ?
sorry, I misread your intentions - then I discovered the patch at the end. Let
me try this on OpenWrt.
Regards,
Marek
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv: Move build compat stuff to Makefile
2011-11-24 13:18 ` Sven Eckelmann
@ 2011-11-24 13:26 ` Andrew Lunn
2011-11-24 13:30 ` Sven Eckelmann
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Lunn @ 2011-11-24 13:26 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking; +Cc: Marek Lindner
> I would be even happier when we also could remove the '#include "compat.h"'
> from main.h somehow, but I had no good (and working) idea.
Hi Sven
Could you build solution using the gcc option:
-include file
Process file as if #include "file" appeared as the first line of
the primary source file.
Pass this when compiling out of tree by appending it to CFLAGS? The
hard thing is the ordering. compat.h will be first, before all other
header files.
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv: Move build compat stuff to Makefile
2011-11-24 13:26 ` Andrew Lunn
@ 2011-11-24 13:30 ` Sven Eckelmann
0 siblings, 0 replies; 8+ messages in thread
From: Sven Eckelmann @ 2011-11-24 13:30 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Marek Lindner
[-- Attachment #1: Type: text/plain, Size: 772 bytes --]
On Thursday 24 November 2011 14:26:48 Andrew Lunn wrote:
> > I would be even happier when we also could remove the '#include
> > "compat.h"' from main.h somehow, but I had no good (and working) idea.
>
> Hi Sven
>
> Could you build solution using the gcc option:
>
> -include file
>
> Process file as if #include "file" appeared as the first line of
> the primary source file.
>
> Pass this when compiling out of tree by appending it to CFLAGS? The
> hard thing is the ordering. compat.h will be first, before all other
> header files.
No, this doesn't work. I had the same idea, but not only our stuff is build,
but also some extra kernel stuff. These file will just fail (tested here on
open-mesh.org with multiple kernel build versions).
Thanks,
Sven
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv: Move build compat stuff to Makefile
2011-11-24 13:18 ` Marek Lindner
@ 2011-11-24 13:32 ` Sven Eckelmann
2011-11-26 13:18 ` Marek Lindner
0 siblings, 1 reply; 8+ messages in thread
From: Sven Eckelmann @ 2011-11-24 13:32 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Marek Lindner
[-- Attachment #1: Type: text/plain, Size: 1014 bytes --]
On Thursday 24 November 2011 21:18:47 Marek Lindner wrote:
> On Thursday, November 24, 2011 21:01:21 Marek Lindner wrote:
> > > I looked at the new patches from ordex and thought about using the
> > > Makefile from the kernel as the Makefile.kbuild in the standalone
> > > distribution. The Makefile is only the user friendly compatibility
> > > layer over the kbuild stuff.
> >
> > I thought the main idea behind this separation was to have one Makefile
> > for the kernel folks and one for the out-of-tree users ? Are they going
> > to accept a single Makefile which contains more than what is needed for
> > in-kernel development ?
>
> sorry, I misread your intentions - then I discovered the patch at the end.
> Let me try this on OpenWrt.
OpenWRT would need some tweaks to get it working (I didn't test it... just
assuming some things). So copying the Makefile.kbuild to Makefile must be
removed and PWD= has to be set to the source folder when making the
build/install/clean calls.
Kind regards,
Sven
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv: Move build compat stuff to Makefile
2011-11-24 13:32 ` Sven Eckelmann
@ 2011-11-26 13:18 ` Marek Lindner
0 siblings, 0 replies; 8+ messages in thread
From: Marek Lindner @ 2011-11-26 13:18 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Thursday, November 24, 2011 21:32:41 Sven Eckelmann wrote:
> > sorry, I misread your intentions - then I discovered the patch at the
> > end. Let me try this on OpenWrt.
>
> OpenWRT would need some tweaks to get it working (I didn't test it... just
> assuming some things). So copying the Makefile.kbuild to Makefile must be
> removed and PWD= has to be set to the source folder when making the
> build/install/clean calls.
Right, these few changes did the make it compile.
I like this approach. If nobody objects I'd say you can submit a patch for
that. Maybe we could add a little note at the beginning of the Makefile:
# uncomment to enable extended debug log
# CONFIG_BATMAN_ADV_DEBUG=y
DAT / BLA2 / catwoman / $future_feature will want to add their option too.
Cheers,
Marek
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-11-26 13:18 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-24 10:40 [B.A.T.M.A.N.] [RFC] batman-adv: Move build compat stuff to Makefile Sven Eckelmann
2011-11-24 13:01 ` Marek Lindner
2011-11-24 13:18 ` Sven Eckelmann
2011-11-24 13:26 ` Andrew Lunn
2011-11-24 13:30 ` Sven Eckelmann
2011-11-24 13:18 ` Marek Lindner
2011-11-24 13:32 ` Sven Eckelmann
2011-11-26 13:18 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox