# Trigger these rules by running `make generate PKG=./pkg/sql/ir/irgen/parser` from the
# repository root to ensure your PATH includes vendored binaries.

SHELL = /usr/bin/env bash

all: irgen.go

.PHONY: irgen.go
irgen.go: irgen.y Makefile
	set -eo pipefail; ret=`goyacc -o irgen.go.tmp -p irgen irgen.y`; \
	  ! echo "$$ret" | grep -F conflicts
	# First comment for github/Go; second for reviewable.
	# https://github.com/golang/go/issues/13560#issuecomment-277804473
	# https://github.com/Reviewable/Reviewable/wiki/FAQ#how-do-i-tell-reviewable-that-a-file-is-generated-and-should-not-be-reviewed
	(echo '// Code generated by goyacc. DO NOT EDIT.'; \
	 echo '// GENERATED FILE DO NOT EDIT'; \
	 cat $@.tmp) >$@ && rm -f $@.tmp

clean:
	rm -f `cat .gitignore`
