## Makefile for building gimp modules with Microsoft C
## Use: nmake -f makefile.msc

TOP = ..\..

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

# Nothing much configurable below

!INCLUDE $(TOP)\glib\build\win32\make.msc
!INCLUDE ..\gimpdefs.msc

INCLUDES = \
	-FImsvc_recommended_pragmas.h \
	-I.. 

DEFINES = -DHAVE_CONFIG_H -DMODULE_COMPILATION 
DEPCFLAGS = $(INTL_CFLAGS) $(GLIB_CFLAGS) $(GTK2_CFLAGS) 
DEPLIBS = $(INTL_LIBS) $(GLIB_LIBS) $(GTK2_LIBS)

BIN = $(GIMP)\modules

MODULES = \
	colorsel_triangle-$(GIMP_VER).dll \
	colorsel_water-$(GIMP_VER).dll \
	colorsel_cmyk-$(GIMP_VER).dll \
	cdisplay_colorblind-$(GIMP_VER).dll \
	cdisplay_gamma-$(GIMP_VER).dll \
	cdisplay_highcontrast-$(GIMP_VER).dll


all : \
	$(MODULES)

install : all
	for %m in ($(MODULES)) do copy %m $(BIN)

..\config.h : ..\config.h.win32
	copy ..\config.h.win32 ..\config.h

colorsel_triangle-$(GIMP_VER).dll : colorsel_triangle.obj
	$(CC) $(CFLAGS) -LD -Fe$@ colorsel_triangle.obj $(LDFLAGS) \
	..\libgimpcolor\gimpcolor-$(GIMP_VER).lib \
	..\libgimpwidgets\gimpwidgets-$(GIMP_VER).lib \
	..\libgimpmodule\gimpmodule-$(GIMP_VER).lib \
	$(DEPLIBS)

colorsel_water-$(GIMP_VER).dll : colorsel_water.obj
	$(CC) $(CFLAGS) -LD -Fe$@ colorsel_water.obj $(LDFLAGS) \
	..\libgimpcolor\gimpcolor-$(GIMP_VER).lib \
	..\libgimpwidgets\gimpwidgets-$(GIMP_VER).lib \
	$(DEPLIBS)

colorsel_cmyk-$(GIMP_VER).dll : colorsel_cmyk.obj
	$(CC) $(CFLAGS) -LD -Fe$@ colorsel_cmyk.obj $(LDFLAGS) \
	..\libgimpcolor\gimpcolor-$(GIMP_VER).lib \
	..\libgimpwidgets\gimpwidgets-$(GIMP_VER).lib \
	$(DEPLIBS)

cdisplay_colorblind-$(GIMP_VER).dll : cdisplay_colorblind.obj
	$(CC) $(CFLAGS) -LD -Fe$@ cdisplay_colorblind.obj $(LDFLAGS) \
	..\libgimpbase\gimpbase-$(GIMP_VER).lib \
	..\libgimpwidgets\gimpwidgets-$(GIMP_VER).lib \
	..\libgimpmodule\gimpmodule-$(GIMP_VER).lib \
	$(DEPLIBS)

cdisplay_gamma-$(GIMP_VER).dll : cdisplay_gamma.obj
	$(CC) $(CFLAGS) -LD -Fe$@ cdisplay_gamma.obj $(LDFLAGS) \
	..\libgimpbase\gimpbase-$(GIMP_VER).lib \
	..\libgimpwidgets\gimpwidgets-$(GIMP_VER).lib \
	$(DEPLIBS)

cdisplay_highcontrast-$(GIMP_VER).dll : cdisplay_highcontrast.obj
	$(CC) $(CFLAGS) -LD -Fe$@ cdisplay_highcontrast.obj $(LDFLAGS) \
	..\libgimpbase\gimpbase-$(GIMP_VER).lib \
	..\libgimpwidgets\gimpwidgets-$(GIMP_VER).lib \
	$(DEPLIBS)

# General rule for building 
.c.obj:
	$(CC) $(CFLAGS) -GD -c $<

clean::
	del *.dll
	del *.lib
	del *.obj
	del *.exp
	del *.err
	del *.map
	del *.sym
	del *.pdb
	del *.ilk
