## corba module declaration

SOURCES_corba = corba.c ../../../src/control/mediacontrol_plugin.c

nodist_SOURCES_corba = \
	MediaControl-common.c \
	MediaControl-skels.c \
	MediaControl-stubs.c \
	MediaControl.h \
	$(NULL)

if ENABLE_CORBA

GENERATEDFILES = MediaControl-common.c MediaControl-skels.c MediaControl.h

endif

CORBAIDLFILE = MediaControl.idl

EXTRA_DIST += $(CORBAIDLFILE)
BUILT_SOURCES += $(GENERATEDFILES)

if ENABLE_CORBA


corbaidldir = $(datadir)/idl
corbaidl_DATA = $(CORBAIDLFILE)

## orbittypelibdir = $(libdir)/orbit-2.0
orbittypelibdir = $(libdir)/advene
orbittypelib_DATA = MediaControl.so
orbittypelib_CFLAGS=`$(VLC_CONFIG) --cflags plugin corba`
orbittypelib_LIBS=`$(VLC_CONFIG) --libs plugin corba`

ORBIT_IDL=$(shell pkg-config --variable=orbit_idl ORBit-2.0)

## MediaControl.so rules
MediaControl-imodule.o: MediaControl-imodule.c
	$(CC) -fPIC -o $@ -c $< $(orbittypelib_CFLAGS)

MediaControl.so: MediaControl-imodule.o
	$(CC) -shared -o $@ $< $(orbittypelib_LIBS)

## We have to invoke 2 times $(ORBIT_IDL), else the --imodule
## invocation builds MediaControl-common.c without some
## glue code that is needed.
$(GENERATEDFILES): $(CORBAIDLFILE)
	$(ORBIT_IDL) --imodule $<
	$(ORBIT_IDL) $<

clean:
	$(RM) -f $(GENERATEDFILES)

endif
