* Makefile rules question
@ 2003-07-09 13:47 Krzysztof Halasa
0 siblings, 0 replies; only message in thread
From: Krzysztof Halasa @ 2003-07-09 13:47 UTC (permalink / raw)
To: linux-kernel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-07-09 13:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-09 13:47 Makefile rules question Krzysztof Halasa
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®