diff options
author | Freya Murphy <freya@freyacat.org> | 2025-03-25 17:36:52 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-03-25 17:38:22 -0400 |
commit | 6af21e6a4f2251e71353562d5df7f376fdffc270 (patch) | |
tree | de20c7afc9878422c81e34f30c6b010075e9e69a /boot/Make.mk | |
download | comus-6af21e6a4f2251e71353562d5df7f376fdffc270.tar.gz comus-6af21e6a4f2251e71353562d5df7f376fdffc270.tar.bz2 comus-6af21e6a4f2251e71353562d5df7f376fdffc270.zip |
initial checkout from wrc
Diffstat (limited to 'boot/Make.mk')
-rw-r--r-- | boot/Make.mk | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/boot/Make.mk b/boot/Make.mk new file mode 100644 index 0000000..a7396fb --- /dev/null +++ b/boot/Make.mk @@ -0,0 +1,43 @@ +# +# Makefile fragment for the bootstrap component of the system. +# +# THIS IS NOT A COMPLETE Makefile - run GNU make in the top-level +# directory, and this will be pulled in automatically. +# + +SUBDIRS += boot + +################### +# FILES SECTION # +################### + +BOOT_SRC := boot/boot.S + +BOOT_OBJ := $(BUILDDIR)/boot/boot.o + +# BLDFLAGS := -Ttext 0x7c00 -s --oformat binary -e bootentry +# BLDFLAGS := -Ttext 0 -s --oformat binary -e bootentry +# BLDFLAGS := -N -Ttext 0x7c00 -s -e bootentry +BLDFLAGS := -N -Ttext 0 -s -e bootentry + +################### +# RULES SECTION # +################### + +bootstrap: $(BUILDDIR)/boot/boot + +$(BUILDDIR)/boot/%.o: boot/%.c $(BUILDDIR)/.vars.CFLAGS + @mkdir -p $(@D) + $(CC) $(CFLAGS) -c -o $@ $< + +$(BUILDDIR)/boot/%.o: boot/%.S $(BUILDDIR)/.vars.CFLAGS + @mkdir -p $(@D) + $(CPP) $(CPPFLAGS) -o $(@D)/$*.s $< + $(AS) $(ASFLAGS) -o $@ $(@D)/$*.s -a=$(@D)/$*.lst + $(RM) -f $(@D)/$*.s + $(NM) -n $@ > $(@D)/$*.sym + +$(BUILDDIR)/boot/boot: $(BOOT_OBJ) + @mkdir -p $(@D) + $(LD) $(LDFLAGS) $(BLDFLAGS) -o $@.out $^ + $(OBJCOPY) -S -O binary -j .text $@.out $@ |