CC = g++

GIMPTOOL = gimptool

GIMP_LDFLAGS=`$(GIMPTOOL) --libs`
GIMP_CFLAGS=`$(GIMPTOOL) --cflags`

CFLAGS=-O3 -Wall -fno-common -ffast-math -frename-registers -fomit-frame-pointer
MY_CFLAGS=$(GIMP_CFLAGS) $(CFLAGS)

LDFLAGS=$(GIMP_LDFLAGS) -lm


all: resynth
	@echo
	@echo 'Now type "make install" to install resynthesizer'
	@echo 

install: resynth smart-enlarge.scm smart-remove.scm
	$(GIMPTOOL) --install-bin resynth
	$(GIMPTOOL) --install-script smart-enlarge.scm
	$(GIMPTOOL) --install-script smart-remove.scm
	@echo
	@echo After restarting the Gimp you should find the
	@echo following items in the pop-up image menu:
	@echo
	@echo "  * Filters/Map/Resynthesize"
	@echo "  * Script-Fu/Enhance/Smart enlarge"
	@echo "  * Script-Fu/Enhance/Smart sharpen"
	@echo "  * Script-Fu/Enhance/Smart remove selection"
	@echo

resynth: resynth.cc
	$(CC) $(MY_CFLAGS) -o $@ resynth.cc $(LDFLAGS)

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

