harec

[hare] Hare compiler, written in C11 for POSIX OSs
Log | Files | Refs | README | LICENSE

configure (1495B)


      1 #!/bin/sh
      2 all="$all rt"
      3 
      4 rt() {
      5 	arch=$(uname -m)
      6 	case $(uname) in
      7 		Linux)
      8 			rtstart=rt/+linux/start+$arch.o
      9 			cat <<-EOF
     10 			rtstart=rt/+linux/start+$arch.o
     11 
     12 			libhart_srcs=\
     13 				rt/+linux/errno.ha \
     14 				rt/+linux/segmalloc.ha \
     15 				rt/+linux/syscallno+$arch.ha \
     16 				rt/+linux/syscalls.ha \
     17 
     18 			libhart_objs=\
     19 				rt/+linux/syscall+$arch.o
     20 
     21 			rt: libhart.a rt/+linux/start+$arch.o
     22 			EOF
     23 			;;
     24 		FreeBSD)
     25 			case $arch in
     26 				amd64)
     27 					arch=x86_64
     28 					;;
     29 				aarch64|riscv64)
     30 					;;
     31 				*)
     32 					printf "unsupported FreeBSD arch %s\n" "$arch" >&2
     33 					;;
     34 			esac
     35 			rtstart=rt/+freebsd/start+$arch.o
     36 			cat <<-EOF
     37 			rtstart=rt/+freebsd/start+$arch.o
     38 
     39 			libhart_srcs=\
     40 				rt/+freebsd/errno.ha \
     41 				rt/+freebsd/segmalloc.ha \
     42 				rt/+freebsd/syscallno.ha \
     43 				rt/+freebsd/syscalls.ha \
     44 
     45 			libhart_objs=\
     46 				rt/+freebsd/syscall+$arch.o
     47 
     48 			rt: libhart.a rt/+freebsd/start+$arch.o
     49 			EOF
     50 			;;
     51 		OpenBSD)
     52 			case $arch in
     53 				amd64)
     54 					arch=x86_64
     55 					;;
     56 				aarch64|riscv64)
     57 					;;
     58 				*)
     59 					printf "unsupported OpenBSD arch %s\n" "$arch" >&2
     60 					;;
     61 			esac
     62 			rtstart=rt/+openbsd/start+$arch.o
     63 			cat <<-EOF
     64 			rtstart=rt/+openbsd/start+$arch.o
     65 
     66 			libhart_srcs=\
     67 				rt/+openbsd/errno.ha \
     68 				rt/+openbsd/segmalloc.ha \
     69 				rt/+openbsd/syscallno.ha \
     70 				rt/+openbsd/syscalls.ha \
     71 
     72 			libhart_objs=\
     73 				rt/+openbsd/syscall+$arch.o
     74 
     75 			rt: libhart.a rt/+openbsd/start+$arch.o
     76 			EOF
     77 			;;
     78 		*)
     79 			printf "rt not supported for %s\n" "$(uname)" >&2
     80 			exit 1
     81 			;;
     82 	esac
     83 }