GCC = gcc
PREFIX=/usr/local
CFLAGS = -g -O2 -Wall
CFLAGS_GTK1 = $(shell gtk-config --cflags)
CFLAGS_GTK2 = $(shell pkg-config gtk+-2.0 --cflags)

LIBS_GTK1 = $(shell gtk-config --libs)
LIBS_GTK2 = $(shell pkg-config gtk+-2.0 --libs)

VERSION = 1.0.1

all: switch switch2

switch: switch.c switch.h
	${GCC} -o switch switch.c ${CFLAGS} ${CFLAGS_GTK1} ${LIBS_GTK1}

switch2: switch2.c switch.h
	${GCC} -DSWITCH_GTK2 -o switch2 switch2.c ${CFLAGS} ${CFLAGS_GTK2} ${LIBS_GTK2}

# XXX we won't use these in Debian, don't bother

clean:
	-rm -f switch switch2 *~
	
install: all
	strip switch
	mkdir -p ${PREFIX}/bin
	mkdir -p ${PREFIX}/man
	install -c switch ${PREFIX}/bin
	install -c switch.1 ${PREFIX}/man

dist: clean
	rm -rf /tmp/gtk-theme-switch-$(VERSION)
	cp -r . /tmp/gtk-theme-switch-$(VERSION)
	tar czf ../gtk-theme-switch-$(VERSION).tar.gz -C /tmp/ gtk-theme-switch-$(VERSION)
	rm -rf /tmp/gtk-theme-switch-$(VERSION)
