#// The contents of this file are subject to the Netscape Public
#// License Version 1.1 (the "License"); you may not use this file
#// except in compliance with the License. You may obtain a copy of
#// the License at http://www.mozilla.org/NPL/
#//
#// Software distributed under the License is distributed on an "AS
#// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
#// implied. See the License for the specific language governing
#// rights and limitations under the License.
#//
#// The Original Code is Mozilla Communicator client code, released
#// March 31, 1998.
#//
#// The Initial Developer of the Original Code is Netscape
#// Communications Corporation.  Portions created by Netscape are
#// Copyright (C) 1998 Netscape Communications Corporation. All
#// Rights Reserved.
#//
#// Contributor(s): 
#//
#// Alternatively, the contents of this file may be used under the
#// terms of the GNU Public License (the "GPL"), in which case the
#// provisions of the GPL are applicable instead of those above.
#// If you wish to allow use of your version of this file only
#// under the terms of the GPL and not to allow others to use your
#// version of this file under the NPL, indicate your decision by
#// deleting the provisions above and replace them with the notice
#// and other provisions required by the GPL.  If you do not delete
#// the provisions above, a recipient may use your version of this
#// file under either the NPL or the GPL.

#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of NS
#//
#//------------------------------------------------------------------------
DEPTH=..\..
MODULE=js
include <$(DEPTH)\config\config.mak>

# Because WIN95 doesn't support recursive make, still need fdlibm in DIRS
!if "$(WINOS)" == "WIN95"
DIRS = $(DIRS) fdlibm
!endif

#//------------------------------------------------------------------------
#//
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
#//
#//------------------------------------------------------------------------

DLLNAME		= js$(MOZ_BITS)$(VERSION_NUMBER)
DLL1NAME	= js1$(MOZ_BITS)$(VERSION_NUMBER)
PDBFILE		= $(DLLNAME).pdb
MAPFILE		= $(DLLNAME).map
RESFILE		= js$(MOZ_BITS)40.res
DLL		=.\$(OBJDIR)\$(DLLNAME).dll
MAKE_OBJ_TYPE	= DLL

!if "$(MOZ_BITS)" != "16"
LINCS = \
        -I$(DEPTH)\include \
        $(NULL)
!endif

!if "$(MOZ_BITS)" == "16"
!ifdef NSPR20
DEFFILE		= $(DLL1NAME).def
!else
DEFFILE		= $(DLLNAME).def
!endif
!endif

FDLIBM_LIBRARY	=	fdlibm\$(OBJDIR)\fdlibm.lib

LLIBS=$(LIBNSPR) $(FDLIBM_LIBRARY)
LCFLAGS= $(LCFLAGS) -DEXPORT_JS_API

#//------------------------------------------------------------------------
#// 
#// Define the files necessary to build the target (ie. OBJS)
#//
#//------------------------------------------------------------------------
OBJS =					\
	.\$(OBJDIR)\jsapi.obj		\
	.\$(OBJDIR)\jsarena.obj		\
	.\$(OBJDIR)\jsarray.obj		\
	.\$(OBJDIR)\jsatom.obj		\
	.\$(OBJDIR)\jsbool.obj		\
	.\$(OBJDIR)\jscntxt.obj		\
	.\$(OBJDIR)\jsdate.obj		\
	.\$(OBJDIR)\jsdbgapi.obj	\
	.\$(OBJDIR)\jsdhash.obj	        \
	.\$(OBJDIR)\jsdtoa.obj		\
	.\$(OBJDIR)\jsemit.obj		\
	.\$(OBJDIR)\jsexn.obj		\
	.\$(OBJDIR)\jsfun.obj		\
	.\$(OBJDIR)\jsgc.obj		\
	.\$(OBJDIR)\jshash.obj		\
	.\$(OBJDIR)\jsinterp.obj	\
	.\$(OBJDIR)\jslock.obj		\
	.\$(OBJDIR)\jslog2.obj		\
	.\$(OBJDIR)\jslong.obj		\
	.\$(OBJDIR)\jsmath.obj		\
	.\$(OBJDIR)\jsnum.obj		\
	.\$(OBJDIR)\jsobj.obj		\
	.\$(OBJDIR)\jsopcode.obj	\
	.\$(OBJDIR)\jsparse.obj		\
	.\$(OBJDIR)\jsprf.obj		\
	.\$(OBJDIR)\jsregexp.obj	\
	.\$(OBJDIR)\jsscan.obj		\
	.\$(OBJDIR)\jsscope.obj		\
	.\$(OBJDIR)\jsscript.obj	\
	.\$(OBJDIR)\jsstr.obj		\
	.\$(OBJDIR)\jsutil.obj		\
	.\$(OBJDIR)\jsxdrapi.obj	\
	.\$(OBJDIR)\prmjtime.obj	\
	$(NULL)

#//------------------------------------------------------------------------
#//
#// install headers
#//
#//------------------------------------------------------------------------
EXPORTS = \
	js.msg		\
	jsapi.h		\
	jsarray.h	\
	jsarena.h	\
	jsatom.h	\
	jsbit.h	 	\
	jsbool.h	\
	jsclist.h	\
	jscntxt.h	\
	jscompat.h	\
	jsconfig.h	\
	jscpucfg.h	\
	jsdate.h	\
	jsdbgapi.h	\
	jsdhash.h	\
	jsemit.h	\
	jsfun.h		\
	jsgc.h		\
	jshash.h	\
	jsinterp.h	\
	jslock.h	\
	jslong.h	\
	jsmath.h	\
	jsnum.h		\
	jsobj.h		\
	jsopcode.tbl	\
	jsopcode.h	\
	jsosdep.h	\
	jsotypes.h	\
	jsparse.h	\
	jsprf.h		\
	jsprvtd.h	\
	jspubtd.h	\
	jsregexp.h	\
	jsscan.h	\
	jsscope.h	\
	jsscript.h	\
	jsstr.h		\
	jstypes.h	\
	jsutil.h	\
	jsxdrapi.h	\
	jsstddef.h \
	$(NULL)

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

.\$(OBJDIR)\jsmath.obj: $(FDLIBM_LIBRARY)

#// Ripped from mozilla/config/rule.mak $(DIRS):: rule
$(FDLIBM_LIBRARY):
!if "$(WINOS)" == "WIN95"
!if defined(VERBOSE)
    @echo +++ make: cannot recursively make on win95 using command.com, use w95make.
!endif
!else
    @echo +++ make: %MAKE_ARGS% in $(MAKEDIR)\$@
	@cd fdlibm
	@$(NMAKE) -f makefile.win %%MAKE_ARGS%%
    @cd $(MAKEDIR) 
!endif

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

#//------------------------------------------------------------------------
#//
#// Standalone js.exe interpreter
#//
#//------------------------------------------------------------------------

#//PROGRAM = $(OBJDIR)\js.exe
#//js:	$(PROGRAM)
#//
#//$(PROGRAM): $(OBJDIR)\js.obj $(LIBRARY)
#//	    @$(MAKE_OBJDIR)
#//	    $(link) /debug /out:$(PROGRAM) $(OBJDIR)\js.obj $(DIST)\lib\pr3240.lib $(LIBRARY) $(LDFLAGS)
#//
#//$(OBJDIR)\js.obj: js.c
#//		$(CC) /Fo$(OBJDIR)\js.obj js.c $(CFLAGS)
