all: avro flatbuffers protobuf

avro: twt-avro/gen.go
twt-avro/gen.go: lextwt.avro
	go tool avrogen -pkg twt_avro -encoders lextwt.avro > twt-avro/gen.go


flatbuffers: twt-fbs/lextwt
twt-fbs/lextwt: lextwt.fbs
	flatc -o twt-fbs --go lextwt.fbs

protobuf: twt-pb/lextwt.pb.go
twt-pb/lextwt.pb.go: lextwt.proto
	protoc --proto_path=. \
		--plugin=bin/protoc-gen-go \
		--go_opt=paths=source_relative \
		--go_opt="Mlextwt.proto=go.sour.is/lextwt-encoding/twt-pb;twt_pb" \
		--go_out=twt-pb \
		lextwt.proto 

.PHONY: avro protobuf flatbuffers