#!/bin/bash # # Usage: # ./run.sh set -o nounset set -o errexit # Wow, this thing is fucking awesome. count() { # Wow, only 7406 lines C! 7872 C + asm + perl. # NOTE: # - usertests.c is biggest file! # - vectors.S generated by vectors.pl ls *.c *.h *.S *.pl | grep -v usertests.c | grep -v vectors.S | xargs wc -l } build() { # Compiles in 3.8 s! Wow! time make } run() { # somehow on Ubuntu Precise, it can't find qemu. make qemu QEMU=qemu-system-i386 } # build it for the host system build-sh2() { gcc -v -o sh2_ sh2.c # it's linked against our libc... yeah I guess that's what I want. But how # does it even get "printf" definition? Oh I guess default link is against # libc. #ldd sh2_ #nm sh2_ } sh2() { build-sh2 time ./sh2_ } # TODO: # - figure out how to statically link sh2 with the host? It just needs # syscalls. but those are different I guess. # ulib.c is odd. # - find out where the hell printf is. You have to understand the build # process. host-demo() { gcc -o host-demo host-demo.c ./host-demo } trace-build() { make clean echo '----- sh.o' make sh.o # Make just this binary, swee what it's doing echo '----- _sh' make _sh # NOTES: # ld action comes from rule _%: %.o $(ULIB) # # There is a default rule in make to build foo.o: # $(CC) $(CFLAGS) -o foo.o foo.c # So the makefile just has to set CFLAGS. } "$@"