[26] | 1 | ############################################################################# |
---|
[27] | 2 | # ALMOS-MKH Makefile for x86_64 # |
---|
[26] | 3 | ############################################################################# |
---|
| 4 | |
---|
| 5 | -include params.mk |
---|
| 6 | |
---|
| 7 | # Compilation flags. |
---|
| 8 | CFLAGS = -Wall -ffreestanding -mno-red-zone -mno-mmx -mno-sse -mno-avx -g \ |
---|
[47] | 9 | -fno-delete-null-pointer-checks -mcmodel=large |
---|
[26] | 10 | |
---|
| 11 | # Export all variables to applications sub-Makefile. |
---|
[27] | 12 | export |
---|
[26] | 13 | CC = gcc |
---|
| 14 | AS = as |
---|
| 15 | LD = ld |
---|
| 16 | DU = objdump |
---|
| 17 | AR = ar |
---|
| 18 | |
---|
| 19 | |
---|
[27] | 20 | # Rules that don't build target files |
---|
[26] | 21 | # always out-of-date, need to be regenerated everytime they are called |
---|
| 22 | .PHONY: compile \ |
---|
| 23 | dirs \ |
---|
| 24 | list \ |
---|
| 25 | extract \ |
---|
| 26 | fsck \ |
---|
| 27 | clean \ |
---|
| 28 | build-disk \ |
---|
| 29 | build/kernel/kernel.elf |
---|
| 30 | |
---|
[27] | 31 | # Objects to be linked for the soclib drivers library |
---|
[26] | 32 | DRIVERS_OBJS = build/kernel/drivers/soclib_tty.o \ |
---|
| 33 | build/kernel/drivers/soclib_bdv.o \ |
---|
| 34 | build/kernel/drivers/soclib_hba.o \ |
---|
| 35 | build/kernel/drivers/soclib_mmc.o \ |
---|
| 36 | build/kernel/drivers/soclib_xcu.o \ |
---|
| 37 | build/kernel/drivers/soclib_pic.o \ |
---|
| 38 | build/kernel/drivers/soclib_nic.o \ |
---|
| 39 | build/kernel/drivers/soclib_dma.o \ |
---|
| 40 | build/kernel/drivers/soclib_iob.o |
---|
| 41 | |
---|
[27] | 42 | # Objects to be linked for kernel.elf generation |
---|
[26] | 43 | KERN_OBJS = build/kernel/kern/kernel_init.o \ |
---|
| 44 | build/kernel/kern/printk.o \ |
---|
| 45 | build/kernel/kern/thread.o \ |
---|
| 46 | build/kernel/kern/process.o \ |
---|
| 47 | build/kernel/kern/chdev.o \ |
---|
| 48 | build/kernel/kern/cluster.o \ |
---|
| 49 | build/kernel/kern/scheduler.o \ |
---|
| 50 | build/kernel/kern/core.o \ |
---|
| 51 | build/kernel/kern/dqdt.o \ |
---|
| 52 | build/kernel/kern/do_syscall.o \ |
---|
| 53 | build/kernel/kern/do_interrupt.o \ |
---|
| 54 | build/kernel/kern/do_exception.o \ |
---|
| 55 | build/kernel/kern/rpc.o \ |
---|
| 56 | build/kernel/kern/signal.o |
---|
| 57 | |
---|
| 58 | HAL_OBJS = \ |
---|
| 59 | build/kernel/hal/hal_boot.o \ |
---|
[30] | 60 | build/kernel/hal/hal_init.o \ |
---|
| 61 | build/kernel/hal/hal_cpu.o \ |
---|
| 62 | build/kernel/hal/hal_trap.o \ |
---|
| 63 | build/kernel/hal/hal_kentry.o \ |
---|
[36] | 64 | build/kernel/hal/hal_acpi.o \ |
---|
[45] | 65 | build/kernel/hal/hal_lapic.o \ |
---|
[30] | 66 | build/kernel/hal/x86_printf.o \ |
---|
[26] | 67 | build/kernel/hal/hal_special.o \ |
---|
| 68 | build/kernel/hal/hal_context.o \ |
---|
| 69 | build/kernel/hal/hal_atomic.o \ |
---|
| 70 | build/kernel/hal/hal_remote.o \ |
---|
| 71 | build/kernel/hal/hal_uspace.o \ |
---|
| 72 | build/kernel/hal/hal_irqmask.o \ |
---|
| 73 | build/kernel/hal/hal_gpt.o \ |
---|
[54] | 74 | build/kernel/hal/hal_ppm.o \ |
---|
[26] | 75 | build/kernel/hal/hal_exception.o \ |
---|
| 76 | build/kernel/hal/hal_interrupt.o \ |
---|
[30] | 77 | build/kernel/hal/hal_syscall.o |
---|
[26] | 78 | |
---|
| 79 | DEV_OBJS = build/kernel/devices/dev_txt.o \ |
---|
| 80 | build/kernel/devices/dev_ioc.o \ |
---|
| 81 | build/kernel/devices/dev_icu.o \ |
---|
| 82 | build/kernel/devices/dev_mmc.o \ |
---|
| 83 | build/kernel/devices/dev_nic.o \ |
---|
| 84 | build/kernel/devices/dev_pic.o \ |
---|
| 85 | build/kernel/devices/dev_dma.o \ |
---|
| 86 | build/kernel/devices/dev_fbf.o \ |
---|
[27] | 87 | build/kernel/devices/dev_iob.o |
---|
[26] | 88 | |
---|
| 89 | MM_OBJS = build/kernel/mm/ppm.o \ |
---|
| 90 | build/kernel/mm/vmm.o \ |
---|
| 91 | build/kernel/mm/vseg.o \ |
---|
| 92 | build/kernel/mm/page.o \ |
---|
| 93 | build/kernel/mm/kcm.o \ |
---|
| 94 | build/kernel/mm/khm.o \ |
---|
| 95 | build/kernel/mm/mapper.o \ |
---|
| 96 | build/kernel/mm/kmem.o |
---|
| 97 | |
---|
| 98 | LIBK_OBJS = build/kernel/libk/grdxt.o \ |
---|
| 99 | build/kernel/libk/bits.o \ |
---|
| 100 | build/kernel/libk/elf.o \ |
---|
| 101 | build/kernel/libk/string.o \ |
---|
| 102 | build/kernel/libk/ctype.o \ |
---|
| 103 | build/kernel/libk/rwlock.o \ |
---|
| 104 | build/kernel/libk/spinlock.o \ |
---|
| 105 | build/kernel/libk/barrier.o \ |
---|
| 106 | build/kernel/libk/remote_barrier.o \ |
---|
| 107 | build/kernel/libk/remote_spinlock.o \ |
---|
| 108 | build/kernel/libk/remote_rwlock.o \ |
---|
| 109 | build/kernel/libk/remote_fifo.o \ |
---|
| 110 | build/kernel/libk/remote_mutex.o \ |
---|
| 111 | build/kernel/libk/remote_sem.o \ |
---|
| 112 | build/kernel/libk/remote_condvar.o \ |
---|
| 113 | build/kernel/libk/memcpy.o \ |
---|
| 114 | build/kernel/libk/htab.o \ |
---|
| 115 | build/kernel/libk/xhtab.o |
---|
| 116 | |
---|
| 117 | SYS_OBJS_0 = build/kernel/syscalls/sys_thread_exit.o \ |
---|
| 118 | build/kernel/syscalls/sys_mmap.o \ |
---|
| 119 | build/kernel/syscalls/sys_thread_create.o \ |
---|
| 120 | build/kernel/syscalls/sys_thread_join.o \ |
---|
| 121 | build/kernel/syscalls/sys_thread_detach.o \ |
---|
| 122 | build/kernel/syscalls/sys_thread_yield.o \ |
---|
| 123 | build/kernel/syscalls/sys_sem.o \ |
---|
| 124 | build/kernel/syscalls/sys_condvar.o \ |
---|
| 125 | build/kernel/syscalls/sys_barrier.o \ |
---|
| 126 | build/kernel/syscalls/sys_mutex.o |
---|
| 127 | |
---|
| 128 | SYS_OBJS_1 = build/kernel/syscalls/sys_thread_sleep.o \ |
---|
| 129 | build/kernel/syscalls/sys_thread_wakeup.o \ |
---|
| 130 | build/kernel/syscalls/sys_open.o \ |
---|
| 131 | build/kernel/syscalls/sys_creat.o \ |
---|
| 132 | build/kernel/syscalls/sys_read.o \ |
---|
| 133 | build/kernel/syscalls/sys_write.o \ |
---|
| 134 | build/kernel/syscalls/sys_lseek.o \ |
---|
| 135 | build/kernel/syscalls/sys_close.o \ |
---|
| 136 | build/kernel/syscalls/sys_unlink.o \ |
---|
| 137 | build/kernel/syscalls/sys_pipe.o |
---|
| 138 | |
---|
| 139 | SYS_OBJS_2 = build/kernel/syscalls/sys_chdir.o \ |
---|
| 140 | build/kernel/syscalls/sys_mkdir.o \ |
---|
| 141 | build/kernel/syscalls/sys_mkfifo.o \ |
---|
| 142 | build/kernel/syscalls/sys_opendir.o \ |
---|
| 143 | build/kernel/syscalls/sys_readdir.o \ |
---|
| 144 | build/kernel/syscalls/sys_closedir.o \ |
---|
| 145 | build/kernel/syscalls/sys_getcwd.o \ |
---|
| 146 | build/kernel/syscalls/sys_clock.o \ |
---|
| 147 | build/kernel/syscalls/sys_alarm.o \ |
---|
[27] | 148 | build/kernel/syscalls/sys_rmdir.o |
---|
[26] | 149 | |
---|
| 150 | SYS_OBJS_3 = build/kernel/syscalls/sys_utls.o \ |
---|
| 151 | build/kernel/syscalls/sys_chmod.o \ |
---|
| 152 | build/kernel/syscalls/sys_signal.o \ |
---|
[54] | 153 | build/kernel/syscalls/sys_timeofday.o \ |
---|
[26] | 154 | build/kernel/syscalls/sys_kill.o \ |
---|
| 155 | build/kernel/syscalls/sys_getpid.o \ |
---|
| 156 | build/kernel/syscalls/sys_fork.o \ |
---|
| 157 | build/kernel/syscalls/sys_exec.o \ |
---|
| 158 | build/kernel/syscalls/sys_stat.o \ |
---|
[27] | 159 | build/kernel/syscalls/sys_trace.o |
---|
[26] | 160 | |
---|
| 161 | SYS_OBJS_4 = build/kernel/syscalls/sys_madvise.o \ |
---|
| 162 | build/kernel/syscalls/sys_mcntl.o \ |
---|
| 163 | build/kernel/syscalls/sys_stat.o \ |
---|
| 164 | build/kernel/syscalls/sys_thread_migrate.o \ |
---|
| 165 | build/kernel/syscalls/sys_sbrk.o \ |
---|
| 166 | build/kernel/syscalls/sys_rmdir.o \ |
---|
| 167 | build/kernel/syscalls/sys_ftime.o \ |
---|
| 168 | build/kernel/syscalls/sys_chmod.o \ |
---|
| 169 | build/kernel/syscalls/sys_fsync.o \ |
---|
| 170 | build/kernel/syscalls/sys_gettimeofday.o |
---|
| 171 | |
---|
[27] | 172 | SYS_OBJS_5 = build/kernel/syscalls/sys_times.o |
---|
[26] | 173 | |
---|
| 174 | |
---|
| 175 | VFS_OBJS = build/kernel/vfs/vfs.o \ |
---|
| 176 | build/kernel/vfs/fatfs.o \ |
---|
| 177 | build/kernel/vfs/devfs.o \ |
---|
| 178 | build/kernel/vfs/ramfs.o |
---|
| 179 | |
---|
| 180 | # List of directories to be searched for included files |
---|
[27] | 181 | # when compiling for kernel.elf generation |
---|
[26] | 182 | KERNEL_INCLUDE = -Ikernel \ |
---|
| 183 | -Ikernel/kern \ |
---|
| 184 | -Ikernel/devices \ |
---|
| 185 | -Ikernel/syscalls \ |
---|
| 186 | -Ikernel/drivers/soclib \ |
---|
| 187 | -Ikernel/syscalls \ |
---|
| 188 | -Ikernel/libk \ |
---|
| 189 | -Ikernel/mm \ |
---|
| 190 | -Ikernel/vfs \ |
---|
| 191 | -Ikernel/fatfs \ |
---|
| 192 | -Ikernel/sysfs \ |
---|
| 193 | -Ikernel/ramfs \ |
---|
| 194 | -Ikernel/devfs \ |
---|
| 195 | -Itools/arch_info \ |
---|
| 196 | -Ihal/generic \ |
---|
[51] | 197 | -Ihal/x86_64/core \ |
---|
[26] | 198 | -I. |
---|
| 199 | |
---|
| 200 | # Macros to be processed by the C preprocessor. |
---|
| 201 | MACROS = -DARCHINFO_PATHNAME="\"arch_info.bin\"" \ |
---|
| 202 | -DKERNEL_PATHNAME="\"/bin/kernel/kernel.elf\"" |
---|
| 203 | |
---|
| 204 | # Virtual disk path |
---|
| 205 | DISK_IMAGE := hdd/virt_hdd.dmg |
---|
| 206 | |
---|
| 207 | # The Mtools used to build the FAT32 disk image perfom a few sanity checks, to |
---|
| 208 | # make sure that the disk is indeed an MS-DOS disk. However, the size of the |
---|
[27] | 209 | # disk image used by ALMOS-VM is not MS-DOS compliant. |
---|
[26] | 210 | # Setting this variable prevents these checks. |
---|
| 211 | MTOOLS_SKIP_CHECK := 1 |
---|
| 212 | |
---|
| 213 | # Rule to compile kernel.elf, and update virtual disk. |
---|
| 214 | compile: dirs \ |
---|
| 215 | hard_config.h \ |
---|
| 216 | build/kernel/kernel.elf \ |
---|
| 217 | list |
---|
| 218 | |
---|
| 219 | # Rule to create the build directories. |
---|
| 220 | dirs: |
---|
| 221 | @mkdir -p build/kernel |
---|
| 222 | @mkdir -p build/kernel/kern |
---|
| 223 | @mkdir -p build/kernel/hal |
---|
| 224 | @mkdir -p build/kernel/devices |
---|
| 225 | @mkdir -p build/kernel/mm |
---|
| 226 | @mkdir -p build/kernel/libk |
---|
| 227 | @mkdir -p build/kernel/drivers |
---|
[27] | 228 | @mkdir -p build/kernel/vfs |
---|
[26] | 229 | @mkdir -p build/kernel/syscalls |
---|
| 230 | @mkdir -p hdd |
---|
| 231 | |
---|
| 232 | # Rule to make a recursive list of the virtual disk content. |
---|
| 233 | list: |
---|
| 234 | mdir -/ -w -i $(DISK_IMAGE) ::/ |
---|
| 235 | |
---|
| 236 | # Rule to make a file system check for the virtual disk. |
---|
| 237 | fsck: |
---|
| 238 | fsck.msdos $(DISK_IMAGE) |
---|
| 239 | |
---|
| 240 | ############################################################## |
---|
[27] | 241 | # Rule to copy the files generated by the virtual prototype |
---|
[26] | 242 | # from the virtual disk 'home' directory to the current directory. |
---|
| 243 | extract: |
---|
| 244 | mcopy -o -i $(DISK_IMAGE) ::/home . |
---|
| 245 | |
---|
[27] | 246 | # Rules to delete all binary files from Unix File System |
---|
[26] | 247 | # without modifying the virtual disk. |
---|
| 248 | clean: |
---|
| 249 | rm -f *.o *.elf *.bin *.txt core |
---|
| 250 | rm -f hard_config.h |
---|
| 251 | rm -rf build |
---|
| 252 | |
---|
| 253 | #################################################### |
---|
| 254 | # Rule for building a new virtual disk from scratch. |
---|
| 255 | # It creates the bin / home directories. |
---|
| 256 | # This requires the generic Linux/MacOS 'create_dmg' script, that should be |
---|
| 257 | # placed in the same directory as this Makefile. |
---|
| 258 | build-disk: |
---|
| 259 | rm -f $(DISK_IMAGE) |
---|
| 260 | ./create_dmg create $(basename $(DISK_IMAGE)) |
---|
| 261 | dd if=$(DISK_IMAGE) of=temp.dmg count=65536 |
---|
| 262 | mv temp.dmg $(DISK_IMAGE) |
---|
| 263 | mmd -o -i $(DISK_IMAGE) ::/bin || true |
---|
| 264 | mmd -o -i $(DISK_IMAGE) ::/bin/kernel || true |
---|
| 265 | mmd -o -i $(DISK_IMAGE) ::/home || true |
---|
| 266 | mdir -/ -b -i $(DISK_IMAGE) ::/ |
---|
| 267 | |
---|
| 268 | ############################################################## |
---|
| 269 | # Rules to generate hardware description files (hard_config.h, |
---|
| 270 | # arch_info.bin and arch_info.xml), and update the virtual disk. |
---|
| 271 | hard_config.h: |
---|
| 272 | echo "!!! UNUSED !!!" # XXX: cleanup later |
---|
| 273 | |
---|
| 274 | |
---|
| 275 | ############################## |
---|
[27] | 276 | # rules to compile the drivers |
---|
[26] | 277 | build/kernel/drivers/%.o: kernel/drivers/soclib/%.c \ |
---|
| 278 | kernel/drivers/soclib/%.h \ |
---|
| 279 | kernel_config.h \ |
---|
[51] | 280 | hal/x86_64/core/hal_types.h |
---|
[26] | 281 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 282 | $(DU) -D $@ > $@.txt |
---|
| 283 | |
---|
| 284 | ####################################### |
---|
| 285 | # Rules to generate kernel/kern objects |
---|
| 286 | build/kernel/kern/%.o: kernel/kern/%.c \ |
---|
| 287 | kernel/kern/%.h \ |
---|
| 288 | kernel_config.h \ |
---|
[51] | 289 | hal/x86_64/core/hal_types.h |
---|
[26] | 290 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 291 | $(DU) -D $@ > $@.txt |
---|
| 292 | |
---|
| 293 | ###################################### |
---|
| 294 | # Rules to generate kernel/hal objects |
---|
[51] | 295 | build/kernel/hal/%.o: hal/x86_64/core/%.c \ |
---|
[26] | 296 | hal/generic/%.h \ |
---|
| 297 | kernel_config.h \ |
---|
[51] | 298 | hal/x86_64/core/hal_types.h |
---|
[26] | 299 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 300 | $(DU) -D $@ > $@.txt |
---|
| 301 | |
---|
[51] | 302 | build/kernel/hal/hal_boot.o: hal/x86_64/core/hal_boot.S \ |
---|
| 303 | hal/x86_64/core/hal_boot.h \ |
---|
| 304 | hal/x86_64/core/hal_multiboot.h \ |
---|
| 305 | hal/x86_64/core/hal_segmentation.h \ |
---|
[26] | 306 | kernel_config.h \ |
---|
[51] | 307 | hal/x86_64/core/hal_types.h |
---|
[26] | 308 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 309 | $(DU) -D $@ > $@.txt |
---|
| 310 | |
---|
[51] | 311 | build/kernel/hal/hal_init.o: hal/x86_64/core/hal_init.c \ |
---|
| 312 | hal/x86_64/core/hal_boot.h \ |
---|
| 313 | hal/x86_64/core/hal_multiboot.h \ |
---|
| 314 | hal/x86_64/core/hal_segmentation.h \ |
---|
| 315 | hal/x86_64/core/hal_acpi.h \ |
---|
| 316 | hal/x86_64/core/hal_lapic.h \ |
---|
| 317 | hal/x86_64/core/hal_internal.h \ |
---|
[45] | 318 | kernel_config.h \ |
---|
[51] | 319 | hal/x86_64/core/hal_types.h |
---|
[26] | 320 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 321 | $(DU) -D $@ > $@.txt |
---|
| 322 | |
---|
[51] | 323 | build/kernel/hal/hal_cpu.o: hal/x86_64/core/hal_cpu.S \ |
---|
| 324 | hal/x86_64/core/hal_boot.h \ |
---|
| 325 | hal/x86_64/core/hal_segmentation.h \ |
---|
[30] | 326 | kernel_config.h \ |
---|
[51] | 327 | hal/x86_64/core/hal_types.h |
---|
[30] | 328 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 329 | $(DU) -D $@ > $@.txt |
---|
| 330 | |
---|
[51] | 331 | build/kernel/hal/hal_trap.o: hal/x86_64/core/hal_trap.c \ |
---|
| 332 | hal/x86_64/core/hal_boot.h \ |
---|
| 333 | hal/x86_64/core/hal_segmentation.h \ |
---|
[30] | 334 | kernel_config.h \ |
---|
[51] | 335 | hal/x86_64/core/hal_types.h |
---|
[30] | 336 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 337 | $(DU) -D $@ > $@.txt |
---|
| 338 | |
---|
[51] | 339 | build/kernel/hal/hal_kentry.o: hal/x86_64/core/hal_kentry.S \ |
---|
| 340 | hal/x86_64/core/hal_kentry.h \ |
---|
| 341 | hal/x86_64/core/hal_boot.h \ |
---|
[30] | 342 | kernel_config.h \ |
---|
[51] | 343 | hal/x86_64/core/hal_types.h |
---|
[30] | 344 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 345 | $(DU) -D $@ > $@.txt |
---|
| 346 | |
---|
[51] | 347 | build/kernel/hal/hal_acpi.o: hal/x86_64/core/hal_acpi.c \ |
---|
| 348 | hal/x86_64/core/hal_acpi.h \ |
---|
[36] | 349 | kernel_config.h \ |
---|
[51] | 350 | hal/x86_64/core/hal_types.h |
---|
[36] | 351 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 352 | $(DU) -D $@ > $@.txt |
---|
| 353 | |
---|
[51] | 354 | build/kernel/hal/hal_lapic.o: hal/x86_64/core/hal_lapic.c \ |
---|
| 355 | hal/x86_64/core/hal_lapic.h \ |
---|
[45] | 356 | kernel_config.h \ |
---|
[51] | 357 | hal/x86_64/core/hal_types.h |
---|
[45] | 358 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 359 | $(DU) -D $@ > $@.txt |
---|
| 360 | |
---|
[51] | 361 | build/kernel/hal/x86_printf.o: hal/x86_64/core/x86_printf.c \ |
---|
[30] | 362 | kernel_config.h \ |
---|
[51] | 363 | hal/x86_64/core/hal_types.h |
---|
[30] | 364 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 365 | $(DU) -D $@ > $@.txt |
---|
| 366 | |
---|
[26] | 367 | ###################################### |
---|
| 368 | # Rules to generate kernel/dev objects |
---|
| 369 | build/kernel/devices/%.o: kernel/devices/%.c \ |
---|
| 370 | kernel/devices/%.h \ |
---|
| 371 | kernel_config.h \ |
---|
[51] | 372 | hal/x86_64/core/hal_types.h |
---|
[26] | 373 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 374 | $(DU) -D $@ > $@.txt |
---|
| 375 | |
---|
| 376 | ##################################### |
---|
| 377 | # Rules to generate kernel/mm objects |
---|
| 378 | build/kernel/mm/%.o: kernel/mm/%.c \ |
---|
| 379 | kernel/mm/%.h \ |
---|
| 380 | kernel_config.h \ |
---|
[51] | 381 | hal/x86_64/core/hal_types.h |
---|
[26] | 382 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 383 | $(DU) -D $@ > $@.txt |
---|
| 384 | |
---|
| 385 | ####################################### |
---|
| 386 | # Rules to generate kernel/libk objects |
---|
| 387 | build/kernel/libk/%.o: kernel/libk/%.c \ |
---|
| 388 | kernel/libk/%.h \ |
---|
| 389 | kernel_config.h \ |
---|
[51] | 390 | hal/x86_64/core/hal_types.h |
---|
[26] | 391 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 392 | $(DU) -D $@ > $@.txt |
---|
| 393 | |
---|
| 394 | ########################################### |
---|
| 395 | # Rules to generate kernel/syscalls objects |
---|
| 396 | build/kernel/syscalls/%.o: kernel/syscalls/%.c \ |
---|
| 397 | kernel/syscalls/syscalls.h \ |
---|
| 398 | kernel_config.h \ |
---|
[51] | 399 | hal/x86_64/core/hal_types.h |
---|
[26] | 400 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 401 | $(DU) -D $@ > $@.txt |
---|
| 402 | |
---|
| 403 | ####################################### |
---|
| 404 | # Rules to generate kernel/vfs objects |
---|
| 405 | build/kernel/vfs/%.o: kernel/vfs/%.c \ |
---|
| 406 | kernel/vfs/%.h \ |
---|
| 407 | kernel_config.h \ |
---|
[51] | 408 | hal/x86_64/core/hal_types.h |
---|
[26] | 409 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 410 | $(DU) -D $@ > $@.txt |
---|
| 411 | |
---|
| 412 | ########################################################### |
---|
| 413 | # Rule to generate kernel.elf and place it on virtual disk |
---|
| 414 | build/kernel/kernel.elf: $(KERN_OBJS) \ |
---|
| 415 | $(HAL_OBJS) \ |
---|
| 416 | $(DEV_OBJS) \ |
---|
| 417 | $(MM_OBJS) \ |
---|
| 418 | $(LIBK_OBJS) \ |
---|
| 419 | $(DRIVERS_OBJS) \ |
---|
| 420 | $(VFS_OBJS) \ |
---|
| 421 | $(SYS_OBJS_0) \ |
---|
| 422 | $(SYS_OBJS_1) \ |
---|
| 423 | $(SYS_OBJS_2) \ |
---|
| 424 | $(SYS_OBJS_3) \ |
---|
[30] | 425 | kernel/kernel_x86.ld |
---|
| 426 | $(LD) -o $@ -z max-page-size=0x1000 -T kernel/kernel_x86.ld \ |
---|
[26] | 427 | $(KERN_OBJS) $(HAL_OBJS) $(DEV_OBJS) $(MM_OBJS) \ |
---|
| 428 | $(LIBK_OBJS) $(DRIVERS_OBJS) $(VFS_OBJS) \ |
---|
| 429 | $(SYS_OBJS_0) $(SYS_OBJS_1) $(SYS_OBJS_2) \ |
---|
| 430 | $(SYS_OBJS_3) |
---|
| 431 | |
---|
[27] | 432 | |
---|
[26] | 433 | # $(SYS_OBJS_4) $(SYS_OBJS_5) |
---|
[27] | 434 | |
---|
[26] | 435 | $(DU) -D $@ > $@.txt |
---|
| 436 | mcopy -o -i $(DISK_IMAGE) build/kernel/kernel.elf ::/bin/kernel |
---|
| 437 | |
---|