-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
30 lines (21 loc) · 785 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
include filesystem/Makefile
arch ?= i686
target := $(arch)-os
rust_os := target/$(target)/debug/libsos.a
assembly_source_files := $(wildcard src/arch/*.asm)
assembly_object_files := $(patsubst src/arch/%.asm, build/arch/%.o, $(assembly_source_files))
kernel := build/kernel.bin
.PHONY: clean xargo head filesystem
head: $(kernel)
@mkdir -p build
@nasm -f bin -o build/head.bin -i bootloader/ bootloader/src/bootloader.asm
$(kernel): xargo $(rust_os) $(assembly_object_files)
@$(LD) -n --gc-sections -m elf_i386 -T linker.ld -o $@ $(assembly_object_files) $(rust_os)
xargo:
@export RUST_TARGET_PATH=$(shell pwd); xargo build --target $(target)
clean: clean-filesystem
@xargo clean
@rm -r build
build/arch/%.o: src/arch/%.asm
@mkdir -p $(dir $@)
@nasm -f elf32 -o $@ $<