CC = gcc
EXT_CFLAGS := $(shell pkg-config --cflags gtk+-2.0 libxfce4panel-1.0)
EXT_LIBS := $(shell pkg-config --libs gtk+-2.0 libxfce4panel-1.0)
CFLAGS = -DENABLE_NLS -Wl,-export-dynamic -g -O2 -Wall $(EXT_CFLAGS) $(EXT_LIBS)

all: xfce4-hedley-show-connections-plugin xfce4-hedley-show-system-settings-plugin xfce4-hedley-show-power-plugin

xfce4-hedley-show-connections-plugin: xfce4-hedley-plugins.c
	$(CC) $(CFLAGS) -DRUNCMD=\"/usr/bin/hedley-show-connections\" -DICON=\"hedley-home\" $< -o $@
xfce4-hedley-show-system-settings-plugin: xfce4-hedley-plugins.c
	$(CC) $(CFLAGS) -DRUNCMD=\"/usr/bin/hedley-show-system-settings\" -DICON=\"hedley-settings\" $< -o $@
xfce4-hedley-show-power-plugin: xfce4-hedley-plugins.c
	$(CC) $(CFLAGS) -DRUNCMD=\"/usr/bin/hedley-show-power\" -DICON=\"hedley-power\" $< -o $@

clean:
	$(RM) -f *~ xfce4-hedley-show-connections-plugin xfce4-hedley-show-system-settings-plugin
	$(RM) -f xfce4-hedley-show-power-plugin

install: xfce4-hedley-show-connections-plugin
	mkdir -p $(DESTDIR)/usr/lib/xfce4/panel-plugins/
	mkdir -p $(DESTDIR)/usr/share/xfce4/panel-plugins/
	install -m 755 -o 0 -g 0 -D xfce4-hedley-show-connections-plugin $(DESTDIR)/usr/lib/xfce4/panel-plugins/xfce4-hedley-show-connections-plugin
	install -m 644 -o 0 -g 0 -D xfce4-hedley-show-connections.desktop $(DESTDIR)/usr/share/xfce4/panel-plugins/xfce4-hedley-show-connections.desktop
	install -m 755 -o 0 -g 0 -D xfce4-hedley-show-system-settings-plugin $(DESTDIR)/usr/lib/xfce4/panel-plugins/xfce4-hedley-show-system-settings-plugin
	install -m 644 -o 0 -g 0 -D xfce4-hedley-show-system-settings.desktop $(DESTDIR)/usr/share/xfce4/panel-plugins/xfce4-hedley-show-system-settings.desktop
	install -m 755 -o 0 -g 0 -D xfce4-hedley-show-power-plugin $(DESTDIR)/usr/lib/xfce4/panel-plugins/xfce4-hedley-show-power-plugin
	install -m 644 -o 0 -g 0 -D xfce4-hedley-show-power.desktop $(DESTDIR)/usr/share/xfce4/panel-plugins/xfce4-hedley-show-power.desktop

