#	Makefile for ELF-based FreeBSD

TC=	../build/tc

default:	libtx.a txcgg txcg386.boot txcg386 txcg386e txcg86a txcg86t \
		txcgc txtrn txopt txpp

libtx.a:	libtx.c
	cc $(CFLAGS) -O -c -o libtx.o libtx.c
	ar -r libtx.a libtx.o
	ranlib libtx.a

txcgg:	txcgg.t
	$(TC) -P txcgg.t

txcg386.boot:	cg386e.def txcg_asm_frame
	ln -fs txcg_asm_frame txcg_frame
	./txcgg <cg386e.def >txcg386e.t
	$(TC) -P txcg386e.t && mv txcg386e txcg386.boot
	rm txcg_frame

txcg386:	cg386.def txcg_asm_frame
	./makegen.sh -asm 386

txcg386e:	cg386e.def txcg_asm_frame
	./makegen.sh -asm 386e

txcg86t:	cg86t.def txcg_asm_frame
	./makegen.sh -asm 86t

txcg86a:	cg86a.def txcg_asm_frame
	./makegen.sh -asm 86a

txcgc:	cgc.def txcg_hll_frame
	./makegen.sh -hll c

txtrn:	../compiler/txtrn.t
	./txboot.sh -o txtrn ../compiler/txtrn.t

txopt:	../compiler/txopt.t
	./txboot.sh -o txopt ../compiler/txopt.t

txpp:	../compiler/txpp.t
	./txboot.sh -o txpp ../compiler/txpp.t

diff:
	../compiler/txtrn <../compiler/txtrn.t >__t3
	./txtrn <../compiler/txtrn.t >__t3x
	cmp __t3 __t3x
	../compiler/txx ../build/txcg386.tcode <__t3 >__386
	./txcg386e <__t3x >__386N
	cmp __386 __386N
	rm __t3 __t3x __386 __386N

clean:
	rm -f *.o *.core core *.tcode *.ERR

clobber:	clean
	rm -f txcgg txcg386.boot txcg386 txcg386.t txcg386e txcg386e.t \
	txcg86a txcg86a.t txcg86t txcg86t.t txcgc txcgc.t libtx.a txtrn \
	txopt txpp

