From: "H. Peter Anvin" <hpa@zytor.com>
To: Rene Herman <rene.herman@gmail.com>
Cc: Kai Germaschewski <kai@germaschewski.name>,
Sam Ravnborg <sam@ravnborg.org>,
Linux Kernel <linux-kernel@vger.kernel.org>,
ALSA devel <alsa-devel@alsa-project.org>
Subject: Re: Per option CFLAGS?
Date: Fri, 14 Sep 2007 16:13:29 -0700 [thread overview]
Message-ID: <46EB1599.4020806@zytor.com> (raw)
In-Reply-To: <46EB141A.7090200@gmail.com>
Rene Herman wrote:
> Hi Kai, Sam.
>
> I have a single file foo.c that I want to generate two (ALSA) modules
> from, snd-foo2000.ko and snd-foo2001.ko, by compiling with either
> FOO2000 or FOO2001 defined.
>
> I can do this, and ALSA does this a few times, by providing dummy
> foo2000.c and foo2001.c files, like:
>
> === foo2000.c
> #define FOO2000
> #include "foo.c"
> ===
>
> and a regular Makefile
>
> ===
> foo2000-objs := foo2000.o
> foo2001-objs := foo2001.o
>
> obj-$(CONFIG_SND_FOO2000) += snd-foo2000.o
> obj-$(CONFIG_SND_F002001) += snd-foo2001.o
> ===
>
> That #include is a little lame though. Is there a nicer way? I noticed
> the per-file CFLAGS, but given that it's one source file for both, that
> doesn't fit.
>
The stub source file is usually considered a good way to do this.
-hpa
next prev parent reply other threads:[~2007-09-14 23:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-14 23:07 Per option CFLAGS? Rene Herman
2007-09-14 23:13 ` H. Peter Anvin [this message]
2007-09-14 23:30 ` Rene Herman
2007-09-15 8:47 ` Adrian Bunk
2007-09-15 15:17 ` Rene Herman
2007-09-15 15:52 ` Adrian Bunk
2007-09-15 15:53 ` Denys Vlasenko
2007-09-15 15:59 ` Rene Herman
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=46EB1599.4020806@zytor.com \
--to=hpa@zytor.com \
--cc=alsa-devel@alsa-project.org \
--cc=kai@germaschewski.name \
--cc=linux-kernel@vger.kernel.org \
--cc=rene.herman@gmail.com \
--cc=sam@ravnborg.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;
as well as URLs for NNTP newsgroup(s).