Commit 84b3c277 authored by Anton Blanchard's avatar Anton Blanchard

ppc64: Makefile cleanup from Sam Ravnborg

parent 23c554b8
...@@ -23,92 +23,88 @@ ...@@ -23,92 +23,88 @@
CROSS32_COMPILE = CROSS32_COMPILE =
#CROSS32_COMPILE = /usr/local/ppc/bin/powerpc-linux- #CROSS32_COMPILE = /usr/local/ppc/bin/powerpc-linux-
BOOTCC = $(CROSS32_COMPILE)gcc BOOTCC := $(CROSS32_COMPILE)gcc
BOOTCFLAGS = $(HOSTCFLAGS) -I$(objtree)/include BOOTCFLAGS := $(HOSTCFLAGS) -Iinclude
BOOTLD = $(CROSS32_COMPILE)ld BOOTLD := $(CROSS32_COMPILE)ld
BOOTAS = $(CROSS32_COMPILE)as BOOTAS := $(CROSS32_COMPILE)as
BOOTAFLAGS = -D__ASSEMBLY__ $(HOSTCFLAGS) BOOTAFLAGS := -D__ASSEMBLY__ $(HOSTCFLAGS)
$(obj)/start.o: $(obj)/start.c CFLAGS := $(CPPFLAGS) -O -fno-builtin -DSTDC_HEADERS
$(BOOTCC) $(BOOTCFLAGS) -c -o $*.o $< LD_ARGS := -Ttext 0x00400000 -e _start
$(obj)/main.o: $(obj)/main.c
$(BOOTCC) $(BOOTCFLAGS) -c -o $*.o $<
$(obj)/zlib.o: $(obj)/zlib.c
$(BOOTCC) $(BOOTCFLAGS) -c -o $*.o $<
$(obj)/imagesize.o: $(obj)/imagesize.c
$(BOOTCC) $(BOOTCFLAGS) -c -o $*.o $<
$(obj)/no_initrd.o: $(obj)/no_initrd.c
$(BOOTCC) $(BOOTCFLAGS) -c -o $*.o $<
$(obj)/crt0.o: $(obj)/crt0.S
$(BOOTCC) $(BOOTAFLAGS) -traditional -c -o $*.o $<
CFLAGS = $(CPPFLAGS) -O -fno-builtin -DSTDC_HEADERS
LD_ARGS = -Ttext 0x00400000 -e _start
OBJCOPYFLAGS := -S -O binary OBJCOPYFLAGS := -S -O binary
OBJS = $(addprefix $(obj)/,crt0.o start.o main.o zlib.o image.o imagesize.o) obj-boot := start.o main.o zlib.o imagesize.o no_initrd.o
OBJS := crt0.o start.o main.o zlib.o imagesize.o image.o
obj-boot := $(addprefix $(obj)/,$(obj-boot))
OBJS := $(addprefix $(obj)/,$(OBJS))
targets += $(obj-boot) $(addprefix $(obj)/,image.c image.o)
ifeq ($(CONFIG_PPC_ISERIES),y) quiet_cmd_bootcc = BOOTCC $@
cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
$(obj-boot): %.o: %.c FORCE
$(call if_changed_dep,bootcc)
boot: vmlinux.sm quiet_cmd_bootas = BOOTAS $@
cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -traditional \
-c -o $@ $<
$(obj)/crt0.o: %.o: %.S FORCE
$(call if_changed_dep,bootas)
$(obj)/addSystemMap: $(obj)/addSystemMap.c host-progs := piggyback addnote addSystemMap addRamDisk
$(HOSTCC) $(HOSTCFLAGS) -o $@ $< HOSTCFLAGS_piggyback.o := -DKERNELBASE=$(KERNELBASE)
EXTRA_TARGETS += zImage zImage.initrd vmlinux.bin vmlinux.gz \
vmlinux.sm vmlinux.initrd vmlinux.sminitrd \
sysmap.o initrd.o
$(obj)/vmlinux.sm: vmlinux $(obj)/addSystemMap quiet_cmd_sysmap = SYSMAP $@
$(obj)/addSystemMap System.map vmlinux $(obj)/vmlinux.sm cmd_sysmap = $(obj)/addSystemMap System.map $< $@
$(obj)/vmlinux.sm: vmlinux $(obj)/addSystemMap System.map FORCE
$(call if_changed,sysmap)
$(obj)/addRamDisk: $(obj)/addRamDisk.c quiet_cmd_ramdisk = RAMDISK $@
$(HOSTCC) $(HOSTCFLAGS) -o $@ $< cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz System.map $< $@
$(obj)/vmlinux.initrd: vmlinux $(obj)/addRamDisk $(obj)/ramdisk.image.gz System.map FORCE
$(call if_changed,ramdisk)
$(obj)/vmlinux.initrd: vmlinux $(obj)/addRamDisk $(obj)/ramdisk.image.gz System.map $(obj)/vmlinux.sminitrd: $(obj)/vmlinux.sm $(obj)/addRamDisk $(obj)/ramdisk.image.gz FORCE
$(obj)/addRamDisk $(obj)/ramdisk.image.gz System.map vmlinux $(obj)/vmlinux.initrd $(call if_changed,ramdisk)
$(obj)/vmlinux.sminitrd: $(obj)/vmlinux.sm $(obj)/addRamDisk $(obj)/ramdisk.image.gz System.map
$(obj)/addRamDisk $(obj)/ramdisk.image.gz System.map $(obj)/vmlinux.sm $(obj)/vmlinux.sminitrd
else quiet_cmd_piggy = PIGGY $@
boot: zImage cmd_piggy = $(obj)/piggyback $(@:.o=) < $< | $(BOOTAS) -o $@
endif
$(obj)/piggyback: $(obj)/piggyback.c $(obj)/image.o: $(obj)/vmlinux.gz $(obj)/piggyback FORCE
$(HOSTCC) $(HOSTCFLAGS) -DKERNELBASE=$(KERNELBASE) -o $@ $< $(call if_changed,piggy)
$(obj)/addnote: $(obj)/addnote.c $(obj)/sysmap.o: System.map $(obj)/piggyback FORCE
$(HOSTCC) $(HOSTCFLAGS) -o $@ $< $(call if_changed,piggy)
$(obj)/image.o: $(obj)/piggyback $(obj)/vmlinux.gz $(obj)/initrd.o: $(obj)/ramdisk.image.gz $(obj)/piggyback FORCE
$(obj)/piggyback $(obj)/image < $(obj)/vmlinux.gz | $(BOOTAS) -o $@ $(call if_changed,piggy)
$(obj)/sysmap.o: $(obj)/piggyback System.map quiet_cmd_addnote = ADDNOTE $@
$(obj)/piggyback $(obj)/sysmap < System.map | $(BOOTAS) -o $(obj)/sysmap.o cmd_addnote = $(BOOTLD) $(LD_ARGS) -T $(obj)/zImage.lds -o $@ $(OBJS) $<\
&& $(obj)/addnote $@
$(obj)/initrd.o: $(obj)/ramdisk.image.gz $(obj)/piggyback $(obj)/zImage: $(obj)/no_initrd.o $(OBJS) $(obj)/addnote FORCE
$(obj)/piggyback $(obj)/initrd < $(obj)/ramdisk.image.gz | $(BOOTAS) -o $(obj)/initrd.o $(call if_changed,addnote)
$(obj)/zImage: $(OBJS) $(obj)/no_initrd.o $(obj)/addnote $(obj)/zImage.initrd: $(obj)/initrd.o $(OBJS) $(obj)/addnote FORCE
$(BOOTLD) $(LD_ARGS) -T $(obj)/zImage.lds -o $@ $(OBJS) $(obj)/no_initrd.o $(call if_changed,addnote)
$(obj)/addnote $@
$(obj)/zImage.initrd: $(OBJS) $(obj)/initrd.o $(obj)/addnote $(obj)/vmlinux.bin: vmlinux FORCE
$(BOOTLD) $(LD_ARGS) -T $(obj)/zImage.lds -o $@ $(OBJS) $(obj)/initrd.o $(call if_changed,objcopy)
./addnote $@
$(obj)/vmlinux.gz: vmlinux $(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
$(OBJCOPY) $(OBJCOPYFLAGS) vmlinux $(obj)/vmlinux $(call if_changed,gzip)
ls -l $(obj)/vmlinux | awk '{printf "/* generated -- do not edit! */\nint uncompressed_size = %d;\n", $$5}' > $(obj)/imagesize.c
$(CROSS_COMPILE)nm -n vmlinux | tail -1 | awk '{printf "long vmlinux_end = 0x%s;\n", substr($$1,8)}' >> $(obj)/imagesize.c
gzip -vf9 $(obj)/vmlinux
$(obj)/imagesize.c: $(obj)/vmlinux.gz $(obj)/imagesize.c: vmlinux
@echo Generating $@
ls -l vmlinux | \
awk '{printf "/* generated -- do not edit! */\n" \
"int uncompressed_size = %d;\n", $$5}' > $(obj)/imagesize.c
$(CROSS_COMPILE)nm -n vmlinux | tail -1 | \
awk '{printf "long vmlinux_end = 0x%s;\n", substr($$1,8)}' \
>> $(obj)/imagesize.c
clean: clean-files := $(targets)
@rm -f $(OBJS)
@rm -f $(addprefix $(obj)/,piggyback note addnote zImage \
zImage.initrd vmlinux.gz no_initrd.o imagesize.c addSystemMap \
vmlinux.sm addRamDisk vmlinux.initrd vmlinux.sminitrd)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment