CC      = cc
CFLAGS  = -O2 -std=c11 -D_POSIX_C_SOURCE=199309L -I. -I/usr/include -Wall -Wextra
LDFLAGS = -lupb -lutf8_range

SRCS    = hackers_bench.c hackers.upb.c hackers.upb_minitable.c
TARGET  = hackers_bench

.PHONY: all clean regen

all: $(TARGET)

$(TARGET): $(SRCS)
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

# Re-generate upb files from proto/hackers.proto
regen:
	protoc -I ../proto ../proto/hackers.proto \
		--upb_out=. \
		--upb_minitable_out=.

clean:
	rm -f $(TARGET)
