#  Makefile for DSOM "part" samples (os2)

CC      = icc
CFLAGS  = -D_OS2 -W3 -c -Q+ -Ss+ -Gd- -Gm+ -Gs+ -Sm
CPPFLAGS   = -D__cplusplus -c -fd -Ti
LINKER  = link386
LFLAGS  = /exepack /packd /packc /align:4 /stack:360000 /pm:vio /noi /nol /deb /noe
OBJS    = part.obj client.obj initterm.obj
INCLS   = part.h
LIBLIST = os2386+somtk

all: $(SOMBASE)\include\somcorba.bld part.lib client.exe som.ir somdimpl

clean:	clnimpl
	-del *.obj *.h *.ih som.ir client.exe part.dll part.lib >nul 2>&1

clnimpl:
	-regimpl -D -i partServer
	-erase somdimpl

$(SOMBASE)\include\somcorba.bld:
	@echo This sample requires the CORBA-style C bindings
	@echo created using the somcorba command.
	@exit 1

.SUFFIXES: .obj .cpp .ih .idl .h

.c.obj:
	$(CC) $(CFLAGS) -Ge- $<

.cpp.obj:
	$(CC) $(CPPFLAGS) -Ge- $<

.idl.ih:
	sc -sh;ih $<

.idl.h:
	sc -sh;ih $<

part.obj: part.ih part.h part.c

initterm.obj:  initterm.c

### -- Build the "import library" for the DLL.
part.lib: part.dll
	implib part.lib part.def

### -- Build the DLL.
part.dll:  part.obj initterm.obj part.def
	$(LINKER) @part.lnk

### -- Build the executables.
client.obj: $(INCLS) client.cpp
	$(CC) $(CPPFLAGS) -Ge+ client.cpp
client.exe: part.lib client.obj
	$(LINKER) $(LFLAGS) client.obj,$@,NUL,$(LIBLIST)+part.lib;

### -- Put the IDL descriptions into the Interface Repository.
som.ir:
	sc $(SCFLAGS) -sir -u -mnolock *.idl

### -- Build the DSOM Implementation Repository.
somdimpl:
	regimpl -A -i partServer
	regimpl -a -i partServer -c Part
	regimpl -L -i partServer
	regimpl -l -i partServer
	@echo x > somdimpl

