B.A.T.M.A.N Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Allow to enable features without editing Makefile
Date: Sun,  4 Dec 2011 20:10:48 +0100	[thread overview]
Message-ID: <1323025848-14024-4-git-send-email-sven@narfation.org> (raw)
In-Reply-To: <1323025848-14024-1-git-send-email-sven@narfation.org>

The user should not be encouraged to edit sources to prevent inconsistent
changes. Upcoming features will not only use preprocessor variables to enable
or disable itself, but also need to compile specific files at the same time.
Therefore, it is safer to provide make parameters which can enable everything
necessary for a specific option and look similar to the .config options of the
kernel.

It is not possible to disable features enabled by the target kernel because the
include/generated/autoconf.h of the kernel sources isn't regenerated by a
module build. Hence, it is better not to disable features in the makefile by
default because the preprocessor will not have the same information. This can
be changed later by a more complex configuration system that generates an own
compat_autoconf.h that is included by compat.h. This header would have to

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 Makefile |    7 +++++--
 README   |    6 +++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 4f338aa..e78e797 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,10 @@
 # 02110-1301, USA
 #
 
-
+# uncomment the CONFIG_* line to enable the related feature
+# features enabled in the target kernel configuration cannot be disabled
+# B.A.T.M.A.N. debugging:
+# CONFIG_BATMAN_ADV_DEBUG=y
 
 PWD:=$(shell pwd)
 KERNELPATH ?= /lib/modules/$(shell uname -r)/build
@@ -38,7 +41,7 @@ batman-adv-y += compat.o
 ifneq ($(REVISION),)
 ccflags-y += -DSOURCE_VERSION=\"$(REVISION)\"
 endif
-# ccflags-y += -DCONFIG_BATMAN_ADV_DEBUG
+ccflags-$(CONFIG_BATMAN_ADV_DEBUG) += -DCONFIG_BATMAN_ADV_DEBUG
 include $(PWD)/Makefile.kbuild
 
 all:
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.3


  parent reply	other threads:[~2011-12-04 19:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-04 19:10 [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Don't automatically build in parallel Sven Eckelmann
2011-12-04 19:10 ` [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: Remove OpenWRT specific makefile rules Sven Eckelmann
2011-12-07  8:36   ` Marek Lindner
2011-12-04 19:10 ` [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: Remove non-kernel parts from Makefile.kbuild Sven Eckelmann
2011-12-07  8:38   ` Marek Lindner
2011-12-04 19:10 ` Sven Eckelmann [this message]
2011-12-04 19:16   ` [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Allow to enable features without editing Makefile Sven Eckelmann
2011-12-07  9:17     ` Marek Lindner
2011-12-07  8:34 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Don't automatically build in parallel Marek Lindner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1323025848-14024-4-git-send-email-sven@narfation.org \
    --to=sven@narfation.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox