shithub: sl

ref: 108a9de63855e85b23b98edcffa095ffed9eb9f8
dir: /mkfile/

View raw version
</$objtype/mkfile

BIN=/$objtype/bin
TARG=flisp
CFLAGS=$CFLAGS -p -Isrc -I3rd -I3rd/brieflz -Isrc/plan9 \
	-D__plan9__ -D__${objtype}__ \
	-DNDEBUG \

CLEANFILES=src/plan9/flisp.boot.s src/plan9/builtin_fns.h

HFILES=\
	src/equalhash.h\
	src/flisp.h\
	src/opcodes.h\
	src/plan9/platform.h\

OFILES=\
	3rd/brieflz/brieflz.$O\
	3rd/brieflz/depacks.$O\
	3rd/fn.$O\
	3rd/iswprint.$O\
	3rd/mt19937-64.$O\
	3rd/spooky.$O\
	3rd/tbl.$O\
	3rd/wcwidth.$O\
	src/bitvector.$O\
	src/builtins.$O\
	src/compress.$O\
	src/cvalues.$O\
	src/equal.$O\
	src/equalhash.$O\
	src/flisp.$O\
	src/flmain.$O\
	src/hashing.$O\
	src/htable.$O\
	src/ios.$O\
	src/iostream.$O\
	src/math.$O\
	src/nan.$O\
	src/opcodes.$O\
	src/operators.$O\
	src/plan9/clz`{test -f src/plan9/clz_$objtype.s && echo -n _$objtype}.$O\
	src/plan9/flisp.boot.$O\
	src/plan9/popcount`{test -f src/plan9/popcount_$objtype.s && echo -n _$objtype}.$O\
	src/plan9/sys.$O\
	src/print.$O\
	src/ptrhash.$O\
	src/random.$O\
	src/read.$O\
	src/string.$O\
	src/table.$O\
	src/types.$O\
	src/utf8.$O\

default:V: all

</sys/src/cmd/mkone

src/plan9/builtin_fns.h:D:
	awk -F '[()]' '\
		/^fl_.*fn/     {attr=$1; next} \
		/^_Noreturn/   {attr=$1; next} \
		/^BUILTIN[_]?/ {printf "BUILTIN_FN(%s, %s)\n", $2, attr} \
		{attr=""}' \
	`{ls `{echo $OFILES | sed 's/\.'$O'/.c/g'} >[2]/dev/null} | sort >$target

src/cvalues.$O: src/fl_arith_any.inc
src/flisp.$O: src/maxstack.inc src/vm.inc
src/equalhash.$O: src/htable.inc
src/ptrhash.$O: src/htable.inc

src/plan9/flisp.boot.s:D: boot/flisp.boot.builtin
	aux/data2s boot <$prereq >$target

%.$O: %.c
	$CC $CFLAGS -o $target $stem.c

%.$O: %.s
	$AS $CFLAGS -o $target $stem.s

%.$O: src/plan9/builtin_fns.h

bootstrap:V: $O.out
	cd src && \
	../$O.out ../tools/gen.lsp && \
	cp ../boot/flisp.boot ../boot/flisp.boot.bak && \
	../$O.out ../tools/mkboot0.lsp builtins.lsp instructions.lsp system.lsp compiler.lsp > ../boot/flisp.boot.new && \
	mv ../boot/flisp.boot.new ../boot/flisp.boot && \
	cp ../boot/flisp.boot ../boot/flisp.boot.builtin && \
	cd .. && \
	mk && \
	cd boot && \
	../$O.out ../tools/mkboot1.lsp && \
	cd .. && \
	mk

clean:V:
	rm -f */*/*.[$OS] */*.[$OS] [$OS].out *.acid $TARG $CLEANFILES