Commit 70f72acb authored by Richard Henderson's avatar Richard Henderson

[ALPHA] Makefile cleanup from Sam Ravnborg <sam@ravnborg.org>.

parent 42ca459a
...@@ -10,13 +10,17 @@ ...@@ -10,13 +10,17 @@
NM := $(NM) -B NM := $(NM) -B
LDFLAGS_vmlinux = -static -N #-relax LDFLAGS_vmlinux := -static -N #-relax
CFLAGS := $(CFLAGS) -pipe -mno-fp-regs -ffixed-8 LDFLAGS_BLOB := --format binary --oformat elf64-alpha
LDFLAGS_BLOB := --format binary --oformat elf64-alpha cflags-y := -pipe -mno-fp-regs -ffixed-8
# Determine if we can use the BWX instructions with GAS. # Determine if we can use the BWX instructions with GAS.
old_gas := $(shell if $(AS) --version 2>&1 | grep 'version 2.7' > /dev/null; then echo y; else echo n; fi) old_gas := $(shell if $(AS) --version 2>&1 | grep 'version 2.7' > /dev/null; then echo y; else echo n; fi)
ifeq ($(old_gas),y)
$(error The assembler '$(AS)' does not support the BWX instruction)
endif
# Determine if GCC understands the -mcpu= option. # Determine if GCC understands the -mcpu= option.
have_mcpu := $(shell if $(CC) -mcpu=ev5 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi) have_mcpu := $(shell if $(CC) -mcpu=ev5 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi)
...@@ -27,68 +31,64 @@ have_mcpu_ev6 := $(shell if $(CC) -mcpu=ev6 -S -o /dev/null -xc /dev/null > /dev ...@@ -27,68 +31,64 @@ have_mcpu_ev6 := $(shell if $(CC) -mcpu=ev6 -S -o /dev/null -xc /dev/null > /dev
have_mcpu_ev67 := $(shell if $(CC) -mcpu=ev67 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi) have_mcpu_ev67 := $(shell if $(CC) -mcpu=ev67 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi)
have_msmall_data := $(shell if $(CC) -msmall-data -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi) have_msmall_data := $(shell if $(CC) -msmall-data -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi)
ifeq ($(have_msmall_data),y)
CFLAGS := $(CFLAGS) -msmall-data cflags-$(have_msmall_data) += -msmall-data
endif
# Turn on the proper cpu optimizations. # Turn on the proper cpu optimizations.
ifeq ($(have_mcpu),y) ifeq ($(have_mcpu),y)
mcpu_done := n
# If GENERIC, make sure to turn off any instruction set extensions that # If GENERIC, make sure to turn off any instruction set extensions that
# the host compiler might have on by default. Given that EV4 and EV5 # the host compiler might have on by default. Given that EV4 and EV5
# have the same instruction set, prefer EV5 because an EV5 schedule is # have the same instruction set, prefer EV5 because an EV5 schedule is
# more likely to keep an EV4 processor busy than vice-versa. # more likely to keep an EV4 processor busy than vice-versa.
mcpu_done := n
ifeq ($(CONFIG_ALPHA_GENERIC),y) ifeq ($(CONFIG_ALPHA_GENERIC),y)
CFLAGS := $(CFLAGS) -mcpu=ev5 mcpu := ev5
mcpu_done := y mcpu_done := y
endif endif
ifeq ($(mcpu_done)$(CONFIG_ALPHA_SX164)$(have_mcpu_pca56),nyy) ifeq ($(mcpu_done)$(CONFIG_ALPHA_SX164)$(have_mcpu_pca56),nyy)
CFLAGS := $(CFLAGS) -mcpu=pca56 mcpu := pca56
mcpu_done := y mcpu_done := y
endif endif
ifeq ($(mcpu_done)$(CONFIG_ALPHA_POLARIS)$(have_mcpu_pca56),nyy) ifeq ($(mcpu_done)$(CONFIG_ALPHA_POLARIS)$(have_mcpu_pca56),nyy)
CFLAGS := $(CFLAGS) -mcpu=pca56 mcpu := pca56
mcpu_done := y mcpu_done := y
endif endif
ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV4),ny) ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV4),ny)
CFLAGS := $(CFLAGS) -mcpu=ev4 mcpu := ev4
mcpu_done := y mcpu_done := y
endif endif
ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV56),ny) ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV56),ny)
CFLAGS := $(CFLAGS) -mcpu=ev56 mcpu := ev56
mcpu_done := y mcpu_done := y
endif endif
ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV5),ny) ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV5),ny)
CFLAGS := $(CFLAGS) -mcpu=ev5 mcpu := ev5
mcpu_done := y mcpu_done := y
endif endif
ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV67)$(have_mcpu_ev67),nyy) ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV67)$(have_mcpu_ev67),nyy)
CFLAGS := $(CFLAGS) -mcpu=ev67 mcpu := ev67
mcpu_done := y mcpu_done := y
endif endif
ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV6),ny) ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV6),ny)
ifeq ($(have_mcpu_ev6),y) ifeq ($(have_mcpu_ev6),y)
CFLAGS := $(CFLAGS) -mcpu=ev6 mcpu := ev6
else else
ifeq ($(have_mcpu_pca56),y) ifeq ($(have_mcpu_pca56),y)
CFLAGS := $(CFLAGS) -mcpu=pca56 mcpu := pca56
else else
CFLAGS := $(CFLAGS) -mcpu=ev56 mcpu=ev56
endif endif
endif endif
mcpu_done := y mcpu_done := y
endif endif
cflags-$(mcpu_done) += -mcpu=$(mcpu)
endif endif
# For TSUNAMI, we must have the assembler not emulate our instructions. # For TSUNAMI, we must have the assembler not emulate our instructions.
# The same is true for IRONGATE, POLARIS, PYXIS. # The same is true for IRONGATE, POLARIS, PYXIS.
# BWX is most important, but we don't really want any emulation ever. # BWX is most important, but we don't really want any emulation ever.
CFLAGS += $(cflags-y) -Wa,-mev6
ifeq ($(old_gas),y)
# How do we do #error in make?
CFLAGS := --error-please-upgrade-your-assembler
endif
CFLAGS := $(CFLAGS) -Wa,-mev6
HEAD := arch/alpha/kernel/head.o HEAD := arch/alpha/kernel/head.o
...@@ -96,37 +96,16 @@ core-y += arch/alpha/kernel/ arch/alpha/mm/ ...@@ -96,37 +96,16 @@ core-y += arch/alpha/kernel/ arch/alpha/mm/
core-$(CONFIG_MATHEMU) += arch/alpha/math-emu/ core-$(CONFIG_MATHEMU) += arch/alpha/math-emu/
libs-y += arch/alpha/lib/ libs-y += arch/alpha/lib/
export libs-y boot := arch/alpha/boot
MAKEBOOT = $(MAKE) -C arch/alpha/boot
rawboot: vmlinux #Default target when executing make with no arguments
@$(MAKEBOOT) rawboot all boot: $(boot)/vmlinux.gz
boot: vmlinux $(boot)/vmlinux.gz: vmlinux
@$(MAKEBOOT) $(Q)$(MAKE) -f scripts/Makefile.build obj=$(boot) $@
# bootimage bootpfile: vmlinux
# My boot writes directly to a specific disk partition, I doubt most $(Q)$(MAKE) -f scripts/Makefile.build obj=$(boot) $(boot)/$@
# people will want to do that without changes..
#
msb my-special-boot: vmlinux
@$(MAKEBOOT) msb
bootimage: vmlinux
@$(MAKEBOOT) bootimage
srmboot: vmlinux
@$(MAKEBOOT) srmboot
archclean:
@$(MAKEBOOT) clean
archmrproper:
rm -f include/asm-alpha/asm_offsets.h
bootpfile: vmlinux
@$(MAKEBOOT) bootpfile
prepare: include/asm-$(ARCH)/asm_offsets.h prepare: include/asm-$(ARCH)/asm_offsets.h
...@@ -134,12 +113,19 @@ prepare: include/asm-$(ARCH)/asm_offsets.h ...@@ -134,12 +113,19 @@ prepare: include/asm-$(ARCH)/asm_offsets.h
arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \ arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
include/config/MARKER include/config/MARKER
include/asm-$(ARCH)/asm_offsets.h.tmp: arch/$(ARCH)/kernel/asm-offsets.s include/asm-$(ARCH)/asm_offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
@$(generate-asm-offsets.h) < $< > $@
include/asm-$(ARCH)/asm_offsets.h: include/asm-$(ARCH)/asm_offsets.h.tmp
@echo -n ' Generating $@' @echo -n ' Generating $@'
@$(generate-asm-offsets.h) < $< > $@.tmp
@$(update-if-changed) @$(update-if-changed)
archclean:
$(Q)$(MAKE) -f scripts/Makefile.clean obj=$(boot)
CLEAN_FILES += include/asm-$(ARCH)/offset.h.tmp \ CLEAN_FILES += include/asm-$(ARCH)/offset.h.tmp \
include/asm-$(ARCH)/offset.h include/asm-$(ARCH)/offset.h
define archhelp
echo '* boot - Compressed kernel image (arch/alpha/boot/vmlinux.gz)'
echo ' bootimage - SRM bootable image (arch/alpha/boot/bootimage)'
echo ' bootpfile - BOOTP bootable image (arch/alpha/boot/bootpfile)'
endef
...@@ -8,58 +8,35 @@ ...@@ -8,58 +8,35 @@
# Copyright (C) 1994 by Linus Torvalds # Copyright (C) 1994 by Linus Torvalds
# #
LINKFLAGS = -static -T bootloader.lds -uvsprintf #-N -relax host-progs := tools/mkbb tools/objstrip
EXTRA_TARGETS := vmlinux.gz vmlinux \
CFLAGS := $(CFLAGS) -I$(TOPDIR)/include vmlinux.nh tools/lxboot tools/bootlx tools/bootph \
bootloader bootpheader
.S.s: OBJSTRIP := $(obj)/tools/objstrip
$(CPP) $(AFLAGS) -traditional -o $*.o $<
.S.o: # SRM bootable image. Copy to offset 512 of a partition.
$(CC) $(AFLAGS) -traditional -c -o $*.o $< $(obj)/bootimage: $(addprefix $(obj)/tools/,mkbb lxboot bootlx) $(obj)/vmlinux.nh
( cat $(obj)/tools/lxboot $(obj)/tools/bootlx $(obj)/vmlinux.nh ) > $@
OBJECTS = head.o main.o $(obj)/tools/mkbb $@ $(obj)/tools/lxboot
BPOBJECTS = head.o bootp.o @echo ' Bootimage $@ is ready'
TARGETS = vmlinux.gz tools/objstrip # also needed by aboot & milo
VMLINUX = $(TOPDIR)/vmlinux # BOOTP bootable image. Define INITRD during make to append initrd image.
OBJSTRIP = tools/objstrip $(obj)/bootpfile: $(obj)/tools/bootph $(obj)/vmlinux.nh
LIBS := $(addprefix $(TOPDIR)/,$(libs-y)) cat $(obj)/tools/bootph $(obj)/vmlinux.nh > $@
all: $(TARGETS)
@echo Ready to install kernel in $(shell pwd)/vmlinux.gz
# normally no need to build these:
rawboot: vmlinux.nh tools/lxboot tools/bootlx
msb: tools/lxboot tools/bootlx vmlinux.nh
( cat tools/lxboot tools/bootlx vmlinux.nh ) > /dev/rz0a
disklabel -rw rz0 'linux' tools/lxboot tools/bootlx
bootimage: tools/mkbb tools/lxboot tools/bootlx vmlinux.nh
( cat tools/lxboot tools/bootlx vmlinux.nh ) > bootimage
tools/mkbb bootimage tools/lxboot
bootpfile: tools/bootph vmlinux.nh
cat tools/bootph vmlinux.nh > bootpfile
ifdef INITRD ifdef INITRD
cat $(INITRD) >> bootpfile cat $(INITRD) >> $@
endif endif
srmboot: bootdevice bootimage # Compressed kernel image
dd if=bootimage of=$(BOOTDEV) bs=512 seek=1 skip=1 $(obj)/vmlinux.gz: $(obj)/vmlinux FORCE
tools/mkbb $(BOOTDEV) tools/lxboot $(call if_changed,gzip)
@echo ' Kernel $@ is ready'
bootdevice:
@test "$(BOOTDEV)" != "" || (echo You must specify BOOTDEV ; exit -1)
vmlinux.gz: vmlinux
gzip -fv9 vmlinux
main.o: ksize.h $(obj)/main.o: $(obj)/ksize.h
$(obj)/bootp.o: $(obj)/ksize.h
bootp.o: ksize.h $(obj)/ksize.h: $(obj)/vmlinux.nh FORCE
echo "#define KERNEL_SIZE `ls -l $(obj)/vmlinux.nh | awk '{print $$5}'`" > $@T
ksize.h: vmlinux.nh FORCE
echo "#define KERNEL_SIZE `ls -l vmlinux.nh | awk '{print $$5}'`" > $@T
ifdef INITRD ifdef INITRD
[ -f $(INITRD) ] || exit 1 [ -f $(INITRD) ] || exit 1
echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T
...@@ -67,36 +44,36 @@ endif ...@@ -67,36 +44,36 @@ endif
cmp -s $@T $@ || mv -f $@T $@ cmp -s $@T $@ || mv -f $@T $@
rm -f $@T rm -f $@T
vmlinux.nh: $(VMLINUX) $(OBJSTRIP) quiet_cmd_strip = STRIP $@
$(OBJSTRIP) -v $(VMLINUX) vmlinux.nh cmd_strip = $(STRIP) -o $@ $<
$(obj)/vmlinux: vmlinux FORCE
vmlinux: $(TOPDIR)/vmlinux $(call if_changed,strip)
$(STRIP) -o vmlinux $(VMLINUX)
tools/lxboot: $(OBJSTRIP) bootloader
$(OBJSTRIP) -p bootloader tools/lxboot
tools/bootlx: bootloader $(OBJSTRIP) quiet_cmd_objstrip = OBJSTRIP $@
$(OBJSTRIP) -vb bootloader tools/bootlx cmd_objstrip = $(OBJSTRIP) $(OSFLAGS_$(@F)) $< $@
tools/bootph: bootpheader $(OBJSTRIP) OSFLAGS_vmlinux.nh := -v
$(OBJSTRIP) -vb bootpheader tools/bootph OSFLAGS_lxboot := -p
OSFLAGS_bootlx := -vb
OSFLAGS_bootph := -vb
$(OBJSTRIP): $(OBJSTRIP).c $(obj)/vmlinux.nh: vmlinux $(OBJSTRIP) FORCE
$(HOSTCC) $(HOSTCFLAGS) $< -o $@ $(call if_changed,objstrip)
$(obj)/tools/lxboot: $(obj)/bootloader $(OBJSTRIP) FORCE
$(call if_changed,objstrip)
tools/mkbb: tools/mkbb.c $(obj)/tools/bootlx: $(obj)/bootloader $(OBJSTRIP) FORCE
$(HOSTCC) tools/mkbb.c -o tools/mkbb $(call if_changed,objstrip)
bootloader: $(OBJECTS) $(obj)/tools/bootph: $(obj)/bootpheader $(OBJSTRIP) FORCE
$(LD) $(LINKFLAGS) $(OBJECTS) $(LIBS) -o bootloader $(call if_changed,objstrip)
bootpheader: $(BPOBJECTS) LDFLAGS_bootloader := -static -uvsprintf -T #-N -relax
$(LD) $(LINKFLAGS) $(BPOBJECTS) $(LIBS) -o bootpheader LDFLAGS_bootpheader := -static -uvsprintf -T #-N -relax
clean: $(obj)/bootloader: $(obj)/bootloader.lds $(obj)/head.o $(obj)/main.o FORCE
rm -f $(TARGETS) bootloader bootimage bootpfile bootpheader $(call if_changed,ld)
rm -f tools/mkbb tools/bootlx tools/lxboot tools/bootph
rm -f vmlinux.nh ksize.h
FORCE: $(obj)/bootpheader: $(obj)/bootloader.lds $(obj)/head.o $(obj)/bootp.o FORCE
$(call if_changed,ld)
...@@ -7,58 +7,53 @@ L_TARGET := lib.a ...@@ -7,58 +7,53 @@ L_TARGET := lib.a
# Many of these routines have implementations tuned for ev6. # Many of these routines have implementations tuned for ev6.
# Choose them iff we're targeting ev6 specifically. # Choose them iff we're targeting ev6 specifically.
ev6 := ev6-$(CONFIG_ALPHA_EV6) := ev6-
ifeq ($(CONFIG_ALPHA_EV6),y)
ev6 := ev6-
endif
# Several make use of the cttz instruction introduced in ev67. # Several make use of the cttz instruction introduced in ev67.
ev67 := ev67-$(CONFIG_ALPHA_EV67) := ev67-
ifeq ($(CONFIG_ALPHA_EV67),y)
ev67 := ev67-
endif
obj-y = __divqu.o __remqu.o __divlu.o __remlu.o \ obj-y = __divqu.o __remqu.o __divlu.o __remlu.o \
udelay.o \ udelay.o \
$(ev6)memset.o \ $(ev6-y)memset.o \
$(ev6)memcpy.o \ $(ev6-y)memcpy.o \
memmove.o \ memmove.o \
io.o \ io.o \
checksum.o \ checksum.o \
csum_partial_copy.o \ csum_partial_copy.o \
$(ev67)strlen.o \ $(ev67-y)strlen.o \
$(ev67)strcat.o \ $(ev67-y)strcat.o \
strcpy.o \ strcpy.o \
$(ev67)strncat.o \ $(ev67-y)strncat.o \
strncpy.o \ strncpy.o \
$(ev6)stxcpy.o \ $(ev6-y)stxcpy.o \
$(ev6)stxncpy.o \ $(ev6-y)stxncpy.o \
$(ev67)strchr.o \ $(ev67-y)strchr.o \
$(ev67)strrchr.o \ $(ev67-y)strrchr.o \
$(ev6)memchr.o \ $(ev6-y)memchr.o \
$(ev6)copy_user.o \ $(ev6-y)copy_user.o \
$(ev6)clear_user.o \ $(ev6-y)clear_user.o \
$(ev6)strncpy_from_user.o \ $(ev6-y)strncpy_from_user.o \
$(ev67)strlen_user.o \ $(ev67-y)strlen_user.o \
$(ev6)csum_ipv6_magic.o \ $(ev6-y)csum_ipv6_magic.o \
$(ev6)clear_page.o \ $(ev6-y)clear_page.o \
$(ev6)copy_page.o \ $(ev6-y)copy_page.o \
strcasecmp.o \ strcasecmp.o \
fpreg.o \ fpreg.o \
callback_srm.o srm_puts.o srm_printk.o callback_srm.o srm_puts.o srm_printk.o
obj-$(CONFIG_SMP) += dec_and_lock.o obj-$(CONFIG_SMP) += dec_and_lock.o
$(obj)/__divqu.o: $(obj)/$(ev6)divide.S # The division routines are built from single source, with different defines.
$(CC) $(AFLAGS) -DDIV -c -o $(obj)/__divqu.o $(obj)/$(ev6)divide.S AFLAGS___divqu.o = -DDIV
AFLAGS___remqu.o = -DREM
$(obj)/__remqu.o: $(obj)/$(ev6)divide.S AFLAGS___divlu.o = -DDIV -DINTSIZE
$(CC) $(AFLAGS) -DREM -c -o $(obj)/__remqu.o $(obj)/$(ev6)divide.S AFLAGS___remlu.o = -DREM -DINTSIZE
$(obj)/__divlu.o: $(obj)/$(ev6)divide.S $(obj)/__divqu.o: $(obj)/$(ev6-y)divide.S
$(CC) $(AFLAGS) -DDIV -DINTSIZE \ $(cmd_as_o_S)
-c -o $(obj)/__divlu.o $(obj)/$(ev6)divide.S $(obj)/__remqu.o: $(obj)/$(ev6-y)divide.S
$(cmd_as_o_S)
$(obj)/__remlu.o: $(obj)/$(ev6)divide.S $(obj)/__divlu.o: $(obj)/$(ev6-y)divide.S
$(CC) $(AFLAGS) -DREM -DINTSIZE \ $(cmd_as_o_S)
-c -o $(obj)/__remlu.o $(obj)/$(ev6)divide.S $(obj)/__remlu.o: $(obj)/$(ev6-y)divide.S
$(cmd_as_o_S)
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
# Makefile for the FPU instruction emulation. # Makefile for the FPU instruction emulation.
# #
CFLAGS += -I. -I$(TOPDIR)/include/math-emu -w CFLAGS += -Iinclude/math-emu -w
obj-$(CONFIG_MATHEMU) += math.o qrnnd.o obj-$(CONFIG_MATHEMU) += math.o qrnnd.o
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