Linux 2.6.26-rc5
[linux-2.6/openmoko-kernel/knife-kernel.git] / arch / sparc / boot / Makefile
blob22d331e1e9413b637a536e7c85345b503ca14cef
1 # Makefile for the Sparc boot stuff.
3 # Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
4 # Copyright (C) 1997,1998 Jakub Jelinek (jj@ultra.linux.cz)
6 ROOT_IMG := /usr/src/root.img
7 ELFTOAOUT := elftoaout
9 hostprogs-y := piggyback btfixupprep
10 targets := tftpboot.img btfix.o btfix.S image
12 quiet_cmd_elftoaout = ELFTOAOUT $@
13 cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@
14 quiet_cmd_piggy = PIGGY $@
15 cmd_piggy = $(obj)/piggyback $@ $(obj)/System.map $(ROOT_IMG)
16 quiet_cmd_btfix = BTFIX $@
17 cmd_btfix = $(OBJDUMP) -x vmlinux | $(obj)/btfixupprep > $@
18 quiet_cmd_sysmap = SYSMAP $(obj)/System.map
19 cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
20 quiet_cmd_image = LD $@
21 cmd_image = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) -o $@
23 define rule_image
24 $(if $($(quiet)cmd_image), \
25 echo ' $($(quiet)cmd_image)' &&) \
26 $(cmd_image); \
27 $(if $($(quiet)cmd_sysmap), \
28 echo ' $($(quiet)cmd_sysmap)' &&) \
29 $(cmd_sysmap) $@ $(obj)/System.map; \
30 if [ $$? -ne 0 ]; then \
31 rm -f $@; \
32 /bin/false; \
33 fi; \
34 echo 'cmd_$@ := $(cmd_image)' > $(@D)/.$(@F).cmd
35 endef
37 BTOBJS := $(HEAD_Y) $(INIT_Y)
38 BTLIBS := $(CORE_Y) $(LIBS_Y) $(DRIVERS_Y) $(NET_Y)
39 LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds $(BTOBJS) \
40 --start-group $(BTLIBS) --end-group \
41 $(kallsyms.o) $(obj)/btfix.o
43 # Link the final image including btfixup'ed symbols.
44 # This is a replacement for the link done in the top-level Makefile.
45 # Note: No dependency on the prerequisite files since that would require
46 # make to try check if they are updated - and due to changes
47 # in gcc options (path for example) this would result in
48 # these files being recompiled for each build.
49 $(obj)/image: $(obj)/btfix.o FORCE
50 $(call if_changed_rule,image)
52 $(obj)/tftpboot.img: $(obj)/piggyback $(obj)/System.map $(obj)/image FORCE
53 $(call if_changed,elftoaout)
54 $(call if_changed,piggy)
56 $(obj)/btfix.S: $(obj)/btfixupprep vmlinux FORCE
57 $(call if_changed,btfix)