+ifndef BUILDID
+BUILDID = $(shell (hg id || echo "unknown") | sed -e "s/[()]//g;s/+ /+/g;s/ /-/g" )
+endif
+MFLAGS+=BUILDID=$(BUILDID)
+
+default: all
+
+.SUFFIXES: .so .y .l
+
+-include $(wildcard .deps/*.d)
+
+.c.o:
+ @if [ ! -d .deps ]; then mkdir .deps || true; fi
+ $(CC) $(CFLAGS) -MMD -MF .deps/$(subst .o,.d,$@) -c -o $@ $<
+
+.o.so:
+ $(CC) -nostartfiles -Wl,--export-dynamic -shared -o $@ $^ $(LDFLAGS)
+
+.y.c: ;
+
+.l.c: ;
+
+CFLAGS+=-I./ -DBUILDID=$(BUILDID) -fPIC
+CFLAGS+=-Wall -g -finline-functions -funroll-loops -Werror=format-security
+
+ifndef NOC99
+CFLAGS+=-std=c99
+endif