GTK_INCLUDE = `gtk-config --cflags`
GTK_LIB = `gtk-config --libs`

IMLIB_INCLUDE = `imlib-config --cflags-gdk`
IMLIB_LIB = `imlib-config --libs-gdk`


FLAGS = -O2 -Wall -fPIC $(GTK_INCLUDE) $(IMLIB_INCLUDE)
LIBS = $(GTK_LIB) $(IMLIB_LIB)
LFLAGS = -shared

CC = gcc $(CFLAGS) $(FLAGS)

OBJS = gkrellweather.o

gkrellweather.so: $(OBJS)
	$(CC) $(OBJS) -o gkrellweather.so $(LFLAGS) $(LIBS)  -lpthread

clean:
	rm -f *.o core *.so* *.bak *~

gkrellweather.o: gkrellweather.c

install:
	if [ -d /usr/lib/gkrellm/plugins/ ] ; then \
		install -c -s -m 644 gkrellweather.so /usr/lib/gkrellm/plugins/ ; \
	elif [ -d /usr/share/gkrellm/plugins/ ] ; then \
		install -c -s -m 644 gkrellweather.so /usr/share/gkrellm/plugins/ ; \
	elif [ -d /usr/local/lib/gkrellm/plugins/ ] ; then \
		install -c -s -m 644 gkrellweather.so /usr/local/lib/gkrellm/plugins/ ; \
	elif [ -d /usr/lib/gkrellm/plugins/ ] ; then \
		install -c -s -m 644 gkrellweather.so /usr/lib/gkrellm/plugins/ ; \
	else \
		install -D -c -s -m 644 gkrellweather.so /usr/lib/gkrellm/plugins/gkrellweather.so ; \
	fi
	install -c -m 755 GrabWeather /usr/X11R6/bin

uninstall:
	rm -f /usr/lib/gkrellm/plugins/gkrellweather.so
	rm -f /usr/share/gkrellm/plugins/gkrellweather.so
	rm -f /usr/local/lib/gkrellm/plugins/gkrellweather.so
	rm -f /usr/lib/gkrellm/plugins/gkrellweather.so
	rm -f /usr/X11R6/bin/GrabWeather

