!IFNDEF PACKAGE

PLUGINS = aadl chronogram custom er flowchart fs grafcet \
	Istar Jackson Kaos misc network sadt standard uml \
	Database Sozi custom_lines

#outdated:	labels

# now shapes only: sybase 
# specware eml 

# The main target
all : sub-all

sub-all: 
	for %d in ($(PLUGINS)) do @nmake -nologo -f makefile.msc sub-one THIS=%d

sub-one:
	@cd $(THIS)
	@nmake -nologo -f ..\makefile.msc $(THIS).dll PACKAGE=$(THIS) OBJ_$(THIS)=1
	@cd ..

clean:
	for %d in ($(PLUGINS)) do @nmake -nologo -f makefile.msc sub-clean THIS=%d

sub-clean:
	@cd $(THIS)
	@nmake -nologo -f ..\makefile.msc PACKAGE=$(THIS) clean
	@cd ..

!ELSE

TOP = ..\..\..
PRJ_TOP = ..\..
PKG_DEF = ..\objects.def
!INCLUDE $(PRJ_TOP)\dia-make.msc

INCLUDES = \
	-FImsvc_recommended_pragmas.h \
	-I. -I$(PRJ_TOP) \
	$(GLIB_CFLAGS) $(GTK2_CFLAGS) $(INTL_CFLAGS) \
	$(LIBXML2_CFLAGS) -I$(PRJ_TOP)\lib \

DEFINES = \
	-DHAVE_CONFIG_H \
	-DG_DISABLE_DEPRECATED \
	-DGTK_DISABLE_DEPRECATED \

PKG_LINK = $(GLIB_LIBS) $(INTL_LIBS) \
	$(PRJ_TOP)\lib\libdia.lib \
	$(CAIRO_LIBS)

#
# Object definitions for the various plugins
#
!IFDEF OBJ_aadl
OBJECTS = \
	aadl.obj \
	aadlbox.obj \
	aadlbus.obj \
	aadldata.obj \
	aadldevice.obj \
	aadlmemory.obj \
	aadlpackage.obj \
	aadlport.obj \
	aadlprocess.obj \
	aadlprocessor.obj \
	aadlsubprogram.obj \
	aadlsystem.obj \
	aadltext.obj \
	aadlthread.obj \
	aadlthreadgroup.obj \
	edit_port_declaration.obj

PKG_LINK = $(PKG_LINK) $(GTK2_LIBS)
!ENDIF

!IFDEF OBJ_bondgraph
OBJECTS = \
	bondgraph.obj \
!ENDIF

!IFDEF OBJ_chronogram
OBJECTS = \
	chronogram.obj \
	chronoline.obj \
	chronoline_event.obj \
	chronoref.obj \
!ENDIF

!IFDEF OBJ_custom
OBJECTS = \
	custom.obj \
	custom_object.obj \
	custom_util.obj \
	shape_info.obj \
	shape_typeinfo.obj
PKG_LINK = $(PKG_LINK) $(LIBXML2_LIBS) 
!ENDIF

!IFDEF OBJ_custom_lines
OBJECTS = \
	custom_lines.obj \
	custom_linetypes.obj \
	line_info.obj
PKG_LINK = $(PKG_LINK) $(LIBXML2_LIBS) 
!ENDIF

!IFDEF OBJ_Database
OBJECTS = \
	compound.obj \
	database.obj \
	reference.obj \
	table.obj
PKG_LINK = $(PKG_LINK) 
!ENDIF

!IFDEF OBJ_Sozi
OBJECTS = \
	sozi.obj \
	sozi-frame.obj \
	sozi-media.obj \
	sozi-object.obj
PKG_LINK = $(PKG_LINK) $(LIBXML2_LIBS) \
	$(GTK2_LIBS)
!ENDIF

!IFDEF OBJ_eml
OBJECTS = \
	dbox.obj \
	eml.obj \
	instantiation.obj \
	interaction.obj \
	interaction-ortho.obj \
	listfun.obj \
	nlist.obj \
	process.obj \
	process_dialog.obj
!ENDIF

!IFDEF OBJ_er
OBJECTS = \
	attribute.obj \
	entity.obj \
	er.obj \
	participation.obj \
	relationship.obj
!ENDIF

!IFDEF OBJ_flowchart
OBJECTS = \
	box.obj \
	diamond.obj \
	ellipse.obj \
	flowchart.obj \
	parallelogram.obj
!ENDIF

!IFDEF OBJ_fs
OBJECTS = \
	flow.obj \
	flow-ortho.obj \
	fs.obj \
	function.obj
!ENDIF

!IFDEF OBJ_grafcet
OBJECTS = \
	action.obj \
	action_text_draw.obj \
	boolequation.obj \
	condition.obj \
	grafcet.obj \
	step.obj \
	transition.obj \
	vector.obj \
	vergent.obj
!ENDIF

!IFDEF OBJ_Istar
OBJECTS = \
	actor.obj \
	goal.obj \
	istar.obj \
	link.obj \
	other.obj
!ENDIF

!IFDEF OBJ_Jackson
OBJECTS = \
	domain.obj \
	jackson.obj \
	phenomenon.obj \
	requirement.obj
!ENDIF

!IFDEF OBJ_Kaos
OBJECTS = \
	goal.obj \
	kaos.obj \
	metaandorrel.obj \
	metabinrel.obj \
	other.obj
!ENDIF

!IFDEF OBJ_labels
OBJECTS = \
	labels.obj \
	labelline.obj \
	labeltextobj.obj
!ENDIF

!IFDEF OBJ_misc
OBJECTS = \
	analog_clock.obj \
	grid_object.obj \
	measure.obj \
	n_gon.obj \
	tree.obj \
	diagram_as_object.obj \
	libmisc.obj
!ENDIF

!IFDEF OBJ_network
OBJECTS = \
	basestation.obj \
	bus.obj \
	network.obj \
	radiocell.obj \
	wanlink.obj
!ENDIF

!IFDEF OBJ_sadt
OBJECTS = \
	annotation.obj \
	arrow.obj \
	box.obj \
	sadt.obj
!ENDIF

!IFDEF OBJ_standard
OBJECTS = \
	arc.obj \
	bezier.obj \
	beziergon.obj \
	box.obj \
	ellipse.obj \
	image.obj \
	line.obj \
	outline.obj \
	polygon.obj \
	polyline.obj \
	standard.obj \
	textobj.obj \
	zigzagline.obj

ICON_PNG_PAIRS= \
	arc_icon pixmaps\arc.png \
	beziergon_icon pixmaps\beziergon.png \
	bezierline_icon pixmaps\bezierline.png \
	box_icon pixmaps\box.png \
	ellipse_icon pixmaps\ellipse.png \
	image_icon pixmaps\image.png \
	outline_icon pixmaps\outline.png \
	line_icon pixmaps\line.png \
	polygon_icon pixmaps\polygon.png \
	polyline_icon pixmaps\polyline.png \
	text_icon pixmaps\text.png \
	zigzagline_icon pixmaps\zigzagline.png

ICON_PNGS= \
	pixmaps\arc.png \
	pixmaps\beziergon.png \
	pixmaps\bezierline.png \
	pixmaps\box.png \
	pixmaps\ellipse.png \
	pixmaps\image.png \
	pixmaps\line.png \
	pixmaps\outline.png \
	pixmaps\polygon.png \
	pixmaps\polyline.png \
	pixmaps\text.png \
	pixmaps\zigzagline.png 

$(OBJECTS) : tool-icons.h

tool-icons.h: $(ICON_PNGS)
	gdk-pixbuf-csource --raw --build-list $(ICON_PNG_PAIRS) > tool-icons.h

!ENDIF

!IFDEF OBJ_specware
OBJECTS = \
        specware.obj \
        arch_component.obj \
        arch_connector.obj \
        arch_state.obj \
        mapping.obj
# this plug-in imports diagram_load_and_display () from dia.exe 
PKG_LINK = $(PKG_LINK) ..\..\app\dia-app.lib
!ENDIF

!IFDEF OBJ_sybase
OBJECTS = \
	dataserver.obj \
	repserver.obj \
	ltm.obj \
	client.obj \
	stableq.obj \
	rsm.obj \
	sybase.obj
!ENDIF

!IFDEF OBJ_uml
OBJECTS = \
	activity.obj \
	actor.obj \
	association.obj \
	branch.obj \
	class.obj \
	class_dialog.obj \
	class_attributes_dialog.obj \
	class_operations_dialog.obj \
	class_templates_dialog.obj \
	classicon.obj \
	component.obj \
	component_feature.obj \
	constraint.obj \
	dependency.obj \
	fork.obj \
	generalization.obj \
	implements.obj \
	large_package.obj \
	lifeline.obj \
	message.obj \
	node.obj \
	note.obj \
	object.obj \
	realizes.obj \
	small_package.obj \
	state.obj \
	state_term.obj \
	stereotype.obj \
	transition.obj \
	uml.obj \
	umlattribute.obj \
	umlformalparameter.obj \
	umloperation.obj \
	umlparameter.obj \
	usecase.obj \

PKG_LINK = $(PKG_LINK) $(GTK2_LIBS)
!ENDIF

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

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

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

!ENDIF

