PREFIX=/usr
BINDIR=$(PREFIX)/bin
VERSION=0.1

LIBS=$(shell pkg-config --libs x11 xtst gdk-pixbuf-2.0 gobject-2.0)
CFLAGS=$(shell pkg-config --cflags x11 xtst gdk-pixbuf-2.0 gobject-2.0) -g3 -Wall
OBJ=main.o needle.o screen.o type.o guesskey.o
autox11: $(OBJ) keylist.o
	$(CC) $^ $(LDFLAGS) $(LIBS) -o autox11

keylist.c: genkeylist.sh
	./genkeylist.sh > keylist.c

clean:
	rm -f $(OBJ) keylist.o keylist.c autox11

tarball:
	tar -cJf autox11-$(VERSION).tar.xz --transform='s|^|autox11-$(VERSION)/|' $(subst .o,.c,$(OBJ)) autox11.h Makefile genkeylist.sh LICENSE README

install: autox11
	install -D -m 755 autox11 $(BINDIR)/autox11
