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
OBJCOPYFLAGS := -S -O binary
$(obj)/main.o: $(obj)/main.c
$(BOOTCC) $(BOOTCFLAGS) -c -o $*.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)/zlib.o: $(obj)/zlib.c obj-boot := $(addprefix $(obj)/,$(obj-boot))
$(BOOTCC) $(BOOTCFLAGS) -c -o $*.o $< OBJS := $(addprefix $(obj)/,$(OBJS))
targets += $(obj-boot) $(addprefix $(obj)/,image.c image.o)
$(obj)/imagesize.o: $(obj)/imagesize.c
$(BOOTCC) $(BOOTCFLAGS) -c -o $*.o $< quiet_cmd_bootcc = BOOTCC $@
cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
$(obj)/no_initrd.o: $(obj)/no_initrd.c $(obj-boot): %.o: %.c FORCE
$(BOOTCC) $(BOOTCFLAGS) -c -o $*.o $< $(call if_changed_dep,bootcc)
$(obj)/crt0.o: $(obj)/crt0.S quiet_cmd_bootas = BOOTAS $@
$(BOOTCC) $(BOOTAFLAGS) -traditional -c -o $*.o $< cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -traditional \
-c -o $@ $<
CFLAGS = $(CPPFLAGS) -O -fno-builtin -DSTDC_HEADERS $(obj)/crt0.o: %.o: %.S FORCE
LD_ARGS = -Ttext 0x00400000 -e _start $(call if_changed_dep,bootas)
OBJCOPYFLAGS := -S -O binary
host-progs := piggyback addnote addSystemMap addRamDisk
OBJS = $(addprefix $(obj)/,crt0.o start.o main.o zlib.o image.o imagesize.o) HOSTCFLAGS_piggyback.o := -DKERNELBASE=$(KERNELBASE)
EXTRA_TARGETS += zImage zImage.initrd vmlinux.bin vmlinux.gz \
ifeq ($(CONFIG_PPC_ISERIES),y) vmlinux.sm vmlinux.initrd vmlinux.sminitrd \
sysmap.o initrd.o
boot: vmlinux.sm
quiet_cmd_sysmap = SYSMAP $@
$(obj)/addSystemMap: $(obj)/addSystemMap.c cmd_sysmap = $(obj)/addSystemMap System.map $< $@
$(HOSTCC) $(HOSTCFLAGS) -o $@ $< $(obj)/vmlinux.sm: vmlinux $(obj)/addSystemMap System.map FORCE
$(call if_changed,sysmap)
$(obj)/vmlinux.sm: vmlinux $(obj)/addSystemMap
$(obj)/addSystemMap System.map vmlinux $(obj)/vmlinux.sm quiet_cmd_ramdisk = RAMDISK $@
cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz System.map $< $@
$(obj)/addRamDisk: $(obj)/addRamDisk.c $(obj)/vmlinux.initrd: vmlinux $(obj)/addRamDisk $(obj)/ramdisk.image.gz System.map FORCE
$(HOSTCC) $(HOSTCFLAGS) -o $@ $< $(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 quiet_cmd_piggy = PIGGY $@
cmd_piggy = $(obj)/piggyback $(@:.o=) < $< | $(BOOTAS) -o $@
else
boot: zImage $(obj)/image.o: $(obj)/vmlinux.gz $(obj)/piggyback FORCE
endif $(call if_changed,piggy)
$(obj)/piggyback: $(obj)/piggyback.c $(obj)/sysmap.o: System.map $(obj)/piggyback FORCE
$(HOSTCC) $(HOSTCFLAGS) -DKERNELBASE=$(KERNELBASE) -o $@ $< $(call if_changed,piggy)
$(obj)/addnote: $(obj)/addnote.c $(obj)/initrd.o: $(obj)/ramdisk.image.gz $(obj)/piggyback FORCE
$(HOSTCC) $(HOSTCFLAGS) -o $@ $< $(call if_changed,piggy)
$(obj)/image.o: $(obj)/piggyback $(obj)/vmlinux.gz quiet_cmd_addnote = ADDNOTE $@
$(obj)/piggyback $(obj)/image < $(obj)/vmlinux.gz | $(BOOTAS) -o $@ cmd_addnote = $(BOOTLD) $(LD_ARGS) -T $(obj)/zImage.lds -o $@ $(OBJS) $<\
&& $(obj)/addnote $@
$(obj)/sysmap.o: $(obj)/piggyback System.map
$(obj)/piggyback $(obj)/sysmap < System.map | $(BOOTAS) -o $(obj)/sysmap.o $(obj)/zImage: $(obj)/no_initrd.o $(OBJS) $(obj)/addnote FORCE
$(call if_changed,addnote)
$(obj)/initrd.o: $(obj)/ramdisk.image.gz $(obj)/piggyback
$(obj)/piggyback $(obj)/initrd < $(obj)/ramdisk.image.gz | $(BOOTAS) -o $(obj)/initrd.o $(obj)/zImage.initrd: $(obj)/initrd.o $(OBJS) $(obj)/addnote FORCE
$(call if_changed,addnote)
$(obj)/zImage: $(OBJS) $(obj)/no_initrd.o $(obj)/addnote
$(BOOTLD) $(LD_ARGS) -T $(obj)/zImage.lds -o $@ $(OBJS) $(obj)/no_initrd.o $(obj)/vmlinux.bin: vmlinux FORCE
$(obj)/addnote $@ $(call if_changed,objcopy)
$(obj)/zImage.initrd: $(OBJS) $(obj)/initrd.o $(obj)/addnote $(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
$(BOOTLD) $(LD_ARGS) -T $(obj)/zImage.lds -o $@ $(OBJS) $(obj)/initrd.o $(call if_changed,gzip)
./addnote $@
$(obj)/imagesize.c: vmlinux
$(obj)/vmlinux.gz: vmlinux @echo Generating $@
$(OBJCOPY) $(OBJCOPYFLAGS) vmlinux $(obj)/vmlinux ls -l vmlinux | \
ls -l $(obj)/vmlinux | awk '{printf "/* generated -- do not edit! */\nint uncompressed_size = %d;\n", $$5}' > $(obj)/imagesize.c awk '{printf "/* generated -- do not edit! */\n" \
$(CROSS_COMPILE)nm -n vmlinux | tail -1 | awk '{printf "long vmlinux_end = 0x%s;\n", substr($$1,8)}' >> $(obj)/imagesize.c "int uncompressed_size = %d;\n", $$5}' > $(obj)/imagesize.c
gzip -vf9 $(obj)/vmlinux $(CROSS_COMPILE)nm -n vmlinux | tail -1 | \
awk '{printf "long vmlinux_end = 0x%s;\n", substr($$1,8)}' \
$(obj)/imagesize.c: $(obj)/vmlinux.gz >> $(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