2 28b38de8 2024-02-18 benni .SUFFIXES: .c .S .o .elf
5 52a430f3 2024-02-18 benni PREFIX = /usr/local
6 d83e2c2b 2024-02-19 benni TARGET = riscv64-unknown-linux-musl
7 d83e2c2b 2024-02-19 benni CROSS = ./tools/bin/${TARGET}
9 9c836066 2024-04-07 benni include config.mk
11 3528385d 2024-04-06 benni COPT = -g -O2
12 fd7369d0 2024-06-11 benni CFLAGS = ${CFLAGS_OS} ${COPT} -std=c2x -Wall -Wextra
13 3528385d 2024-04-06 benni LDFLAGS = ${LDFLAGS_OS} -lpthread
15 cd0438ce 2024-07-05 benni OBJ = src/linurv.o src/ecall.o src/cpu.o src/exec.o src/signal.o src/data.o
17 e46639b3 2024-02-20 benni PROGS = examples/test.elf \
18 e46639b3 2024-02-20 benni examples/echo.elf \
19 b4cef989 2024-02-21 benni examples/cat.elf \
20 6bf04703 2024-04-05 benni examples/hello.elf \
21 16107e2e 2024-06-16 benni examples/asm.elf \
22 310548d2 2024-07-06 benni examples/signal.elf \
23 310548d2 2024-07-06 benni examples/true.elf
25 80a2e72f 2024-04-15 benni all: linurv ${PROGS}
28 d81441f0 2024-07-16 benni @echo "CC=${CC}"
29 d81441f0 2024-07-16 benni @echo "CXX=${CXX}"
30 d81441f0 2024-07-16 benni @echo "SUDO=${SUDO}"
31 d81441f0 2024-07-16 benni @echo "CFLAGS=${CFLAGS}"
32 d81441f0 2024-07-16 benni @echo "LDFLAGS=${LDFLAGS}"
33 d81441f0 2024-07-16 benni @echo "CHROOT=${CHROOT}"
35 e46639b3 2024-02-20 benni od: examples/$T.elf
36 e46639b3 2024-02-20 benni ${CROSS}-objdump -d examples/$T.elf | less
39 1e8e3702 2024-07-23 benni ${CROSS}-objdump -d rootfs/bb/bin/busybox | less
41 80a2e72f 2024-04-15 benni run: linurv ${PROGS}
42 e46639b3 2024-02-20 benni mkdir -p rootfs/bin
43 292ece60 2024-07-06 benni cp -f linurv rootfs/bin/
44 292ece60 2024-07-06 benni for f in ${PROGS:.elf=}; do cp -f $$f.elf rootfs/bin/$$(basename "$$f"); done
45 b4cef989 2024-02-21 benni cp -f test.txt rootfs/
46 292ece60 2024-07-06 benni ${CHROOT} rootfs /bin/linurv -v /bin/$T
48 3528385d 2024-04-06 benni distclean: clean
49 3528385d 2024-04-06 benni (cd tools; ${MAKE} distclean)
52 cd0438ce 2024-07-05 benni rm -f linurv src/*.o examples/*.elf *.core src/syscalls.h src/signal-bootstrap-code.h src/sbc.* src/data.[ch]
53 52a430f3 2024-02-18 benni rm -rf rootfs
55 80a2e72f 2024-04-15 benni install: linurv
56 52a430f3 2024-02-18 benni mkdir -p ${DESTDIR}${PREFIX}/bin
57 80a2e72f 2024-04-15 benni cp -f linurv ${DESTDIR}${PREFIX}/bin/
59 80a2e72f 2024-04-15 benni linurv: ${OBJ}
60 28b38de8 2024-02-18 benni ${CC} -o $@ ${OBJ} ${LDFLAGS}
62 764c5620 2024-07-05 benni ${OBJ}: src/linurv.h src/data.h
63 a8ceaca4 2024-02-20 benni src/ecall.o: src/syscalls.h
65 16107e2e 2024-06-16 benni src/cpu.o: src/signal-bootstrap-code.h
67 d68efc51 2024-06-15 benni src/syscalls.h: src/syscalls.inc src/gensyscalls.sh
68 d68efc51 2024-06-15 benni sh src/gensyscalls.sh < src/syscalls.inc > $@
71 28b38de8 2024-02-18 benni ${CC} -c -o $@ $< ${CFLAGS}
73 16107e2e 2024-06-16 benni src/signal-bootstrap-code.h: src/signal-bootstrap-code.S
74 16107e2e 2024-06-16 benni ${CROSS}-as -o src/sbc.o src/signal-bootstrap-code.S
75 16107e2e 2024-06-16 benni ${CROSS}-objcopy -O binary src/sbc.o src/sbc.bin
76 16107e2e 2024-06-16 benni hexdump -v -e '16/1 "0x%02x," "\n"' <src/sbc.bin >$@
77 16107e2e 2024-06-16 benni rm -f src/sbc.*
80 6bf04703 2024-04-05 benni ${CROSS}-gcc -g -o $@ $< -Og
83 6bf04703 2024-04-05 benni ${CROSS}-gcc -g -o $@ $<
85 cd0438ce 2024-07-05 benni src/data.c src/data.h: src/data.dst
86 cd0438ce 2024-07-05 benni (cd src && ../tools/bin/destruct -e little -H data.h -o data.c data.dst)