summaryrefslogtreecommitdiff
path: root/website-initramfs/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'website-initramfs/Makefile')
-rw-r--r--website-initramfs/Makefile39
1 files changed, 39 insertions, 0 deletions
diff --git a/website-initramfs/Makefile b/website-initramfs/Makefile
new file mode 100644
index 0000000..57d303b
--- /dev/null
+++ b/website-initramfs/Makefile
@@ -0,0 +1,39 @@
+CC = clang
+LD = ld.lld
+OBJCOPY = llvm-objcopy
+
+CFLAGS = \
+ --target=riscv32-unknown-elf \
+ -march=rv32im_zicsr \
+ -mabi=ilp32 \
+ -ffreestanding \
+ -fno-builtin \
+ -nostdlib \
+ -nostdinc \
+ -nodefaultlibs \
+ -O2 -g3 \
+ -Wall -Wextra -Werror -Wundef
+
+C_SRCS = $(shell find progs -type f -name "*.c")
+S_SRCS = $(shell find progs -type f -name "*.S")
+SRCS = $(C_SRCS) $(S_SRCS)
+OBJS = $(basename $(SRCS))
+
+$(V).SILENT:
+progs: $(OBJS)
+
+%: %.c
+ @echo " CC $<"
+ $(CC) $(CFLAGS) $< -o $@
+%: %.S
+ @echo " AS $<"
+ $(CC) $(CFLAGS) -fuse-ld=lld $< -o $@
+
+.PHONY: progs mkinitrd all clean
+mkinitrd:
+ @echo " MKINITRD"
+ find . -print0 | cpio --null -ov -H newc > initramfs.cpio
+clean:
+ @echo " CLEAN $(OBJS) initramfs.cpio"
+ $(RM) -f $(OBJS) initramfs.cpio
+all: progs mkinitrd