#
# @(#)Makefile	1.3 98/03/26
#
# Copyright 1997 by Sun Microsystems, Inc.,
# 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
# All rights reserved.
#
# This software is the confidential and proprietary information
# of Sun Microsystems, Inc. ("Confidential Information").  You
# shall not disclose such Confidential Information and shall use
# it only in accordance with the terms of the license agreement
# you entered into with Sun.
#

PLATFORM       = win32
JDK            = ..\..\..\..\build\win32
VERSION        = 1.2
VARIANT        = 

OINCLUDES = -I$(JDK)\include\$(PLATFORM) -I$(JDK)\include
!if "$(VERSION)" == "1.2"
INCLUDES       = $(OINCLUDES) \
		 -I$(JDK)\include-old\$(PLATFORM) -I$(JDK)\include-old
JVMLIB	       = jvm.lib
!endif
!if "$(VERSION)" == "1.1"
INCLUDES       = $(OINCLUDES)
JVMLIB	       = javai.lib
!endif

!if "$(VARIANT)" == "DBG"
G            = _g
DEBUG_CFLAGS = -DDEBUG -Zi -Od
DEBUG_LDFLAGS = -debug
TRACE        = -trace
!endif

CC	 = cl
LD	 = link
CLASSES  = OldNMI.class Helper.class
HEADERS  = $(CLASSES:.class=.h)
CFILES   = $(CLASSES:.class=.c)
OBJECTS  = OldNMI.obj OldNMI-impl.obj
CFLAGS   = -nologo $(INCLUDES) $(DEBUG_CFLAGS) -DWIN32
LDFLAGS  = -libpath:$(JDK)\lib $(JVMLIB) $(DEBUG_LDFLAGS)

OldNMI$G.dll: $(CLASSES) $(CFILES) $(HEADERS) $(OBJECTS)
	link -nologo -dll -out:$@ $(LDFLAGS) $(OBJECTS)

.SUFFIXES: .java .class

.java.class:
	$(JDK)\bin\javac $<

.class.c:
	$(JDK)\bin\javah -stubs $(TRACE) $(<:.class=)

.class.h:
	$(JDK)\bin\javah $(<:.class=)
	@echo $@ >> .generated.files

clean:
	rm -f *.class *.obj *.dll *.exp *.lib *.pdb
	rm -f OldNMI.c OldNMI.h Helper.h Helper.c

run: OldNMI$G.dll
	$(JDK)\bin\java$G OldNMI

debug:
	$(MAKE) VARIANT=DBG
debug-run:
	$(MAKE) VARIANT=DBG run
