CFLAGS = -O3 -Wall $(shell gimptool-2.0 --cflags)
LIBS = $(shell gimptool-2.0 --libs)
PLUGIN = texturewerke

SOURCES = blur.cpp \
	buffer.cpp \
	color-ui.cpp \
	color.cpp \
	dialog.cpp \
	fourier.cpp \
	kernel-widget.cpp \
	lowpass-ui.cpp \
	lowpass.cpp \
	texturewerke.cpp \
	levmar-2.1.3/lm.c \
	levmar-2.1.3/lmbc.c \
	levmar-2.1.3/lmlec.c \
	levmar-2.1.3/misc.c \
	levmar-2.1.3/Axb.c

HEADERS = texturewerke.h

CC = /usr/bin/g++
# END CONFIG ##################################################################

.PHONY: all install userinstall clean uninstall useruninstall

all: $(PLUGIN)

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

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

%.o: %.cpp $(HEADERS)
	$(CC) $(CFLAGS) -c -o $@ $*.cpp
	
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)
