blob: b570f08dfc3ee4eb3d8a328c42983f2f6197e12c (
plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
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 mvprogs mkinitrd all clean
mvprogs:
@echo " MVPROGS"
./mvprogs.sh progtab
mkinitrd:
@echo " MKINITRD"
cat ziptab | cpio -ov -H newc > initramfs.cpio
clean:
@echo " CLEAN $(OBJS) initramfs.cpio"
$(RM) -f $(OBJS) initramfs.cpio
@echo " CLEAN ziptab"
xargs $(RM) -rf <ziptab
all: progs mvprogs mkinitrd
|