CFLAGS = -I/mingw64/include -I/mingw64/include/glib-2.0 -I/mingw64/x86_64-w64-mingw32/include -I/mingw64/include/python2.7 -pipe -Ofast -mms-bitfields -s -m64 -mwindows -lpthread $(shell gimptool-2.0 --cflags)
LIBS = $(shell gimptool-2.0 --libs)
PLUGIN = wavelet-decompose
SOURCES = plugin.c wavelet.c interface.c decompose.c
HEADERS = plugin.h
CC = /mingw64/bin/x86_64-w64-mingw32-gcc.exe

# END CONFIG ##################################################################

.PHONY: all install userinstall clean uninstall useruninstall

all: $(PLUGIN)

OBJECTS = $(subst .c,.o,$(SOURCES))

$(PLUGIN): $(OBJECTS)
	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)

%.o: %.c $(HEADERS)
	$(CC) $(CFLAGS) -c -o $@ $*.c
	
install: $(PLUGIN)
	@gimptool-2.0 --install-admin-bin $^

userinstall: $(PLUGIN)
	@gimptool-2.0 --install-bin $^

uninstall:
	@gimptool-2.0 --uninstall-admin-bin $(PLUGIN)

useruninstall:
	@gimptool-2.0 --uninstall-bin $(PLUGIN)

clean:
	rm -f *.o *~ $(PLUGIN)
