[439] | 1 | ############################################################################# |
---|
| 2 | # ALMOS-MKH Makefile for BOOTLOADER TSAR # |
---|
| 3 | ############################################################################# |
---|
| 4 | |
---|
| 5 | -include ../../params-soft.mk |
---|
| 6 | ifeq ($(ARCH_NAME),) |
---|
| 7 | $(error Please define in ARCH_NAME parameter in params-soft.mk!) |
---|
| 8 | endif |
---|
| 9 | |
---|
| 10 | -include ../../params-hard.mk |
---|
| 11 | |
---|
| 12 | # Rules that don't build target files |
---|
| 13 | # always out-of-date, need to be regenerated everytime they are called |
---|
| 14 | .PHONY: compile \ |
---|
[624] | 15 | ../../hard_config.h \ |
---|
[439] | 16 | dirs \ |
---|
[624] | 17 | build/boot.elf |
---|
[439] | 18 | |
---|
| 19 | # Objects to be linked for boot.elf generation |
---|
| 20 | BOOT_OBJS = build/boot.o \ |
---|
[572] | 21 | build/boot_fat32.o \ |
---|
| 22 | build/boot_utils.o \ |
---|
| 23 | build/boot_entry.o \ |
---|
| 24 | build/boot_tty_driver.o \ |
---|
| 25 | build/boot_hba_driver.o \ |
---|
| 26 | build/boot_bdv_driver.o \ |
---|
| 27 | build/boot_mmc_driver.o |
---|
[439] | 28 | |
---|
| 29 | # List of directories to be searched for included files |
---|
| 30 | # when compiling for boot.elf generation |
---|
[572] | 31 | BOOT_INCLUDE = -I. \ |
---|
| 32 | -I../../tools/arch_info \ |
---|
| 33 | -I$(HAL_ARCH)/core \ |
---|
| 34 | -I../.. \ |
---|
| 35 | -I$(KERNEL) \ |
---|
[557] | 36 | -I$(KERNEL)/kern |
---|
[439] | 37 | |
---|
| 38 | # Rule to generate boot.elf, kernel.elf, ksh.elf, sort.elf and update virtual disk. |
---|
| 39 | compile: dirs \ |
---|
| 40 | build/boot.elf |
---|
| 41 | |
---|
| 42 | # Rule to create the build directories. |
---|
| 43 | dirs: |
---|
| 44 | @mkdir -p build |
---|
| 45 | |
---|
| 46 | clean: |
---|
| 47 | rm -rf build |
---|
| 48 | |
---|
| 49 | ../../hard_config.h: |
---|
| 50 | $(MAKE) -C ../../ hard_config.h |
---|
| 51 | |
---|
| 52 | ################################################ |
---|
| 53 | # Rules to compile boot drivers used by boot.elf |
---|
[572] | 54 | build/boot_tty_driver.o: boot_tty_driver.c \ |
---|
| 55 | boot_tty_driver.h \ |
---|
| 56 | boot_utils.h \ |
---|
| 57 | boot_config.h \ |
---|
| 58 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
| 59 | ../../hard_config.h |
---|
[439] | 60 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 61 | $(DU) -D $@ > $@.txt |
---|
| 62 | |
---|
| 63 | build/boot_bdv_driver.o: boot_bdv_driver.c \ |
---|
| 64 | boot_bdv_driver.h \ |
---|
| 65 | boot_utils.h \ |
---|
| 66 | boot_config.h \ |
---|
[457] | 67 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
[439] | 68 | ../../hard_config.h |
---|
| 69 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 70 | $(DU) -D $@ > $@.txt |
---|
| 71 | |
---|
| 72 | build/boot_hba_driver.o: boot_hba_driver.c \ |
---|
| 73 | boot_hba_driver.h \ |
---|
| 74 | boot_utils.h \ |
---|
| 75 | boot_config.h \ |
---|
[457] | 76 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
[439] | 77 | ../../hard_config.h |
---|
| 78 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 79 | $(DU) -D $@ > $@.txt |
---|
| 80 | |
---|
[547] | 81 | build/boot_spi_driver.o: boot_spi_driver.c \ |
---|
| 82 | boot_spi_driver.h \ |
---|
| 83 | boot_utils.h \ |
---|
| 84 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
| 85 | ../../hard_config.h |
---|
| 86 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 87 | $(DU) -D $@ > $@.txt |
---|
| 88 | |
---|
[439] | 89 | build/boot_mmc_driver.o: boot_mmc_driver.c \ |
---|
| 90 | boot_mmc_driver.h \ |
---|
| 91 | boot_utils.h \ |
---|
| 92 | boot_config.h \ |
---|
[457] | 93 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
[439] | 94 | ../../hard_config.h |
---|
| 95 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 96 | $(DU) -D $@ > $@.txt |
---|
| 97 | |
---|
| 98 | ############################## |
---|
[547] | 99 | # Rule to compile boot_spi_utils.o |
---|
| 100 | build/boot_spi_utils.o: boot_spi_utils.c \ |
---|
| 101 | boot_spi_utils.h \ |
---|
| 102 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
| 103 | ../../hard_config.h |
---|
| 104 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 105 | $(DU) -D $@ > $@.txt |
---|
| 106 | |
---|
| 107 | ############################## |
---|
[439] | 108 | # Rule to compile boot_fat32.o |
---|
| 109 | build/boot_fat32.o: boot_fat32.c \ |
---|
| 110 | boot_fat32.h \ |
---|
| 111 | boot_utils.h \ |
---|
| 112 | boot_config.h \ |
---|
[457] | 113 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
[439] | 114 | ../../hard_config.h |
---|
| 115 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 116 | $(DU) -D $@ > $@.txt |
---|
| 117 | |
---|
| 118 | ############################## |
---|
| 119 | # Rule to compile boot_utils.o |
---|
| 120 | build/boot_utils.o: boot_utils.c \ |
---|
| 121 | boot_utils.h \ |
---|
| 122 | boot_tty_driver.h \ |
---|
[457] | 123 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
[439] | 124 | ../../hard_config.h |
---|
| 125 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 126 | $(DU) -D $@ > $@.txt |
---|
| 127 | |
---|
| 128 | ######################## |
---|
| 129 | # Rule to compile boot.o |
---|
| 130 | build/boot.o: boot.c \ |
---|
| 131 | boot_utils.h \ |
---|
[547] | 132 | boot_spi_utils.h \ |
---|
[439] | 133 | boot_fat32.h \ |
---|
| 134 | boot_tty_driver.h \ |
---|
| 135 | boot_hba_driver.h \ |
---|
| 136 | boot_bdv_driver.h \ |
---|
| 137 | boot_mmc_driver.h \ |
---|
[547] | 138 | boot_spi_driver.h \ |
---|
[439] | 139 | boot_config.h \ |
---|
[457] | 140 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
[439] | 141 | ../../hard_config.h |
---|
| 142 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) $(MACROS) -c -o $@ $< |
---|
| 143 | $(DU) -D $@ > $@.txt |
---|
| 144 | |
---|
| 145 | ############################## |
---|
| 146 | # Rule to compile boot_entry.o |
---|
| 147 | build/boot_entry.o: boot_entry.S \ |
---|
| 148 | boot_config.h \ |
---|
| 149 | ../../hard_config.h |
---|
| 150 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 151 | $(DU) -D $@ > $@.txt |
---|
| 152 | |
---|
| 153 | ##################################################################### |
---|
| 154 | # Rule to generate boot.elf |
---|
| 155 | build/boot.elf: $(BOOT_OBJS) boot.ld |
---|
| 156 | $(LD) -o $@ -T boot.ld $(BOOT_OBJS) |
---|
| 157 | $(DU) -D $@ > $@.txt |
---|