TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ..
SRCDIR    = @srcdir@
VPATH     = @srcdir@

SUBDIRS        = @ALL_PROGRAM_DIRS@
INSTALLSUBDIRS = @ALL_PROGRAM_INSTALL_DIRS@
INSTALLPROGS   = @ALL_PROGRAM_BIN_INSTALL_DIRS@

INSTALLDIRS = $(DESTDIR)$(bindir)

PROGRAMS = wineapploader

@MAKE_RULES@

all: $(PROGRAMS) $(SUBDIRS)

wineapploader: wineapploader.in
	sed -e 's,@bindir\@,$(bindir),g' $(SRCDIR)/wineapploader.in >$@ || ($(RM) $@ && false)

# Rules for installation

.PHONY: install-apploader install-progs install-progs.so $(INSTALLPROGS:%=%/__installprog__)

install-apploader: wineapploader $(INSTALLDIRS) dummy
	$(INSTALL_SCRIPT) wineapploader $(DESTDIR)$(bindir)/wineapploader

$(INSTALLPROGS:%=%/__installprog__): install-apploader
	$(RM) $(DESTDIR)$(bindir)/`dirname $@` && $(LN) $(DESTDIR)$(bindir)/wineapploader $(DESTDIR)$(bindir)/`dirname $@`

install-progs.so: $(INSTALLPROGS:%=%/__installprog__)
	$(RM) $(DESTDIR)$(bindir)/wineapploader

install-progs: # nothing to do here

install install-lib:: install-progs$(DLLEXT) $(INSTALLDIRS)

uninstall::
	-cd $(DESTDIR)$(bindir) && $(RM) wineapploader $(INSTALLPROGS)
	-rmdir $(DESTDIR)$(dlldir)

# Rules for testing

check test:: $(SUBDIRS:%=%/__test__)