# Makefile for mingw (with gnu make, but without bash), use :
# make -f makefile.mingw

WARNINGS =

TOP = ../..
PRJ_TOP = ..
PACKAGE = dia
include $(TOP)/glib/build/win32/make.mingw

LIBART = $(TOP)/libart_lgpl

# -DHAVE_LIBPNG 
PKG_CFLAGS = -DHAVE_CONFIG_H \
	-fno-exceptions \
	-I.. $(GLIB_CFLAGS) $(GTK2_CFLAGS) \
	$(LIBXML2_CFLAGS) $(PNG_CFLAGS) \
	-I$(PRJ_TOP)/lib -I$(LIBART)/.. -DHAVE_LIBART

PKG_LINK = $(GLIB_LIBS) $(GTK2_LIBS) $(PANGO_LIBS) \
	$(LIBXML2_LIBS) $(PNG_LIBS) \
	-L $(PRJ_TOP)/lib -llibdia -L $(LIBART) -llibart \

OBJECTS = \
	autosave.o \
	app_procs.o \
	color_area.o \
	commands.o \
	connectionpoint_ops.o \
	create_object.o \
	cursor.o \
	cut_n_paste.o \
	defaults.o \
	diagram.o \
	diagram_tree.o \
	diagram_tree_menu.o \
	diagram_tree_menu_callbacks.o \
	diagram_tree_window.o \
	dialogs.o \
	diapagelayout.o \
	dia-props.o \
	diaunitspinner.o \
	disp_callbacks.o \
	display.o \
	dynamic_refresh.o \
	exit_dialog.o \
	export_png.o \
	filedlg.o \
	grid.o \
	group.o \
	gtkhwrapbox.o \
	gtkvwrapbox.o \
	gtkwrapbox.o \
	handle_ops.o \
	interface.o \
	layer_dialog.o \
	lineprops_area.o \
	linewidth_area.o \
	load_save.o \
	magnify.o \
	main.o \
	menus.o \
	modify_tool.o \
	object_ops.o \
	pagesetup.o \
	paginate_gdiprint.o \
	paginate_psprint.o \
	plugin-manager.o \
	preferences.o \
	properties-dialog.o \
	recent_files.o \
	render_eps.o \
	render_gdk.o \
	render_libart.o \
	render_pixmap.o \
	scroll_tool.o \
	select.o \
	sheets.o \
	sheets_dialog.o \
	sheets_dialog_callbacks.o \
	splash.o \
	tool.o \
	undo.o \
	win32print.o \
	winmain.o \



DEPCFLAGS = $(PKG_CFLAGS)

## targets
all : \
	$(PRJ_TOP)/config.h \
	$(PACKAGE).exe

$(PACKAGE).res : $(PACKAGE).rc $(PACKAGE).ico
	rc -r -fo $(PACKAGE).res $(PACKAGE).rc

RESOURCE = $(PACKAGE).res

$(PACKAGE).lib : $(OBJECTS)
	lib /out:$(PACKAGE).lib $(OBJECTS)

$(PACKAGE).dll : $(OBJECTS) $(PACKAGE).def
	$(CC) $(CFLAGS) -LD -Fe$(PACKAGE).dll $(OBJECTS) $(PKG_LINK) user32.lib advapi32.lib wsock32.lib comdlg32.lib winspool.lib $(LDFLAGS) /def:$(PACKAGE).def

$(PACKAGE).exe : $(OBJECTS) $(PACKAGE).def $(PACKAGE).res
	$(CC) $(CFLAGS) -s -o $@ $(OBJECTS) $(LDFLAGS) $(PKG_LINK) -luser32 -lgdi32 -ladvapi32 -lshell32 -lwsock32 -lwinspool -lcomdlg32
# -mwindows 
# /def:$(PACKAGE).def

$(PRJ_TOP)\config.h: $(PRJ_TOP)\config.h.win32
	copy $(PRJ_TOP)\config.h.win32 $(PRJ_TOP)\config.h

clean::
	del config.h
	del *.exe
	del *.o
	del *.dll
	del *.lib
	del *.err
	del *.map
	del *.sym
	del *.exp
	del *.lk1
	del *.mk1
	del *.pdb
	del *.ilk
