xref: /linux/arch/sparc/boot/Makefile (revision 349101da8e1f8e5eb1476b02823da80495224485)
11da177e4SLinus Torvalds# Makefile for the Sparc boot stuff.
21da177e4SLinus Torvalds#
31da177e4SLinus Torvalds# Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
41da177e4SLinus Torvalds# Copyright (C) 1997,1998 Jakub Jelinek (jj@ultra.linux.cz)
51da177e4SLinus Torvalds
61da177e4SLinus TorvaldsROOT_IMG	:= /usr/src/root.img
71da177e4SLinus TorvaldsELFTOAOUT	:= elftoaout
81da177e4SLinus Torvalds
91da177e4SLinus Torvaldshostprogs-y	:= piggyback btfixupprep
101da177e4SLinus Torvaldstargets		:= tftpboot.img btfix.o btfix.S image
111da177e4SLinus Torvalds
121da177e4SLinus Torvaldsquiet_cmd_elftoaout	= ELFTOAOUT $@
131da177e4SLinus Torvalds      cmd_elftoaout	= $(ELFTOAOUT) $(obj)/image -o $@
141da177e4SLinus Torvaldsquiet_cmd_piggy		= PIGGY   $@
151da177e4SLinus Torvalds      cmd_piggy		= $(obj)/piggyback $@ $(obj)/System.map $(ROOT_IMG)
161da177e4SLinus Torvaldsquiet_cmd_btfix		= BTFIX   $@
171da177e4SLinus Torvalds      cmd_btfix		= $(OBJDUMP) -x vmlinux | $(obj)/btfixupprep > $@
181da177e4SLinus Torvaldsquiet_cmd_sysmap        = SYSMAP  $(obj)/System.map
191da177e4SLinus Torvalds      cmd_sysmap        = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
201da177e4SLinus Torvaldsquiet_cmd_image = LD      $@
211da177e4SLinus Torvalds      cmd_image = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) -o $@
22*349101daSMartin Habetsquiet_cmd_strip = STRIP   $@
23*349101daSMartin Habets      cmd_strip = $(STRIP) -R .comment -R .note -K sun4u_init -K _end -K _start $(obj)/image -o $@
24*349101daSMartin Habets
251da177e4SLinus Torvalds
261da177e4SLinus Torvaldsdefine rule_image
271da177e4SLinus Torvalds	$(if $($(quiet)cmd_image),               \
281da177e4SLinus Torvalds	  echo '  $($(quiet)cmd_image)' &&)      \
291da177e4SLinus Torvalds	  $(cmd_image);                          \
301da177e4SLinus Torvalds	$(if $($(quiet)cmd_sysmap),              \
311da177e4SLinus Torvalds	  echo '  $($(quiet)cmd_sysmap)' &&)  \
321da177e4SLinus Torvalds	$(cmd_sysmap) $@ $(obj)/System.map;      \
331da177e4SLinus Torvalds	if [ $$? -ne 0 ]; then                   \
341da177e4SLinus Torvalds		rm -f $@;                        \
351da177e4SLinus Torvalds		/bin/false;                      \
361da177e4SLinus Torvalds	fi;                                      \
371da177e4SLinus Torvalds	echo 'cmd_$@ := $(cmd_image)' > $(@D)/.$(@F).cmd
381da177e4SLinus Torvaldsendef
391da177e4SLinus Torvalds
401da177e4SLinus TorvaldsBTOBJS := $(HEAD_Y) $(INIT_Y)
411da177e4SLinus TorvaldsBTLIBS := $(CORE_Y) $(LIBS_Y) $(DRIVERS_Y) $(NET_Y)
421da177e4SLinus TorvaldsLDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds $(BTOBJS) \
431da177e4SLinus Torvalds                  --start-group $(BTLIBS) --end-group \
441da177e4SLinus Torvalds                  $(kallsyms.o) $(obj)/btfix.o
451da177e4SLinus Torvalds
461da177e4SLinus Torvalds# Link the final image including btfixup'ed symbols.
471da177e4SLinus Torvalds# This is a replacement for the link done in the top-level Makefile.
481da177e4SLinus Torvalds# Note: No dependency on the prerequisite files since that would require
491da177e4SLinus Torvalds# make to try check if they are updated - and due to changes
501da177e4SLinus Torvalds# in gcc options (path for example) this would result in
511da177e4SLinus Torvalds# these files being recompiled for each build.
521da177e4SLinus Torvalds$(obj)/image: $(obj)/btfix.o FORCE
531da177e4SLinus Torvalds	$(call if_changed_rule,image)
541da177e4SLinus Torvalds
55*349101daSMartin Habets$(obj)/zImage: $(obj)/image
56*349101daSMartin Habets	$(call if_changed,strip)
57*349101daSMartin Habets
581da177e4SLinus Torvalds$(obj)/tftpboot.img: $(obj)/piggyback $(obj)/System.map $(obj)/image FORCE
591da177e4SLinus Torvalds	$(call if_changed,elftoaout)
601da177e4SLinus Torvalds	$(call if_changed,piggy)
611da177e4SLinus Torvalds
621da177e4SLinus Torvalds$(obj)/btfix.S: $(obj)/btfixupprep vmlinux FORCE
631da177e4SLinus Torvalds	$(call if_changed,btfix)
64