# Modify INCLUDE to point to gkrellm.h (if it's not in /usr/local/include)
INCLUDE	= /usr/local/include

CC	= gcc
CFLAGS	= -Wall -Wimplicit -Wreturn-type -Wunused -Wswitch              \
	  -Wcomment-Wparentheses -Wtraditional -Wpointer-arith          \
	  -Wmissing-prototypes -O2 -fPIC -I$(INCLUDE)                   \
	  `pkg-config gtk+-2.0 --cflags`
LDFLAGS	=
TARGET	= gkrellm_itime



$(TARGET).so: $(TARGET).o
	$(CC) -shared -Wl `pkg-config gtk+-2.0 --libs` $< -o $@

$(TARGET).o: $(TARGET).c
	$(CC) $(CFLAGS) -c $<

$(TARGET): $(TARGET).c
	$(CC) $(CFLAGS) $< -o $@

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

uninstall:
	rm -f /usr/lib/gkrellm/plugins/gkrellm_itime.so
	rm -f /usr/share/gkrellm/plugins/gkrellm_itime.so
	rm -f /usr/local/lib/gkrellm/plugins/gkrellm_itime.so
	rm -f /usr/lib/gkrellm/plugins/gkrellm_itime.so

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