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 | |
---|
41 | # Rule to generate boot.elf, kernel.elf, ksh.elf, sort.elf and update virtual disk. |
---|
42 | compile: dirs \ |
---|
43 | build/boot.elf |
---|
44 | |
---|
45 | # Rule to create the build directories. |
---|
46 | dirs: |
---|
47 | @mkdir -p build |
---|
48 | |
---|
49 | clean: |
---|
50 | rm -rf build |
---|
51 | |
---|
52 | ../../hard_config.h: |
---|
53 | $(MAKE) -C ../../ hard_config.h |
---|
54 | |
---|
55 | ################################################ |
---|
56 | # Rules to compile boot drivers used by boot.elf |
---|
57 | build/boot_tty_driver.o: boot_tty_driver.c \ |
---|
58 | boot_tty_driver.h \ |
---|
59 | boot_utils.h \ |
---|
60 | boot_config.h \ |
---|
61 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
62 | ../../hard_config.h |
---|
63 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
64 | $(DU) -D $@ > $@.txt |
---|
65 | |
---|
66 | build/boot_bdv_driver.o: boot_bdv_driver.c \ |
---|
67 | boot_bdv_driver.h \ |
---|
68 | boot_utils.h \ |
---|
69 | boot_config.h \ |
---|
70 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
71 | ../../hard_config.h |
---|
72 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
73 | $(DU) -D $@ > $@.txt |
---|
74 | |
---|
75 | build/boot_hba_driver.o: boot_hba_driver.c \ |
---|
76 | boot_hba_driver.h \ |
---|
77 | boot_utils.h \ |
---|
78 | boot_config.h \ |
---|
79 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
80 | ../../hard_config.h |
---|
81 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
82 | $(DU) -D $@ > $@.txt |
---|
83 | |
---|
84 | build/boot_mmc_driver.o: boot_mmc_driver.c \ |
---|
85 | boot_mmc_driver.h \ |
---|
86 | boot_utils.h \ |
---|
87 | boot_config.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 | ############################## |
---|
94 | # Rule to compile boot_fat32.o |
---|
95 | build/boot_fat32.o: boot_fat32.c \ |
---|
96 | boot_fat32.h \ |
---|
97 | boot_utils.h \ |
---|
98 | boot_config.h \ |
---|
99 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
100 | ../../hard_config.h |
---|
101 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
102 | $(DU) -D $@ > $@.txt |
---|
103 | |
---|
104 | ############################## |
---|
105 | # Rule to compile boot_utils.o |
---|
106 | build/boot_utils.o: boot_utils.c \ |
---|
107 | boot_utils.h \ |
---|
108 | boot_tty_driver.h \ |
---|
109 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
110 | ../../hard_config.h |
---|
111 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
112 | $(DU) -D $@ > $@.txt |
---|
113 | |
---|
114 | ######################## |
---|
115 | # Rule to compile boot.o |
---|
116 | build/boot.o: boot.c \ |
---|
117 | boot_utils.h \ |
---|
118 | boot_fat32.h \ |
---|
119 | boot_tty_driver.h \ |
---|
120 | boot_hba_driver.h \ |
---|
121 | boot_bdv_driver.h \ |
---|
122 | boot_mmc_driver.h \ |
---|
123 | boot_config.h \ |
---|
124 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
125 | ../../hard_config.h |
---|
126 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) $(MACROS) -c -o $@ $< |
---|
127 | $(DU) -D $@ > $@.txt |
---|
128 | |
---|
129 | ############################## |
---|
130 | # Rule to compile boot_entry.o |
---|
131 | build/boot_entry.o: boot_entry.S \ |
---|
132 | boot_config.h \ |
---|
133 | ../../hard_config.h |
---|
134 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
135 | $(DU) -D $@ > $@.txt |
---|
136 | |
---|
137 | ##################################################################### |
---|
138 | # Rule to generate boot.elf |
---|
139 | build/boot.elf: $(BOOT_OBJS) boot.ld |
---|
140 | $(LD) -o $@ -T boot.ld $(BOOT_OBJS) |
---|
141 | $(DU) -D $@ > $@.txt |
---|