
top = $(OMF_ROOT)

LIBRARIES = -L$(top)/lib
INCLUDES = -I$(top)

CXX = g++
CXXFLAGS = -g -Wall $(INCLUDES) $(LIBRARIES)

mod = \
	ModelElement \
	Namespace \
	GeneralizableElement \
	TypedElement \
	Classifier \
	Class \
	DataType \
	PrimitiveType \
	CollectionType \
	EnumerationType \
	AliasType \
	StructureType \
	StructureField \
	Feature \
	StructuralFeature \
	Attribute \
	Reference \
	BehavioralFeature \
	Operation \
	Exception \
	Association \
	AssociationEnd \
	Package \
	Import \
	Parameter \
	Constraint \
	Constant \
	Tag \
	VisibilityKind \
	DirectionKind \
	ScopeKind \
	AggregationKind \
	EvaluationKind \
	MultiplicityType \
	Contains \
	Generalizes \
	RefersTo \
	Exposes \
	IsOfType \
	CanRaise \
	Aliases \
	Constrains \
	DependsOn \
	AttachesTo \
	ModelPackage \
	ModelLibrary
obj = $(mod:%=%.o)
dep = $(mod:%=%.dep)
lib = $(top)/lib/libModel.so

%.o: %.cpp
	$(CXX) -c $(CXXFLAGS) -o $@ $<

%.dep: %.cpp
	$(CXX) -c -MM $(CXXFLAGS) -o $@ $<

all: $(lib)

$(lib): $(obj)
	$(CXX) -shared $(CXXFLAGS) -o $(lib) $(obj)

depend: $(dep)
	echo "" > .deps
	for i in $(dep); do \
		cat $$i >> .deps; \
	done

clean:
	rm -f $(obj) $(dep) $(lib) *~

include .deps