# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL.  You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation.  Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation.  All Rights
# Reserved.

IGNORE_MANIFEST=1

#//------------------------------------------------------------------------
#//
#// Makefile to build the Java reflections of JavaScript objects
#//
#//------------------------------------------------------------------------


#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of NS
#//
#//------------------------------------------------------------------------
DEPTH= ..\..

!ifdef MOZ_JAVA
DIRS = classes
!endif


#//------------------------------------------------------------------------
#//
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
#//
#//------------------------------------------------------------------------
DLLNAME=jsj$(MOZ_BITS)$(VERSION_NUMBER)
PDBFILE=$(DLLNAME).pdb
MAPFILE		= $(DLLNAME).map
RESFILE		= jsj1640.res
DLL=.\$(OBJDIR)\$(DLLNAME).dll
MAKE_OBJ_TYPE	= DLL

!if "$(MOZ_BITS)" == "16"
DEFFILE		= $(DLLNAME).def
!endif

!ifdef MOZ_JAVA
LLIBS=$(LIBNSPR) $(DIST)\lib\jrt$(MOZ_BITS)$(VERSION_NUMBER).lib \
	$(DIST)\lib\js$(MOZ_BITS)$(VERSION_NUMBER).lib
!else
LLIBS=$(LIBNSPR) $(DIST)\lib\js$(MOZ_BITS)$(VERSION_NUMBER).lib
!endif

#//------------------------------------------------------------------------
#// 
#// Define the files necessary to build the target (ie. OBJS)
#//
#//------------------------------------------------------------------------
!ifdef MOZ_JAVA
OBJS=                                       \
    .\$(OBJDIR)\jsStubs.obj                 \
    .\$(OBJDIR)\jsjava.obj                  \
    .\$(OBJDIR)\jsjsa.obj                   \
    .\$(OBJDIR)\stubs.obj                   \
!if "$(MOZ_BITS)" == "16"
    .\$(OBJDIR)\jsj_nodl.obj                \
!endif
    $(NULL)
!else
OBJS=                                       \
    .\$(OBJDIR)\jsjava.obj                  \
    .\$(OBJDIR)\jsStubs.obj                 \
    $(NULL)
!endif # MOZ_JAVA
#

#//------------------------------------------------------------------------
#//
#// install headers
#//
#//------------------------------------------------------------------------
INSTALL_DIR=$(PUBLIC)\js
INSTALL_FILE_LIST=	\
	jsjava.h

#//------------------------------------------------------------------------
#//
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
#// (these must be defined before the common makefiles are included)
#//		  
#//------------------------------------------------------------------------

JRI_GEN=                            \
    netscape.javascript.JSObject            \
    netscape.javascript.JSException         \
	$(NULL)

MODULE = java
!ifdef MOZ_JAVA
EXPORTS =				       \
	$(JRI_GEN_DIR)/netscape_javascript_JSObject.h    \
	$(JRI_GEN_DIR)/netscape_javascript_JSException.h \
	$(NULL)
!endif


#//------------------------------------------------------------------------
#//
#// Define any local options for the make tools 
#//     (ie. LCFLAGS, LLFLAGS, LLIBS, LINCS)
#//
#//------------------------------------------------------------------------

LINCS=$(LINCS) -I_jri \
               -I$(PUBLIC)\js \
               -I$(PUBLIC)\java \
	$(NULL)

#!ifdef SERVER_BUILD
#LLIBS=$(DIST)/lib/httpdlw.lib $(DIST)/lib/libsjboot.lib
#!endif

#//------------------------------------------------------------------------
#//
#// Include the common makefile rules
#//
#//------------------------------------------------------------------------
include <$(DEPTH)/config/rules.mak>

export:: $(DLL) INSTALL_FILES
	$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
	$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib

clobber::
    $(RM_R) _jri 

!ifdef MOZ_JAVA
.\$(OBJDIR)\stubs.obj:					 \
	$(JRI_GEN_DIR)\netscape_javascript_JSObject.c	 \
	$(JRI_GEN_DIR)\netscape_javascript_JSException.c \
        $(NULL)
!endif

####
# this bit of extreme scariness came from the js/src makefile
#  reproduced here since that's where jsjava.c lives now...

!if ("$(MOZ_BITS)" == "16") 
#//
#// Win16 Hoovers SO BAD!!!   
#//

!if !defined(MOZ_DEBUG)
#//
#// We must turn off codeview debug info so jni.c can build.  
#// Otherwise the linker gives errors about data in the $SYMBOLS 
#// segment being beyond a segment boundary.
#//
$(OBJDIR)\jsjava.obj: jsjava.c
    @$(CC) @<<$(CFGFILE)
        -c 
        -Od 
        $(CFLAGS)
        $(LCFLAGS)
        $(LINCS) 
        $(LINCS_1) 
        $(INCS)
        -Fd$(PDBFILE)
        -Fo.\$(OBJDIR)\
        $(*B).c
<<KEEP
!endif
!endif
