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 \ |
---|
15 | ../../hard_config.h \ |
---|
16 | dirs \ |
---|
17 | build/boot.elf \ |
---|
18 | |
---|
19 | # Macros to be processed by the C preprocessor. |
---|
20 | MACROS = -DARCHINFO_PATHNAME="\"arch_info.bin\"" \ |
---|
21 | -DKERNEL_PATHNAME="\"/bin/kernel/kernel.elf\"" |
---|
22 | |
---|
23 | # Objects to be linked for boot.elf generation |
---|
24 | BOOT_OBJS = build/boot.o \ |
---|
25 | build/boot_fat32.o \ |
---|
26 | build/boot_utils.o \ |
---|
27 | build/boot_entry.o \ |
---|
28 | build/boot_tty_driver.o \ |
---|
29 | build/boot_hba_driver.o \ |
---|
30 | build/boot_bdv_driver.o \ |
---|
31 | build/boot_mmc_driver.o |
---|
32 | |
---|
33 | # List of directories to be searched for included files |
---|
34 | # when compiling for boot.elf generation |
---|
35 | BOOT_INCLUDE = -I. \ |
---|
36 | -I../../tools/arch_info \ |
---|
37 | -I$(HAL_ARCH)/core \ |
---|
38 | -I../.. \ |
---|
39 | -I$(KERNEL) \ |
---|
40 | -I$(KERNEL)/kern |
---|
41 | |
---|
42 | # Rule to generate boot.elf, kernel.elf, ksh.elf, sort.elf and update virtual disk. |
---|
43 | compile: dirs \ |
---|
44 | build/boot.elf |
---|
45 | |
---|
46 | # Rule to create the build directories. |
---|
47 | dirs: |
---|
48 | @mkdir -p build |
---|
49 | |
---|
50 | clean: |
---|
51 | rm -rf build |
---|
52 | |
---|
53 | ../../hard_config.h: |
---|
54 | $(MAKE) -C ../../ hard_config.h |
---|
55 | |
---|
56 | ################################################ |
---|
57 | # Rules to compile boot drivers used by boot.elf |
---|
58 | build/boot_tty_driver.o: boot_tty_driver.c \ |
---|
59 | boot_tty_driver.h \ |
---|
60 | boot_utils.h \ |
---|
61 | boot_config.h \ |
---|
62 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
63 | ../../hard_config.h |
---|
64 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
65 | $(DU) -D $@ > $@.txt |
---|
66 | |
---|
67 | build/boot_bdv_driver.o: boot_bdv_driver.c \ |
---|
68 | boot_bdv_driver.h \ |
---|
69 | boot_utils.h \ |
---|
70 | boot_config.h \ |
---|
71 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
72 | ../../hard_config.h |
---|
73 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
74 | $(DU) -D $@ > $@.txt |
---|
75 | |
---|
76 | build/boot_hba_driver.o: boot_hba_driver.c \ |
---|
77 | boot_hba_driver.h \ |
---|
78 | boot_utils.h \ |
---|
79 | boot_config.h \ |
---|
80 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
81 | ../../hard_config.h |
---|
82 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
83 | $(DU) -D $@ > $@.txt |
---|
84 | |
---|
85 | build/boot_spi_driver.o: boot_spi_driver.c \ |
---|
86 | boot_spi_driver.h \ |
---|
87 | boot_utils.h \ |
---|
88 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
89 | ../../hard_config.h |
---|
90 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
91 | $(DU) -D $@ > $@.txt |
---|
92 | |
---|
93 | build/boot_mmc_driver.o: boot_mmc_driver.c \ |
---|
94 | boot_mmc_driver.h \ |
---|
95 | boot_utils.h \ |
---|
96 | boot_config.h \ |
---|
97 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
98 | ../../hard_config.h |
---|
99 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
100 | $(DU) -D $@ > $@.txt |
---|
101 | |
---|
102 | ############################## |
---|
103 | # Rule to compile boot_spi_utils.o |
---|
104 | build/boot_spi_utils.o: boot_spi_utils.c \ |
---|
105 | boot_spi_utils.h \ |
---|
106 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
107 | ../../hard_config.h |
---|
108 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
109 | $(DU) -D $@ > $@.txt |
---|
110 | |
---|
111 | ############################## |
---|
112 | # Rule to compile boot_fat32.o |
---|
113 | build/boot_fat32.o: boot_fat32.c \ |
---|
114 | boot_fat32.h \ |
---|
115 | boot_utils.h \ |
---|
116 | boot_config.h \ |
---|
117 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
118 | ../../hard_config.h |
---|
119 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
120 | $(DU) -D $@ > $@.txt |
---|
121 | |
---|
122 | ############################## |
---|
123 | # Rule to compile boot_utils.o |
---|
124 | build/boot_utils.o: boot_utils.c \ |
---|
125 | boot_utils.h \ |
---|
126 | boot_tty_driver.h \ |
---|
127 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
128 | ../../hard_config.h |
---|
129 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
130 | $(DU) -D $@ > $@.txt |
---|
131 | |
---|
132 | ######################## |
---|
133 | # Rule to compile boot.o |
---|
134 | build/boot.o: boot.c \ |
---|
135 | boot_utils.h \ |
---|
136 | boot_spi_utils.h \ |
---|
137 | boot_fat32.h \ |
---|
138 | boot_tty_driver.h \ |
---|
139 | boot_hba_driver.h \ |
---|
140 | boot_bdv_driver.h \ |
---|
141 | boot_mmc_driver.h \ |
---|
142 | boot_spi_driver.h \ |
---|
143 | boot_config.h \ |
---|
144 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
145 | ../../hard_config.h |
---|
146 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) $(MACROS) -c -o $@ $< |
---|
147 | $(DU) -D $@ > $@.txt |
---|
148 | |
---|
149 | ############################## |
---|
150 | # Rule to compile boot_entry.o |
---|
151 | build/boot_entry.o: boot_entry.S \ |
---|
152 | boot_config.h \ |
---|
153 | ../../hard_config.h |
---|
154 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
155 | $(DU) -D $@ > $@.txt |
---|
156 | |
---|
157 | ##################################################################### |
---|
158 | # Rule to generate boot.elf |
---|
159 | build/boot.elf: $(BOOT_OBJS) boot.ld |
---|
160 | $(LD) -o $@ -T boot.ld $(BOOT_OBJS) |
---|
161 | $(DU) -D $@ > $@.txt |
---|