#include "../autoconf.h"
#include "../Wine.tmpl"

MODULE = if1632

SRCS = \
	callback.c \
	relay.c \
	relay32.c

#ifdef WINELIB
CALLOBJS =
DLLS16 =
DLLS32 =
#else
CALLOBJS = \
	call16.o \
	call32.o
DLLS16 = \
	commdlg.spec \
	compobj.spec \
	ddeml.spec \
	gdi.spec \
	kernel.spec \
	keyboard.spec \
	mmsystem.spec \
	mouse.spec \
	ole2.spec \
	ole2conv.spec \
	ole2disp.spec \
	ole2nls.spec \
	ole2prox.spec \
	olecli.spec \
	olesvr.spec \
	shell.spec \
	sound.spec \
	storage.spec \
	stress.spec \
	system.spec \
	toolhelp.spec \
	user.spec \
	win87em.spec \
	winprocs.spec \
	winsock.spec
DLLS32 = \
	gdi32.spec \
	kernel32.spec \
	shell32.spec \
	user32.spec \
	winprocs32.spec
#endif

OBJS = $(SRCS:.c=.o) $(CALLOBJS) $(DLLS16:.spec=.o) $(DLLS32:.spec=.o)

BUILD = $(TOP)/tools/build

#define MakeDll16FromSpec(name)			@@\
name.S : name.spec $(BUILD)			@@\
	$(BUILD) -spec16 name.spec > name.S	@@\

#define MakeDll32FromSpec(name)			@@\
name.c : name.spec $(BUILD)			@@\
	$(BUILD) -spec32 name.spec > name.c	@@\

/*
 * If you add a new spec file, copy one of these lines
 */
MakeDll16FromSpec(commdlg)
MakeDll16FromSpec(compobj)
MakeDll16FromSpec(ddeml)
MakeDll16FromSpec(gdi)
MakeDll16FromSpec(kernel)
MakeDll16FromSpec(keyboard)
MakeDll16FromSpec(shell)
MakeDll16FromSpec(mmsystem)
MakeDll16FromSpec(mouse)
MakeDll16FromSpec(ole2)
MakeDll16FromSpec(ole2conv)
MakeDll16FromSpec(ole2disp)
MakeDll16FromSpec(ole2nls)
MakeDll16FromSpec(ole2prox)
MakeDll16FromSpec(olecli)
MakeDll16FromSpec(olesvr)
MakeDll16FromSpec(sound)
MakeDll16FromSpec(storage)
MakeDll16FromSpec(stress)
MakeDll16FromSpec(system)
MakeDll16FromSpec(toolhelp)
MakeDll16FromSpec(user)
MakeDll16FromSpec(win87em)
MakeDll16FromSpec(winprocs)
MakeDll16FromSpec(winsock)

MakeDll32FromSpec(gdi32)
MakeDll32FromSpec(kernel32)
MakeDll32FromSpec(shell32)
MakeDll32FromSpec(user32)
MakeDll32FromSpec(winprocs32)

WineRelocatableTarget($(MODULE),,$(OBJS))
DependTarget()

#ifndef WINELIB

call32.S: $(BUILD) $(DLLS16:.spec=.S)
	$(BUILD) -call32 `cat $(DLLS16:.spec=.S) | grep CallTo32_ | sed 's/.*CallTo32_\(.*\)/\1/' | sort | uniq` > call32.S

call16.S: $(BUILD) $(TOP)/include/callback.h
	$(BUILD) -call16 `cat $(TOP)/include/callback.h | grep "extern.*CallTo16_" | sed 's/.*CallTo16_\(.*\)(.*/\1/' | sort | uniq` > call16.S

#endif  /* WINELIB */

includes::

install::

clean::
	$(RM) $(DLLS16:.spec=.S) $(DLLS32:.spec=.c) call32.S call16.S
