harec

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

configure (1739B)


      1 #!/bin/sh
      2 all="$all tests"
      3 
      4 rtscript="rt/hare.sc"
      5 
      6 if [ `uname -s` = "OpenBSD" ]
      7 then
      8 	rtscript="rt/hare+openbsd.sc"
      9 fi
     10 
     11 if [ `uname -s` = "NetBSD" ]
     12 then
     13 	rtscript="rt/hare+netbsd.sc"
     14 fi
     15 
     16 tests() {
     17 	# harec tests
     18 	for t in \
     19 		00-constants \
     20 		01-arrays \
     21 		02-integers \
     22 		03-pointers \
     23 		04-strings \
     24 		05-implicit-casts \
     25 		06-structs \
     26 		07-aliases \
     27 		08-slices \
     28 		09-funcs \
     29 		10-binarithms \
     30 		11-globals \
     31 		12-loops \
     32 		13-tagged \
     33 		14-switch \
     34 		15-enums \
     35 		16-defer \
     36 		17-alloc \
     37 		18-match \
     38 		19-append \
     39 		20-if \
     40 		21-tuples \
     41 		22-delete \
     42 		23-errors \
     43 		24-imports \
     44 		25-promotion \
     45 		26-regression \
     46 		27-rt \
     47 		28-insert \
     48 		29-unarithm \
     49 		31-postfix \
     50 		32-copy \
     51 		33-yield \
     52 		34-declarations \
     53 		35-floats \
     54 		36-defines
     55 	do
     56 		cat <<EOF
     57 tests/$t: libhart.a testmod.a tests/$t.ha
     58 	@printf 'HAREC\t%s\t$@\n' "tests/$t"
     59 	@HARECACHE=\$(HARECACHE) ./harec -o tests/$t.ssa tests/$t.ha
     60 	@\$(QBE) -o tests/$t.s tests/$t.ssa
     61 	@\$(AS) -g -o tests/$t.o tests/$t.s
     62 	@\$(LD) --gc-sections -T $rtscript -o tests/$t $rtstart tests/$t.o libhart.a testmod.a
     63 	@rm tests/$t.s tests/$t.ssa tests/$t.o
     64 
     65 check: tests/$t
     66 
     67 clean-test-$t:
     68 	@rm -f tests/$t
     69 .PHONY: clean-test-$t
     70 
     71 clean-tests: clean-test-$t
     72 EOF
     73 	done
     74 
     75 	# C tests
     76 	for t in \
     77 		30-reduction
     78 	do
     79 		cat <<EOF
     80 test_objects=\
     81 	src/lex.o \
     82 	src/parse.o \
     83 	src/type_store.o \
     84 	src/scope.o \
     85 	src/identifier.o \
     86 	src/util.o \
     87 	src/types.o \
     88 	src/check.o \
     89 	src/utf8.o \
     90 	src/eval.o \
     91 	src/typedef.o \
     92 	src/mod.o
     93 
     94 tests/$t: tests/$t.c \$(test_objects)
     95 	@printf 'CC\ttests/$t\n'
     96 	@\$(CC) \$(LDFLAGS) \$(CFLAGS) -o \$@ tests/$t.c \$(test_objects) \$(LIBS)
     97 
     98 check: tests/$t
     99 
    100 clean-test-$t:
    101 	@rm -f tests/$t tests/$t.o
    102 .PHONY: clean-test-$t
    103 
    104 clean-tests: clean-test-$t
    105 EOF
    106 	done
    107 }