DEFS      = -D__WINE__ -DSTDHEADERS
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ..
SRCDIR    = @srcdir@
VPATH     = @srcdir@
MODULE    = none
LIBEXT    = @LIBEXT@
SOVERSION = 1.0
SONAME    = libwineserver.$(LIBEXT)

SERVER_C_SRCS = \
	main.c

LIB_C_SRCS = \
	async.c \
	atom.c \
	cdrom_eject.c \
	change.c \
	console.c \
	context_i386.c \
	context_sparc.c \
	debugger.c \
	device.c \
	distributed.c \
	event.c \
	fd_server.c \
	file.c \
	gdbremote.c \
	handle.c \
	mapping.c \
	mem_malloc.c \
	mutex.c \
	named_pipe.c \
	object.c \
	process.c \
	ptrace.c \
	queue.c \
	registry.c \
	request.c \
	rpc_epmap.c \
	select.c \
	semaphore.c \
	serial.c \
	shm.c \
	snapshot.c \
	sock.c \
	thread.c \
	timer.c \
	trace.c \
	unicode.c \
	user.c \
	window.c \
	token.c

PROGRAMS = wineserver

SYMLINKS = \
	$(SONAME).$(SOVERSION)

all: $(PROGRAMS)

C_SRCS = $(LIB_C_SRCS) $(SERVER_C_SRCS)

LIB_OBJS = $(LIB_C_SRCS:.c=.o)
SERVER_OBJS = $(SERVER_C_SRCS:.c=.o)
OBJS = $(LIB_OBJS) $(SERVER_OBJS)

@MAKE_RULES@

$(SONAME): $(SONAME).$(SOVERSION)
	$(RM) $@ && $(LN_S) $^ $@

$(SONAME).$(SOVERSION): $(LIB_OBJS)
	$(LDSHARED) $(LIB_OBJS) -o $@

LDEXECFLAGS = @LDEXECFLAGS@
wineserver: $(SERVER_OBJS) $(SONAME)
	$(CC) -o $(PROGRAMS) $(LDEXECFLAGS) $(SERVER_OBJS) $(LIBUNICODE) $(LIBPORT) $(LIBWINESERVER) $(LIBS) $(LDFLAGS)

clean::
	$(RM) $(SYMLINKS)

install_so: $(SONAME).$(SOVERSION)
	[ -d $(libdir) ] || $(MKDIR) $(libdir)
	$(INSTALL_PROGRAM) $(SONAME).$(SOVERSION) $(libdir)/$(SONAME).$(SOVERSION)
	cd $(libdir) && $(RM) $(SONAME) && $(LN_S) $(SONAME).$(SOVERSION) $(SONAME)

install:: $(PROGRAMS)
	[ -d $(bindir) ] || $(MKDIR) $(bindir)
	$(INSTALL_PROGRAM) wineserver $(bindir)/wineserver

uninstall::
	$(RM) $(bindir)/wineserver
	cd $(libdir) && $(RM) $(SONAME) $(SONAME).$(SOVERSION)

install:: all $(LIBEXT:%=install_%)
                                                                                                                                                            
### Dependencies:
