
# Change the installation location to your liking (no trailing /).
PREFIX=/usr

# Directory for profiles distributed with the source (no trailing /)
PROFDIR=${PREFIX}/share/onestroke-0.8

CC=gcc
CFLAGS=-DOS_VERSION=\"${VERSION}\" -DOS_PROFDIR=\"${PROFDIR}\"
LDFLAGS=`pkg-config --libs gtk+-2.0` -lXtst -lm
VERSION=0.8.3
OBJECTS=osGTK.o osUnix.o onestroke.o

# Debug
#CFLAGS+=-g -Wall -D_DEBUG `pkg-config --cflags gtk+-2.0`

# Release
CFLAGS+=-O3 `pkg-config --cflags gtk+-2.0`

all: onestroke

clean:
	rm -rf *.o onestroke

new: clean all

install: onestroke
	mkdir -p ${PREFIX}/bin ${PREFIX}/share/applications ${PREFIX}/share/pixmaps ${PREFIX}/share/onestroke-0.8
	install -m 755 onestroke ${PREFIX}/bin/
	install onestroke.desktop ${PREFIX}/share/applications/
	install onestroke.png ${PREFIX}/share/pixmaps/
	install profiles/* ${PROFDIR}/

uninstall: onestroke
	rm -f ${PREFIX}/bin/onestroke ${PREFIX}/share/applications/onestroke.desktop ${PREFIX}/share/pixmaps/onestroke.png
	rm -rf ${PROFDIR}

release: clean
	mkdir onestroke-${VERSION}
	cp -r *.c *.h Makefile README INSTALL COPYING onestroke.desktop onestroke.png profiles onestroke-${VERSION}/
	tar zcf onestroke-${VERSION}.tar.gz onestroke-${VERSION}
	rm -rf onestroke-${VERSION}

run: onestroke
	./onestroke

save:
	tar zcf ~/saves/onestroke-${VERSION}-`date +%m-%d-%Y-%H.%M.%S`.tar.gz *

onestroke: ${OBJECTS}
	${CC} ${LDFLAGS} ${OBJECTS} -o onestroke

${OBJECTS}: onestroke.h
