CC = gcc
#CC = gcc-3.4

GIMPTOOL = gimptool-2.0

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

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

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) --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.c
	$(CC) $(MY_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
