Initial
This commit is contained in:
commit
bd1fe4b2a8
3 changed files with 63 additions and 0 deletions
35
makefile
Normal file
35
makefile
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# Compiler and assembler
|
||||
CC = riscv64-linux-gnu-gcc
|
||||
AS = riscv64-linux-gnu-as
|
||||
LD = riscv64-linux-gnu-ld
|
||||
|
||||
# Flags for compiler and assembler
|
||||
CFLAGS = -static -nostartfiles -nostdlib
|
||||
ASFLAGS =
|
||||
|
||||
# QEMU command and flags
|
||||
QEMU = qemu-riscv64-static
|
||||
QEMU_FLAGS =
|
||||
|
||||
# Assembly source files
|
||||
AS_SRCS := $(wildcard *.s)
|
||||
|
||||
# Object files
|
||||
OBJS := $(AS_SRCS:.s=.o)
|
||||
|
||||
# Default target
|
||||
all: $(OBJS)
|
||||
$(LD) -o program $(OBJS)
|
||||
# $(CC) $(CFLAGS) -o program $(OBJS)
|
||||
|
||||
# Compile assembly sources
|
||||
%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
# Run the program in QEMU
|
||||
run: all
|
||||
$(QEMU) $(QEMU_FLAGS) ./program
|
||||
|
||||
# Clean up
|
||||
clean:
|
||||
rm -f program $(OBJS)
|
||||
Loading…
Add table
Add a link
Reference in a new issue