## Makefile for building GIMP modules with gcc on Win32.
## You should use GNU make running on cygwin.
## Use: make -f makefile.mingw

# Change this to wherever you install gimp.
# This is what I use as installation target, from where the installer-builder
# will pick it up.
BIN = /install/gimp/modules

TOP = ../..

include ../build/win32/make.mingw

# Possibly override GIMP version from build/win32/module.defs
GIMP_VER = @GIMP_MAJOR_VERSION@.@GIMP_MINOR_VERSION@

################################################################

DEFINES = -DMODULE_COMPILATION 
INCLUDES = -I . -I .. 
DEPCFLAGS = $(GLIB_CFLAGS) $(GTK_CFLAGS) $(INTL_CFLAGS)

LDFLAGS = -s

MODULES =					\
	colorsel_gtk-$(GIMP_VER).dll		\
	colorsel_triangle-$(GIMP_VER).dll	\
	colorsel_water-$(GIMP_VER).dll

all : \
	$(MODULES)

install : all
	for m in $(MODULES); do $(INSTALL) $$m $(BIN); done

../config.h : ../config.h.win32
	cp $< $@

colorsel_gtk-$(GIMP_VER).dll : colorsel_gtk.o module.def
	$(GLIB)/build-dll colorsel_gtk $(GIMP_VER) module.def colorsel_gtk.o $(LDFLAGS) -L ../app -lgimp $(GTK_LIBS) $(GLIB_LIBS)

colorsel_triangle-$(GIMP_VER).dll : colorsel_triangle.o module.def
	$(GLIB)/build-dll colorsel_triangle $(GIMP_VER) module.def colorsel_triangle.o $(LDFLAGS) -L ../app -lgimp $(GTK_LIBS) $(INTL_LIBS) $(GLIB_LIBS)

colorsel_water-$(GIMP_VER).dll : colorsel_water.o module.def
	$(GLIB)/build-dll colorsel_water $(GIMP_VER) module.def colorsel_water.o $(LDFLAGS) -L ../app -lgimp $(GTK_LIBS) $(INTL_LIBS) $(GLIB_LIBS)

## cdisplay_gamma-$(GIMP_VER).dll : cdisplay_gamma.o module.def
## 	$(GLIB)/build-dll cdisplay_gamma $(GIMP_VER) module.def cdisplay_gamma.o $(LDFLAGS) -L ../app -lgimp -L ../libgimp -lgimp-$(GIMP_VER) -lgimpui-$(GIMP_VER) $(GTK_LIBS) $(INTL_LIBS) $(GLIB_LIBS)

## cdisplay_highcontrast-$(GIMP_VER).dll : cdisplay_highcontrast.o module.def
## 	$(GLIB)/build-dll cdisplay_highcontrast $(GIMP_VER) module.def cdisplay_highcontrast.o $(LDFLAGS) -L ../app -lgimp -L ../libgimp -lgimp-$(GIMP_VER) -lgimpui-$(GIMP_VER) $(GTK_LIBS) $(INTL_LIBS) $(GLIB_LIBS)

# Hack to get an updated makefile.mingw automatically after updating
# makefile.mingw.in. Only for developer use.
makefile.mingw: makefile.mingw.in
	sed -e 's,@GIMP[_]MAJOR_VERSION@,@GIMP_MAJOR_VERSION@,' \
	    -e 's,@GIMP[_]MINOR_VERSION@,@GIMP_MINOR_VERSION@,' <$< >$@
