Mikael Starvik | 3e41d65 | 2005-07-27 11:44:30 -0700 | [diff] [blame] | 1 | # $Id: Makefile,v 1.28 2005/03/17 10:44:37 larsv Exp $ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | # cris/Makefile |
| 3 | # |
| 4 | # This file is included by the global makefile so that you can add your own |
| 5 | # architecture-specific flags and dependencies. Remember to do have actions |
| 6 | # for "archclean" and "archdep" for cleaning up and making dependencies for |
| 7 | # this architecture |
| 8 | # |
| 9 | # This file is subject to the terms and conditions of the GNU General Public |
| 10 | # License. See the file "COPYING" in the main directory of this archive |
| 11 | # for more details. |
| 12 | |
| 13 | # A bug in ld prevents us from having a (constant-value) symbol in a |
| 14 | # "ORIGIN =" or "LENGTH =" expression. |
| 15 | |
| 16 | arch-y := v10 |
| 17 | arch-$(CONFIG_ETRAX_ARCH_V10) := v10 |
Mikael Starvik | 3e41d65 | 2005-07-27 11:44:30 -0700 | [diff] [blame] | 18 | arch-$(CONFIG_ETRAX_ARCH_V32) := v32 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
| 20 | # No config avaiable for make clean etc |
| 21 | ifneq ($(arch-y),) |
| 22 | SARCH := arch-$(arch-y) |
| 23 | else |
| 24 | SARCH := |
| 25 | endif |
| 26 | |
| 27 | LD = $(CROSS_COMPILE)ld -mcrislinux |
| 28 | |
| 29 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S |
| 30 | |
| 31 | CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE) |
Sam Ravnborg | 222d394 | 2007-10-15 21:59:31 +0200 | [diff] [blame] | 32 | KBUILD_AFLAGS += -mlinux |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | |
Sam Ravnborg | a0f97e0 | 2007-10-14 22:21:35 +0200 | [diff] [blame] | 34 | KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
| 36 | ifdef CONFIG_FRAME_POINTER |
Sam Ravnborg | a0f97e0 | 2007-10-14 22:21:35 +0200 | [diff] [blame] | 37 | KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g |
| 38 | KBUILD_CFLAGS += -fno-omit-frame-pointer |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | endif |
| 40 | |
| 41 | head-y := arch/$(ARCH)/$(SARCH)/kernel/head.o |
| 42 | |
Sam Ravnborg | a0f97e0 | 2007-10-14 22:21:35 +0200 | [diff] [blame] | 43 | LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libgcc.a) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
| 45 | core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/ |
| 46 | core-y += arch/$(ARCH)/$(SARCH)/kernel/ arch/$(ARCH)/$(SARCH)/mm/ |
| 47 | drivers-y += arch/$(ARCH)/$(SARCH)/drivers/ |
| 48 | libs-y += arch/$(ARCH)/$(SARCH)/lib/ $(LIBGCC) |
| 49 | |
Mikael Starvik | 3e41d65 | 2005-07-27 11:44:30 -0700 | [diff] [blame] | 50 | # cris source path |
| 51 | SRC_ARCH = $(srctree)/arch/$(ARCH) |
| 52 | # cris object files path |
| 53 | OBJ_ARCH = $(objtree)/arch/$(ARCH) |
| 54 | |
| 55 | target_boot_arch_dir = $(OBJ_ARCH)/$(SARCH)/boot |
| 56 | target_boot_dir = $(OBJ_ARCH)/boot |
| 57 | src_boot_dir = $(SRC_ARCH)/boot |
| 58 | target_compressed_dir = $(OBJ_ARCH)/boot/compressed |
| 59 | src_compressed_dir = $(SRC_ARCH)/boot/compressed |
| 60 | target_rescue_dir = $(OBJ_ARCH)/boot/rescue |
| 61 | src_rescue_dir = $(SRC_ARCH)/boot/rescue |
| 62 | |
| 63 | export target_boot_arch_dir target_boot_dir src_boot_dir target_compressed_dir src_compressed_dir target_rescue_dir src_rescue_dir |
| 64 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | vmlinux.bin: vmlinux |
| 66 | $(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux.bin |
| 67 | |
| 68 | timage: vmlinux.bin |
| 69 | cat vmlinux.bin cramfs.img >timage |
| 70 | |
| 71 | simimage: timage |
| 72 | cp vmlinux.bin simvmlinux.bin |
| 73 | |
| 74 | # the following will remake timage without compiling the kernel |
| 75 | # it does of course require that all object files exist... |
| 76 | |
| 77 | cramfs: |
| 78 | ## cramfs - Creates a cramfs image |
| 79 | mkcramfs -b 8192 -m romfs_meta.txt root cramfs.img |
| 80 | cat vmlinux.bin cramfs.img >timage |
| 81 | |
| 82 | clinux: vmlinux.bin decompress.bin rescue.bin |
| 83 | |
Mikael Starvik | 3e41d65 | 2005-07-27 11:44:30 -0700 | [diff] [blame] | 84 | decompress.bin: $(target_boot_dir) |
| 85 | @$(MAKE) -f $(src_compressed_dir)/Makefile $(target_compressed_dir)/decompress.bin |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | |
Mikael Starvik | 3e41d65 | 2005-07-27 11:44:30 -0700 | [diff] [blame] | 87 | $(target_rescue_dir)/rescue.bin: $(target_boot_dir) |
| 88 | @$(MAKE) -f $(src_rescue_dir)/Makefile $(target_rescue_dir)/rescue.bin |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | |
Mikael Starvik | 3e41d65 | 2005-07-27 11:44:30 -0700 | [diff] [blame] | 90 | zImage: $(target_boot_dir) vmlinux.bin $(target_rescue_dir)/rescue.bin |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | ## zImage - Compressed kernel (gzip) |
Mikael Starvik | 3e41d65 | 2005-07-27 11:44:30 -0700 | [diff] [blame] | 92 | @$(MAKE) -f $(src_boot_dir)/Makefile zImage |
| 93 | |
| 94 | $(target_boot_dir): $(target_boot_arch_dir) |
| 95 | ln -sfn $< $@ |
| 96 | |
| 97 | $(target_boot_arch_dir): |
| 98 | mkdir -p $@ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | |
| 100 | compressed: zImage |
| 101 | |
| 102 | archmrproper: |
| 103 | archclean: |
Mikael Starvik | 3e41d65 | 2005-07-27 11:44:30 -0700 | [diff] [blame] | 104 | @if [ -d arch/$(ARCH)/boot ]; then \ |
| 105 | $(MAKE) $(clean)=arch/$(ARCH)/boot ; \ |
| 106 | fi |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | rm -f timage vmlinux.bin decompress.bin rescue.bin cramfs.img |
| 108 | rm -rf $(LD_SCRIPT).tmp |
| 109 | |
Sam Ravnborg | 5bb7826 | 2005-09-11 22:30:22 +0200 | [diff] [blame] | 110 | archprepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | |
| 112 | # Create some links to make all tools happy |
Mikael Starvik | 3e41d65 | 2005-07-27 11:44:30 -0700 | [diff] [blame] | 113 | $(SRC_ARCH)/.links: |
| 114 | @rm -rf $(SRC_ARCH)/drivers |
| 115 | @ln -sfn $(SRC_ARCH)/$(SARCH)/drivers $(SRC_ARCH)/drivers |
| 116 | @rm -rf $(SRC_ARCH)/boot |
| 117 | @ln -sfn $(SRC_ARCH)/$(SARCH)/boot $(SRC_ARCH)/boot |
| 118 | @rm -rf $(SRC_ARCH)/lib |
| 119 | @ln -sfn $(SRC_ARCH)/$(SARCH)/lib $(SRC_ARCH)/lib |
| 120 | @ln -sfn $(SRC_ARCH)/$(SARCH) $(SRC_ARCH)/arch |
| 121 | @ln -sfn $(SRC_ARCH)/$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S |
Al Viro | aa6ba2f | 2006-01-19 19:03:15 +0000 | [diff] [blame] | 122 | @ln -sfn $(SRC_ARCH)/$(SARCH)/kernel/asm-offsets.c $(SRC_ARCH)/kernel/asm-offsets.c |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | @touch $@ |
| 124 | |
| 125 | # Create link to sub arch includes |
Mikael Starvik | 3e41d65 | 2005-07-27 11:44:30 -0700 | [diff] [blame] | 126 | $(srctree)/include/asm-$(ARCH)/.arch: $(wildcard include/config/arch/*.h) |
| 127 | @echo ' Making $(srctree)/include/asm-$(ARCH)/arch -> $(srctree)/include/asm-$(ARCH)/$(SARCH) symlink' |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | @rm -f include/asm-$(ARCH)/arch |
Mikael Starvik | 3e41d65 | 2005-07-27 11:44:30 -0700 | [diff] [blame] | 129 | @ln -sf $(srctree)/include/asm-$(ARCH)/$(SARCH) $(srctree)/include/asm-$(ARCH)/arch |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | @touch $@ |