adamc@102: all: smlnj mlton c
adamc@0: 
adamc@102: .PHONY: all smlnj mlton c clean
adamc@0: 
adamc@0: smlnj: src/lacweb.cm
adamc@0: mlton: bin/lacweb
adamc@102: c: clib/lacweb.o clib/driver.o
adamc@0: 
adamc@0: clean:
adamc@0: 	rm -f src/*.mlton.grm.* src/*.mlton.lex.* \
adamc@102: 		src/lacweb.cm src/lacweb.mlb \
adamc@102: 		clib/*.o
adamc@0: 	rm -rf .cm src/.cm
adamc@0: 
adamc@102: clib/lacweb.o: src/c/lacweb.c
adamc@103: 	gcc -O3 -I include -c src/c/lacweb.c -o clib/lacweb.o
adamc@102: 
adamc@102: clib/driver.o: src/c/driver.c
adamc@117: 	gcc -O3 -I include -c src/c/driver.c -o clib/driver.o
adamc@102: 
adamc@0: src/lacweb.cm: src/prefix.cm src/sources
adamc@0: 	cat src/prefix.cm src/sources \
adamc@0: 	>src/lacweb.cm
adamc@0: 
adamc@0: src/lacweb.mlb: src/prefix.mlb src/sources src/suffix.mlb
adamc@0: 	cat src/prefix.mlb src/sources src/suffix.mlb \
adamc@0: 	| sed 's/^\(.*\).grm$$/\1.mlton.grm.sig\n\1.mlton.grm.sml/' \
adamc@0: 	| sed 's/^\(.*\).lex$$/\1.mlton.lex.sml/' \
adamc@0: 	>src/lacweb.mlb
adamc@0: 
adamc@0: %.mlton.lex: %.lex
adamc@0: 	cp $< $@
adamc@0: %.mlton.grm: %.grm
adamc@0: 	cp $< $@
adamc@0: 
adamc@0: %.mlton.lex.sml: %.mlton.lex
adamc@0: 	mllex $<
adamc@0: 
adamc@0: %.mlton.grm.sig %.mlton.grm.sml: %.mlton.grm
adamc@0: 	mlyacc $<
adamc@0: 
adamc@0: MLTON := mlton
adamc@0: 
adamc@0: ifdef DEBUG
adamc@0: 	MLTON += -const 'Exn.keepHistory true'
adamc@0: endif
adamc@0: 
adamc@1: bin/lacweb: src/lacweb.mlb src/*.sig src/*.sml \
adamc@1: 		src/lacweb.mlton.lex.sml \
adamc@1: 		src/lacweb.mlton.grm.sig src/lacweb.mlton.grm.sml
adamc@0: 	$(MLTON) -output $@ src/lacweb.mlb