From: Krzysztof Halasa <khc@pm.waw.pl>
To: <linux-kernel@vger.kernel.org>
Subject: Makefile rules question
Date: 09 Jul 2003 15:47:17 +0200 [thread overview]
Message-ID: <m3vfub3j8a.fsf@defiant.pm.waw.pl> (raw)
Hi,
A simple question to you Makefile experts:
I need a rule for (conditional) assembling m68k file (driver firmware,
the card uses m68k processor). I have invented the following, is it
correct? This is drivers/net/wan Makefile.
...
obj-$(CONFIG_WANXL) += wanxl.o # the main driver, .C source
ifeq ($(CONFIG_WANXL_BUILD_FIRMWARE),y)
ifeq ($(ARCH),m68k)
AS68K = $(AS) # native as and ld
LD68K = $(LD)
else
AS68K = as68k # cross-as and ld
LD68K = ld68k
endif
quiet_cmd_build_wanxlfw = Building wanXL firmware
cmd_build_wanxlfw = \
$(CPP) -Wp,-MD,$(depfile) -Iinclude $(obj)/wanxlfw.S | $(AS68K) -m68360
-o $(obj)/wanxlfw.o; \
$(LD68K) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxl
fw.bin; \
hexdump -ve '"\n" 16/1 "0x%02X,"' $(obj)/wanxlfw.bin | sed 's/0x ,//g;1
s/^/static u8 firmware[]={/;$$s/,$$/\n};\n/' >$(obj)/wanxlfw.inc; \
rm -f $(obj)/wanxlfw.bin $(obj)/wanxlfw.o
$(obj)/wanxlfw.inc: $(obj)/wanxlfw.S
$(call if_changed_dep,build_wanxlfw)
-include $(obj)/.wanxlfw.inc.cmd
endif
The above assembles wanxlfw.S into .o -> .bin -> wanxlfw.inc (hexdump C code).
wanxlfw.inc is intended to be distributed with the kernel, in (default) case
the user doesn't want to rebuild the firmware.
--
Krzysztof Halasa
Network Administrator
reply other threads:[~2003-07-09 13:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=m3vfub3j8a.fsf@defiant.pm.waw.pl \
--to=khc@pm.waw.pl \
--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
all inboxes | Powered by JetHome®