harec

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

configure (2027B)


      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 					exit 1
     34 					;;
     35 			esac
     36 			rtstart=rt/+freebsd/start+$arch.o
     37 			cat <<-EOF
     38 			rtstart=rt/+freebsd/start+$arch.o
     39 
     40 			libhart_srcs=\
     41 				rt/+freebsd/errno.ha \
     42 				rt/+freebsd/segmalloc.ha \
     43 				rt/+freebsd/syscallno.ha \
     44 				rt/+freebsd/syscalls.ha \
     45 
     46 			libhart_objs=\
     47 				rt/+freebsd/syscall+$arch.o
     48 
     49 			rt: libhart.a rt/+freebsd/start+$arch.o
     50 			EOF
     51 			;;
     52 		OpenBSD)
     53 			case $arch in
     54 				amd64)
     55 					arch=x86_64
     56 					;;
     57 				arm64)
     58 					arch=aarch64
     59 					;;
     60 				riscv64)
     61 					;;
     62 				*)
     63 					printf "unsupported OpenBSD arch %s\n" "$arch" >&2
     64 					exit 1
     65 					;;
     66 			esac
     67 			rtstart=rt/+openbsd/start+$arch.o
     68 			cat <<-EOF
     69 			rtstart=rt/+openbsd/start+$arch.o
     70 
     71 			libhart_srcs=\
     72 				rt/+openbsd/errno.ha \
     73 				rt/+openbsd/segmalloc.ha \
     74 				rt/+openbsd/syscallno.ha \
     75 				rt/+openbsd/syscalls.ha \
     76 
     77 			libhart_objs=\
     78 				rt/+openbsd/syscall+$arch.o
     79 
     80 			rt: libhart.a rt/+openbsd/start+$arch.o
     81 			EOF
     82 			;;
     83 		NetBSD)
     84 			case $arch in
     85 				amd64)
     86 					arch=x86_64
     87 					;;
     88 				*)
     89 					printf "unsupported NetBSD arch %s\n" "$arch" >&2
     90 					exit 1
     91 					;;
     92 			esac
     93 			rtstart=rt/+netbsd/start+$arch.o
     94 			cat <<-EOF
     95 			rtstart=rt/+netbsd/start+$arch.o
     96 
     97 			libhart_srcs=\
     98 				rt/+netbsd/errno.ha \
     99 				rt/+netbsd/segmalloc.ha \
    100 				rt/+netbsd/syscallno.ha \
    101 				rt/+netbsd/syscalls.ha \
    102 
    103 			libhart_objs=\
    104 				rt/+netbsd/syscall+$arch.o
    105 
    106 			rt: libhart.a rt/+netbsd/start+$arch.o
    107 			EOF
    108 			;;
    109 		*)
    110 			printf "rt not supported for %s\n" "$(uname)" >&2
    111 			exit 1
    112 			;;
    113 	esac
    114 }