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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/