#  Copyright (c) 1994, 1995, 1996
# 	The Regents of the University of California.  All rights reserved.
#
#  Redistribution and use in source and binary forms, with or without
#  modification, are permitted provided that: (1) source code distributions
#  retain the above copyright notice and this paragraph in its entirety, (2)
#  distributions including binary code include the above copyright notice and
#  this paragraph in its entirety in the documentation or other materials
#  provided with the distribution, and (3) all advertising materials mentioning
#  features or use of this software display the following acknowledgement:
#  ``This product includes software developed by the University of California,
#  Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
#  the University nor the names of its contributors may be used to endorse
#  or promote products derived from this software without specific prior
#  written permission.
#  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# @(#) $Header: /usr/src/mash/repository/common/conf/makefile.win,v 1.6 1998/09/04 20:37:20 haoboy Exp $

MSVCDIR	= c:\msdev
TOOLS32	= $(MSVCDIR)
PATH	= $(MSVCDIR);$(PATH);c:\bin
INCLUDE	= $(MSVCDIR)\include

# comment this out to build with debug options
NODEBUG=1
TARGETOS = BOTH

# uncomment this out to build static version
#STATIC_LIB=1

!include <$(INCLUDE)/win32.mak>

cc32	= cl
rc32	= rc
link32	= link

LOCAL_LIB = \usr\local\lib
LOCAL_SRC = ..\

TK_VER  = 42
TCL_VER = 76
# uncomment this to use tcl/tk 8
USE_TCL_80 = 1

!if "$(USE_TCL_80)" == "1"
TK_VER = 80
TCL_VER = 80 
!endif

TK_DIR	= $(LOCAL_SRC)\tk4.2
TCL_DIR	= $(LOCAL_SRC)\tcl7.6


!if "$(USE_TCL_80)" == "1"
TCL_SUFFIX = 8.0
TK_SUFFIX = 8.0
TCL_LIBRARY_FILES = $(TCL_80_LIBRARY_FILES)
!else
TCL_SUFFIX = 7.6
TK_SUFFIX = 4.2
TCL_LIBRARY_FILES = $(TCL_76_LIBRARY_FILES)
!endif

TK_DIR = $(LOCAL_SRC)\tk$(TK_SUFFIX)
TCL_DIR = $(LOCAL_SRC)\tcl$(TCL_SUFFIX)
OTCL_DIR = ..\otcl
TCLCL_DIR = ..\tclcl
GSM_DIR = ..\gsm

!ifdef STATIC_LIB
LIB_TK	= -LIBPATH:$(TK_DIR)\win stk$(TK_VER).lib
LIB_TCL = -LIBPATH:$(TCL_DIR)\win stcl$(TCL_VER).lib
!else
LIB_TK	= -LIBPATH:$(TK_DIR)\win tk$(TK_VER).lib
LIB_TCL = -LIBPATH:$(TCL_DIR)\win tcl$(TCL_VER).lib
!endif
LIB_OTCL = -LIBPATH:$(OTCL_DIR) otcl.lib
LIB_TCLCL = $(TCLCL_DIR)\tclcl.lib
LIB_GSM  = -LIBPATH:$(GSM_DIR)\lib gsm.lib

LIBRARY_TK = $(TK_DIR)\library
LIBRARY_TCL = $(TCL_DIR)\library

TKDOSNAMES = $(LIBRARY_TK)/optMenu.tcl $(LIBRARY_TK)/scrlbar.tcl


CC	= $(cc32)
CPP	= $(cc32)
LINK	= $(link32)
MKDEP	= makedep2
TCLSH	= ..\tcl8.0\win\tclsh80
TCL2C	= $(TCLCL_DIR)\tcl2c++.exe
AR	= lib -out:

RANLIB	= echo
INSTALL	= echo
LN	= echo
TEST	= echo
RM	= erase
PERL	= perl


!IFNDEF NODEBUG
CCOPT	= -Gm -Gi -YX -Zm1000
!ELSE
CCOPT   = -Ox -Zm1000
!ENDIF

# Include STATIC_LIB so that main.cc will be properly compiled for nam.
!ifdef STATIC_LIB
CCOPT = -DSTATIC_LIB $(CCOPT)
!endif

STATIC	= 
LDFLAGS = -LIBPATH:$(TOOLS32)\lib $(lflags) $(conlibsdll)
LDOUT	= -out:

DEFINE	= -DNO_TK

INCLUDE_TK = -I$(TK_DIR)\win -I$(TK_DIR)\generic
INCLUDE_TCL = -I$(TCL_DIR)\win -I$(TCL_DIR)\generic
INCLUDE_OTCL = -I$(OTCL_DIR)
INCLUDE_TCLCL = -I$(TCLCL_DIR)
INCLUDE_X11 = -I$(TK_DIR)\xlib
INCLUDE_MISC = -I$(TOOLS32)\include


OBJ_COMPAT_C = compat/gettod.o compat/win32.o embedded-console.o


# don't want system files to be added when making dependencies
DEPEND_INCS = \
	$(INCLUDE_TK) $(INCLUDE_TCL) \
	$(INCLUDE_OTCL) $(INCLUDE_TCLCL) \
	$(INCLUDE_X11) $(MD_INC) -I./jpeg -I./p64 -I.
INCLUDES = $(INCLUDE_MISC) $(DEPEND_INCS)

LIB =	$(LIB_TCLCL) $(LIB_OTCL) \
	$(LIB_TK) $(LIB_TCL) \
	$(guilibs)
#	$(LIB_GRABBER) $(LIB_GSM) \
#	winmm.lib

CFLAGS	= $(cdebug:Z7=Zi) $(cflags) $(cvarsdll) $(CCOPT) $(DEFINE)

.SUFFIXES : .cc


# add -FR$*.sbr if you want browse info
.cc.o:
	$(cc32) -c $(CFLAGS) $(INCLUDES) -Fo$@ -Tp $<

.c.o:
	$(cc32) -c $(CFLAGS) $(INCLUDES) -Fo$@ $<


GEN_DIR	= gen\\
LIB_DIR	= lib\\
NS	= ns.exe
NSX	= nsx.exe
NAM	= nam.exe
