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

# Change this to wherever you want to install gimp.exe.
BIN = C:\gimp\bin

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

# Nothing much configurable below

!IFNDEF DEBUG
# Full optimization:
OPTIMIZE = -Ox -MD
LINKDEBUG = 
!ELSE
# Debugging:
OPTIMIZE = -Zi -MDd
LINKDEBUG = /debug
!ENDIF

# cl -? describes the options
CC = cl -GA -G5 -GF $(OPTIMIZE) -W3 -nologo

LDFLAGS = /link /subsystem:console /machine:ix86 $(LINKDEBUG)
INSTALL = copy

GIMP_VER = 1.1
GTK_VER = 1.3
GLIB_VER = 1.3

GTK = ..\..\gtk+
GLIB = ..\..\glib
GMODULE = $(GLIB)\gmodule
INTL = ..\..\intl

CFLAGS = -DREGEX_MALLOC -DHAVE_CONFIG_H -I. -I.. -I$(GLIB) -I$(GMODULE) -I$(GTK)\gdk -I$(GTK)\gdk -I$(GTK) -I$(INTL)

# GCG = ..\tools\gcg\gcg -I. -I ..\tools\gcg\gh

all : \
	..\config.h	\
	gimpim.lib	\
	colormap_dialog.c \
	gimp.exe

install : gimp.exe
	$(INSTALL) gimp.exe $(BIN)

..\config.h : ..\config.h.win32
	copy ..\config.h.win32 $@

gimpim_OBJECTS = \
	gimpdrawable.obj\
	gimpimage.obj	\
	gimpobject.obj	\
	gimppreviewcache.obj\
	gimpset.obj	\
	gimpsignal.obj

gimpim.lib : $(gimpim_OBJECTS)
	lib /out:gimpim.lib $(gimpim_OBJECTS)
	
gimp_OBJECTS = \
	about_dialog.obj	\
	airbrush.obj		\
	airbrush_blob.obj	\
	app_procs.obj		\
	asupsample.obj		\
	batch.obj		\
	bezier_select.obj	\
	blend.obj		\
	blob.obj        	\
	boundary.obj		\
	brightness_contrast.obj	\
	brush_edit.obj		\
	brush_scale.obj		\
	brush_select.obj	\
	brush_select_cmds.obj	\
	brushes_cmds.obj	\
	bucket_fill.obj		\
	by_color_select.obj	\
	channel.obj		\
	channel_cmds.obj	\
	channels_dialog.obj	\
	channel_ops.obj		\
	channel_ops_cmds.obj	\
	clone.obj		\
	color_area.obj		\
	color_balance.obj	\
	color_cmds.obj		\
	color_notebook.obj	\
	color_panel.obj		\
	color_picker.obj	\
	color_select.obj	\
	color_transfer.obj	\
	colormaps.obj		\
	colormap_dialog.obj	\
	commands.obj		\
	context_manager.obj	\
	convert.obj		\
	convert_cmds.obj	\
	convolve.obj		\
	crop.obj		\
	cursorutil.obj		\
	curves.obj		\
	datafiles.obj		\
	desaturate.obj		\
	devices.obj		\
	dialog_handler.obj	\
	disp_callbacks.obj	\
	docindex.obj		\
	docindexif.obj		\
	dodgeburn.obj		\
	draw_core.obj		\
	drawable.obj		\
	drawable_cmds.obj	\
	edit_cmds.obj		\
	edit_selection.obj	\
	ellipse_select.obj	\
	eraser.obj		\
	errorconsole.obj	\
	errors.obj		\
	equalize.obj		\
	fileops.obj		\
	fileops_cmds.obj	\
	flip_tool.obj		\
	floating_sel.obj	\
	floating_sel_cmds.obj	\
	file_new_dialog.obj	\
	free_select.obj		\
	fuzzy_select.obj	\
	gdisplay.obj		\
	gdisplay_cmds.obj	\
	gdisplay_color.obj	\
	gdisplay_color_ui.obj	\
	gdisplay_ops.obj	\
	general.obj		\
	gimage.obj		\
	gimage_cmds.obj		\
	gimage_mask.obj		\
	gimage_mask_cmds.obj	\
	gimpbrush.obj		\
	gimpbrushgenerated.obj	\
	gimpbrushlist.obj	\
	gimpbrushpipe.obj	\
	gimpcontext.obj		\
	gimpcontextpreview.obj	\
	gimpdnd.obj		\
	gimphelp.obj		\
	gimphelp_cmds.obj	\
	gimphistogram.obj	\
	gimplist.obj		\
	gimplut.obj		\
	gimpparasite.obj	\
	gimpprogress.obj	\
	gimprc.obj		\
	gimprc_cmds.obj		\
	gimpui.obj		\
	gimpunit.obj		\
	global_edit.obj		\
	gradient.obj		\
	gradient_cmds.obj	\
	gradient_select.obj	\
	gradient_select_cmds.obj\
	guides_cmds.obj		\
	gtkwrapbox.obj		\
	gtkhwrapbox.obj		\
	gtkvwrapbox.obj		\
	gximage.obj		\
	histogramwidget.obj 	\
	histogram_tool.obj	\
	hue_saturation.obj	\
	image_map.obj		\
	image_new.obj		\
	image_render.obj	\
	indicator_area.obj	\
	info_dialog.obj		\
	info_window.obj		\
	ink.obj         	\
	install.obj		\
	interface.obj		\
	interface_cmds.obj	\
	internal_procs.obj	\
	invert.obj		\
	iscissors.obj		\
	layer.obj		\
	layer_cmds.obj		\
	layer_select.obj	\
	layers_dialog.obj	\
	lc_dialog.obj		\
	levels.obj		\
	lut_funcs.obj		\
	magnify.obj		\
	main.obj		\
	measure.obj		\
	menus.obj		\
	misc_cmds.obj		\
	module_db.obj		\
	move.obj		\
	nav_window.obj		\
	ops_buttons.obj		\
	palette.obj		\
	palette_cmds.obj	\
	palette_select.obj	\
	paint_core.obj		\
	paint_funcs.obj		\
	paintbrush.obj		\
	parasite_cmds.obj	\
	parasitelist.obj	\
	path_bezier.obj		\
	path_curves.obj		\
	path_tool.obj		\
	paths_cmds.obj		\
	paths_dialog.obj	\
	pattern_select.obj	\
	pattern_select_cmds.obj	\
	patterns.obj		\
	patterns_cmds.obj	\
	pencil.obj		\
	perspective_tool.obj	\
	pixel_processor.obj	\
	pixel_region.obj	\
	plug_in.obj		\
	plug_in_cmds.obj	\
	posterize.obj		\
	preferences_dialog.obj	\
	procedural_db.obj	\
	procedural_db_cmds.obj	\
	qmask.obj		\
	rect_select.obj		\
	regex.obj		\
	resize.obj		\
	rotate_tool.obj		\
	scale.obj		\
	scale_tool.obj		\
	scan_convert.obj	\
	scroll.obj		\
	selection.obj		\
	session.obj		\
	shear_tool.obj		\
	smudge.obj		\
	temp_buf.obj		\
	text_tool.obj		\
	text_tool_cmds.obj	\
	threshold.obj		\
	tile.obj		\
	tile_cache.obj		\
	tile_manager.obj	\
	tile_swap.obj		\
	tips_dialog.obj		\
	tool_options.obj	\
	tools.obj		\
	tools_cmds.obj		\
	transform_core.obj	\
	transform_tool.obj	\
	undo.obj		\
	undo_cmds.obj		\
	undo_history.obj	\
	unit_cmds.obj		\
	xcf.obj			\
	xinput_airbrush.obj

# .SUFFIXES: .gc

# .gc.c:
# 	$(GCG) -o $@ $<

gimp.res : gimp.rc wilber.ico
	rc -r -fo gimp.res gimp.rc

gimp.def: gimp.sym
	echo EXPORTS >$@
	copy /y $@+gimp.sym $@

gimp.exe : ..\config.h $(gimp_OBJECTS) gimpim.lib gimp.def gimp.res ..\libgimp\gimpi.lib
	$(CC) $(CFLAGS) -Fegimp.exe $(gimp_OBJECTS) gimpim.lib ..\libgimp\gimpi.lib $(GTK)\gtk\gtk-$(GTK_VER).lib $(GTK)\gdk\gdk-$(GTK_VER).lib $(INTL)\gnu-intl.lib $(GLIB)\glib-$(GLIB_VER).lib $(GLIB)\gmodule-$(GLIB_VER).lib $(LDFLAGS) gimp.res gdi32.lib user32.lib shell32.lib /def:gimp.def

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

.c.i :
	$(CC) $(CFLAGS) -E $< >$@

clean:
	del *.exe
	del *.lib
	del *.obj
	del *.exp
	del *.err
	del *.map
	del *.sym
	del *.lk1
	del *.mk1
	del *.pdb
	del *.ilk
