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

C_SRCS = \
	main.c \
	preloader.c \
	pthread.c

MAIN_OBJS = pthread.o main.o

EXTRA_BINARIES = @EXTRA_BINARIES@

PROGRAMS = \
	wine \
	wine-installed \
	wine-preloader

MANPAGES = \
	wine.man \
	wine.de.man \
	wine.fr.man

INSTALLDIRS = \
	$(DESTDIR)$(bindir) \
	$(DESTDIR)$(mandir)/man$(prog_manext) \
	$(DESTDIR)$(mandir)/de.UTF-8/man$(prog_manext) \
	$(DESTDIR)$(mandir)/fr.UTF-8/man$(prog_manext)

all: wine wine-installed $(EXTRA_BINARIES) $(MANPAGES)

@MAKE_RULES@

LIBPTHREAD  = @LIBPTHREAD@
LDEXECFLAGS = @LDEXECFLAGS@

wine-preloader: preloader.o Makefile.in
	$(CC) -o $@ -static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7c000000 preloader.o $(LIBPORT) $(LDFLAGS)

wine: $(MAIN_OBJS) Makefile.in
	$(CC) -o $@ $(LDEXECFLAGS) $(MAIN_OBJS) $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS) $(LDRPATH_LOCAL)

wine-installed: $(MAIN_OBJS) Makefile.in
	$(CC) -o $@ $(LDEXECFLAGS) $(MAIN_OBJS) $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS) $(LDRPATH_INSTALL)

$(EXTRA_BINARIES:%=__install__%): $(EXTRA_BINARIES) $(DESTDIR)$(bindir) dummy
	f=`expr $@ : '__install__\(.*\)'` && $(INSTALL_PROGRAM) $$f $(DESTDIR)$(bindir)/$$f

.PHONY: $(EXTRA_BINARIES:%=__install__%)

install install-lib:: wine-installed $(EXTRA_BINARIES:%=__install__%) $(MANPAGES) $(INSTALLDIRS)
	$(INSTALL_PROGRAM) wine-installed $(DESTDIR)$(bindir)/$(MODULE)
	$(INSTALL_DATA) wine.man $(DESTDIR)$(mandir)/man$(prog_manext)/wine.$(prog_manext)
	$(INSTALL_DATA) wine.de.man $(DESTDIR)$(mandir)/de.UTF-8/man$(prog_manext)/wine.$(prog_manext)
	$(INSTALL_DATA) wine.fr.man $(DESTDIR)$(mandir)/fr.UTF-8/man$(prog_manext)/wine.$(prog_manext)

uninstall::
	-cd $(DESTDIR)$(bindir) && $(RM) $(EXTRA_BINARIES) $(MODULE)
	$(RM) $(DESTDIR)$(mandir)/man$(prog_manext)/wine.$(prog_manext)
	$(RM) $(DESTDIR)$(mandir)/de.UTF-8/man$(prog_manext)/wine.$(prog_manext)
	$(RM) $(DESTDIR)$(mandir)/fr.UTF-8/man$(prog_manext)/wine.$(prog_manext)

@DEPENDENCIES@  # everything below this line is overwritten by make depend