diff options
| author | vin <git@vineetk.net> | 2025-04-17 16:03:17 -0400 |
|---|---|---|
| committer | vin <git@vineetk.net> | 2025-04-17 16:03:17 -0400 |
| commit | fa0b37e4e90eed92766273e354d6f7b6d01d3554 (patch) | |
| tree | 717f28a93dbc83730832e94eed7e371f5beb5c55 | |
| parent | f267c351b754a8133f4f4a88863a42fc8cb65324 (diff) | |
add makefile to compile C code easier
| -rw-r--r-- | Makefile | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..70e8c94 --- /dev/null +++ b/Makefile | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | CC = riscv32-none-elf-gcc | ||
| 2 | CP = riscv32-none-elf-objcopy | ||
| 3 | CFLAGS = -fno-pic -nostdlib -fno-delete-null-pointer-checks --param=min-pagesize=0 -O3 -march=rv32i -mabi=ilp32 -Wall -Wextra -pedantic | ||
| 4 | |||
| 5 | SRC = fibonacci.c | ||
| 6 | ROM = riscvtest_rom_image.txt | ||
| 7 | |||
| 8 | all: | ||
| 9 | ${CC} ${CFLAGS} ${SRC} | ||
| 10 | ${CP} -j .text -O binary a.out /dev/stdout \ | ||
| 11 | | od -t x4 -w4 - | cut -d' ' -f2 | head -n -1 \ | ||
| 12 | > ${ROM} | ||
| 13 | |||
| 14 | clean: | ||
| 15 | rm -f a.out | ||
