From: Sam Ravnborg <sam@ravnborg.org>
To: Ashish sddf <buff_boulder@yahoo.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Compiling C++ kernel module + Makefile
Date: Fri, 16 Jan 2004 23:40:56 +0100 [thread overview]
Message-ID: <20040116224056.GA3227@mars.ravnborg.org> (raw)
In-Reply-To: <20040116210924.61545.qmail@web12008.mail.yahoo.com>
> Does anyone can ideas about how to change the kernel
> makefile to compile the C++ files the same way as C
> files ?
I assume you know the general opinion on C++ in the kernel - even in a module.
I just did a quick untested hack - try this. It assumes extension .cc for
c++ files.
You also need to define CXX in top level makefile and export it.
This patch will _not_ be pushed into mainline.
Sam
===== scripts/Makefile.build 1.41 vs edited =====
--- 1.41/scripts/Makefile.build Sun Oct 5 08:50:46 2003
+++ edited/scripts/Makefile.build Fri Jan 16 23:39:26 2004
@@ -174,6 +174,23 @@
%.o: %.c FORCE
$(call if_changed_rule,cc_o_c)
+# C++ support
+ cmd_cc_o_cpp = $(CXX) $(c_flags) -c -o $@ $<
+quiet_cmd_cc_o_cpp = C++ $@
+
+define rule_cc_o_cpp
+ $(if $($(quiet)cmd_checksrc),echo ' $($(quiet)cmd_checksrc)';) \
+ $(cmd_checksrc) \
+ $(if $($(quiet)cmd_cc_o_cpp),echo ' $($(quiet)cmd_cc_o_cpp)';) \
+ $(cmd_cc_o_cpp); \
+ scripts/fixdep $(depfile) $@ '$(cmd_cc_o_cpp)' > $(@D)/.$(@F).tmp; \
+ rm -f $(depfile); \
+ mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd
+endef
+
+%.o: %.cc FORCE
+ $(call if_changed_rule,cc_o_cpp)
+
# Single-part modules are special since we need to mark them in $(MODVERDIR)
$(single-used-m): %.o: %.c FORCE
next prev parent reply other threads:[~2004-01-16 22:39 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-16 21:09 Ashish sddf
2004-01-16 22:07 ` Richard B. Johnson
2004-01-17 12:59 ` Bart Samwel
2004-01-19 13:46 ` Richard B. Johnson
2004-01-19 17:40 ` Bart Samwel
2004-01-19 18:39 ` Richard B. Johnson
2004-01-19 20:02 ` Bart Samwel
2004-01-19 20:37 ` Richard B. Johnson
2004-01-19 21:24 ` Bart Samwel
2004-01-20 15:20 ` Richard B. Johnson
2004-01-20 17:34 ` Zan Lynx
2004-01-20 18:10 ` Richard B. Johnson
2004-01-20 13:38 ` Thomas Lahoda
2004-01-21 2:24 ` Michael Clark
2004-01-20 18:16 ` Chris Friesen
2004-01-21 17:01 ` Giuliano Pochini
2004-01-21 17:16 ` Bart Samwel
2004-01-20 0:59 ` Robin Rosenberg
2004-01-20 6:46 ` Linus Torvalds
2004-01-20 7:32 ` Robin Rosenberg
2004-01-20 10:46 ` Bart Samwel
2004-01-20 5:29 ` Valdis.Kletnieks
2004-01-20 9:48 ` Bart Samwel
2004-01-16 22:40 ` Sam Ravnborg [this message]
2004-01-19 13:21 Petr Vandrovec
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=20040116224056.GA3227@mars.ravnborg.org \
--to=sam@ravnborg.org \
--cc=buff_boulder@yahoo.com \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome