diff options
author | Joursoir <chat@joursoir.net> | 2022-09-29 10:52:00 +0300 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2022-10-07 22:18:32 +0300 |
commit | 9d1dc21b597470a1acb5b512c240c7f27b87b17c (patch) | |
tree | ab59d7377e63e862e62fd156520f36402994b536 /arch/x86/boot/multiboot/Makefile | |
parent | 387c11b9c8baff0e6f1617d80b95a9bbffcdfdf5 (diff) | |
download | mfsos-9d1dc21b597470a1acb5b512c240c7f27b87b17c.tar.gz mfsos-9d1dc21b597470a1acb5b512c240c7f27b87b17c.tar.bz2 mfsos-9d1dc21b597470a1acb5b512c240c7f27b87b17c.zip |
x86/multiboot: add multiboot header
Unfortunately, GNU AS doesn't perform GCC-like preprocessing. So, to
include the multiboot header in the assembly code, we should parse
and format it to GAS-style.
Diffstat (limited to 'arch/x86/boot/multiboot/Makefile')
-rw-r--r-- | arch/x86/boot/multiboot/Makefile | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/x86/boot/multiboot/Makefile b/arch/x86/boot/multiboot/Makefile new file mode 100644 index 0000000..995237d --- /dev/null +++ b/arch/x86/boot/multiboot/Makefile @@ -0,0 +1,25 @@ +# If you want run this makefile immediately, then set environment +# variables (CC, LD, AS, OBJDUMP) to path of your cross-compiler. +# +# The best way to build multiboot header is to run the corresponding +# target in the main Makefile, which is in the root of the +# project (.../path/to/os/Makefile) + +MULTIBOOT_HEADER = $(ARCH_INCLUDE)/multiboot.h +BARE_MULTIBOOT_HEADER = bare_multiboot.h + +.PHONY: all clean + +all: $(BARE_MULTIBOOT_HEADER) + +$(BARE_MULTIBOOT_HEADER): $(MULTIBOOT_HEADER) + $(CC) -E -dM -undef -fsyntax-only $(MULTIBOOT_HEADER) > $(BARE_MULTIBOOT_HEADER) +# Delete all defines that have double underscore + sed -i '/__/d' $(BARE_MULTIBOOT_HEADER) +# Replace "#define" with ".set" on each line + sed -i 's/#define/.set/g' $(BARE_MULTIBOOT_HEADER) +# Put a comma after the macro name + sed -i 's/\>/,/2' $(BARE_MULTIBOOT_HEADER) + +clean: + rm $(BARE_MULTIBOOT_HEADER) |