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