.PHONY: all clean

#CFLAGS = -O0 -g -DUSE_SCREENSHOT
#LDFLAGS = -Wl,--as-needed 
CFLAGS = -Os -DUSE_SCREENSHOT
LDFLAGS = -Wl,--as-needed -s
XANN_LIBS  = -lX11 -lXext -lz -lXrender
XSHOT_LIBS = -lX11 -lz -lrt -lXfixes

all: xannotate xscreenshot

# xannotate
xannotate.o: xannotate.c

pnglite.o: pnglite.c pnglite.h

xannotate: xannotate.o pnglite.o
	$(CC) $(LDFLAGS) -o $@ $^ $(XANN_LIBS)
	
# xscreenshot
xscreenshot.o: xscreenshot.c

xscreenshot: xscreenshot.o pnglite.o
	$(CC) $(LDFLAGS) -o $@ $^ $(XSHOT_LIBS)

# maintenance
clean:
	rm -f xannotate xscreenshot *.o

package: clean
	echo Version $(shell date +%F) > VERSION
	(cd ..; tar -cjvf xannotate-$(shell date +%F).tar.bz2 xannotate/*)
