CC=gcc

GIMP_LDFLAGS=`gimptool-1.3 --libs`
GIMP_CFLAGS=`gimptool-1.3 --cflags`

CFLAGS=$(GIMP_CFLAGS) -O4 -Wall
LDFLAGS=$(GIMP_LDFLAGS) -lm
MOS = fr.mo
LOCALEDIR = /usr/share/locale


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

install: resynth smart-enlarge.scm smart-remove.scm
	gimptool-1.3 --install-bin resynth
	gimptool-1.3 --install-script smart-enlarge.scm
	gimptool-1.3 --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.c
	$(CC) $(CFLAGS) -o $@ resynth.c $(LDFLAGS)

clean:
	-rm -f *~ *.o core resynth
	
%.mo : %.po
	msgfmt -o $@ $<

install-mos : $(MOS)
	if [ ! -d $(LOCALEDIR)/fr ] ; then mkdir $(LOCALEDIR)/fr ; fi
	if [ ! -d $(LOCALEDIR)/fr/LC_MESSAGES ] ; then mkdir $(LOCALEDIR)/fr/LC_MESSAGES ; fi
	cp fr.mo $(LOCALEDIR)/fr/LC_MESSAGES/resynthesize.mo
