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