shithub: sl

ref: 253107e36cdb715a21c1fc47cd119702f1a11285
dir: /mkfile/

View raw version
</$objtype/mkfile

cpuobjtype=`{sed -n 's/^O=//p' /$cputype/mkfile}

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

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

HFILES=\
	src/equalhash.h\
	src/sl.h\
	src/opcodes.h\
	src/plan9/platform.h\
	src/plan9/lsd.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/sl.$O\
	src/slmain.$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/sl.boot.$O\
	src/plan9/popcount`{test -f src/plan9/popcount_$objtype.s && echo -n _$objtype}.$O\
	src/plan9/sys.$O\
	src/plan9/lsd.$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

CFILES=${OFILES:%.$O=%.c}

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

src/cvalues.$O: src/sl_arith_any.h
src/sl.$O: src/vm.h
src/equalhash.$O: src/htable_c.h
src/ptrhash.$O: src/htable_c.h

OFILES_lzpack=\
	3rd/brieflz/brieflz.$O\
	3rd/brieflz/depacks.$O\
	tools/lzpack.$O \

CFILES_lzpack=${OFILES_lzpack:%.$O=%.c}

tools/$cpuobjtype.lzpack: $CFILES_lzpack
	objtype=$cputype
	mk lzpack.$cputype

lzpack.$cputype:V: $OFILES_lzpack
	$LD $LDFLAGS -o tools/$O.lzpack $OFILES_lzpack

src/plan9/sl.boot.s:D: boot/sl.boot tools/$cpuobjtype.lzpack
	tools/$cpuobjtype.lzpack -10 < boot/sl.boot | aux/data2s boot >$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/sl.boot ../boot/sl.boot.bak && \
	../$O.out ../tools/mkboot0.lsp builtins.lsp instructions.lsp system.lsp compiler.lsp > ../boot/sl.boot.new && \
	mv ../boot/sl.boot.new ../boot/sl.boot && \
	cd .. && \
	mk && \
	cd boot && \
	../$O.out ../tools/mkboot1.lsp && \
	cd .. && \
	mk

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

nuke:V:
	mk clean