DEFS       = @DLLFLAGS@ -DSTRICT -DNONAMELESSUNION -DNONAMELESSSTRUCT
LDDLLFLAGS = @LDDLLFLAGS@
TOPSRCDIR  = @top_srcdir@
TOPOBJDIR  = ../..
SRCDIR     = @srcdir@
VPATH      = @srcdir@
MODULE     = none
PROGRAMS   = icinfo aviinfo aviplay
ALL_LIBS   = $(LIBWINE) $(LIBS)

SPEC_SRCS = \
	icinfo.spec \
	aviinfo.spec \
	aviplay.spec

all: $(PROGRAMS)

@MAKE_RULES@

aviinfo.spec.c: aviinfo.spec aviinfo.o $(WINEBUILD)
	$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -L $(DLLDIR) -sym aviinfo.o -o aviinfo.spec.c -spec $(SRCDIR)/aviinfo.spec

aviplay.spec.c: aviplay.spec aviplay.o $(WINEBUILD)
	$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -L $(DLLDIR) -sym aviplay.o -o aviplay.spec.c -spec $(SRCDIR)/aviplay.spec

icinfo.spec.c: icinfo.spec icinfo.o $(WINEBUILD)
	$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -L $(DLLDIR) -sym icinfo.o -o icinfo.spec.c -spec $(SRCDIR)/icinfo.spec

aviinfo.so: aviinfo.o aviinfo.spec.o
	$(LDSHARED) $(LDDLLFLAGS) -o aviinfo.so aviinfo.o aviinfo.spec.o $(ALL_LIBS)

aviplay.so: aviplay.o aviplay.spec.o
	$(LDSHARED) $(LDDLLFLAGS) -o aviplay.so aviplay.o aviplay.spec.o $(ALL_LIBS)

icinfo.so: icinfo.o icinfo.spec.o
	$(LDSHARED) $(LDDLLFLAGS) -o icinfo.so icinfo.o icinfo.spec.o $(ALL_LIBS)

aviinfo: aviinfo.so
	$(RM) aviinfo && $(LN_S) $(TOPOBJDIR)/wine aviinfo

aviplay: aviplay.so
	$(RM) aviplay && $(LN_S) $(TOPOBJDIR)/wine aviplay

icinfo: icinfo.so
	$(RM) icinfo && $(LN_S) $(TOPOBJDIR)/wine icinfo

install:: $(PROGRAMS:%=%.so)
	[ -d $(bindir) ] || $(MKDIR) $(bindir)
	$(INSTALL_PROGRAM) aviinfo.so $(bindir)/aviinfo.so
	$(INSTALL_PROGRAM) aviplay.so $(bindir)/aviplay.so
	$(INSTALL_PROGRAM) icinfo.so $(bindir)/icinfo.so
	cd $(bindir) && $(LN_S) wine aviinfo && $(LN_S) wine aviplay && $(LN_S) wine icinfo

uninstall::
	$(RM) $(bindir)/aviinfo.so $(bindir)/aviplay.so $(bindir)/icinfo.so
	$(RM) $(bindir)/aviinfo $(bindir)/aviplay $(bindir)/icinfo

checklink:: $(PROGRAMS:%=%.so)
	$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c aviinfo.so $(ALL_LIBS) && $(RM) checklink
	$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c aviplay.so $(ALL_LIBS) && $(RM) checklink
	$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c icinfo.so $(ALL_LIBS) && $(RM) checklink

### Dependencies:
