\mshush\general.mak

General tools and macro definitions

This file defines all tool names, platform dependent macros and basic build commands.

requirements

the following should be defined before this file is included:

TCLTK = c:\tcl
TOOLS = c:\bc45
HUSH = d:\hush

dymmy main target

the main target (all:) should be declared before this file, otherwise
the next section will be the main target, which is probably undesirable
    thisshouldbeincluded:
        @echo This makefile should only be included by other makefiles and
        @echo the primary target should be defined before this is included.

requirements checking


the following should be defined in the environment
(with the correct locations of init scripts, watch the '/' instead of'\')

TCL_LIBRARY = c:/tcl/lib/tcl7.5
TK_LIBRARY = c:/tcl/lib/tk4.1
HUSH_LIBRARY = d:/hush/library
    !if !$d(TCL_LIBRARY)
    !error TCL_LIBRARY should be defined in the environment
    !endif
    !if !$d(TK_LIBRARY)
    !error TK_LIBRARY should be defined in the environment
    !endif
    !if !$d(HUSH_LIBRARY)
    !error HUSH_LIBRARY should be defined in the environment
    !endif

defines

    LIBDIR      = $(HUSH)\lib
    LIBDIRS     = $(LIBDIR);$(TOOLS)\lib;$(TCLTK)\lib
    INCLUDES    = $(HUSH)\include;$(TOOLS)\include
    !ifndef OBJDIR
    OBJDIR      = .
    !endif

tool names

    CP = copy
    RM = del
    RC = BRC32
    LINKWIN32 = TLINK32
    LINKDOS16 = TLINK
    LIBRARIAN = TLIB
    CCWIN32   = BCC32
    CCDOS16   = BCC

compile macros

    MSDOSDEFS      = HAS_STDARG;NOTIME;STRICT;__STDC__=1;ASCII
    MSWINDEFS      = __MSWIN__;_RTLDLL;HAS_STDARG;NOTIME;STRICT;__STDC__=1
    SCRIPTPATHDEFS = HUSH_LIBRARY="$(HUSH_LIBRARY)";TCL_LIBRARY="$(TCL_LIBRARY)";TK_LIBRARY="$(TK_LIBRARY)"
    MAINREDIRECT   = main=Main
    DEBUGDEFINES   = nodebug
    WIN32DEFS      = $(MSWINDEFS);$(MAINREDIRECT) # ;$(SCRIPTPATHDEFS)
    DOS16DEFS      = $(MSDOSDEFS)
not defining the DEBUG macro will disable the debug info
    !ifdef DEBUG
    DEBUGCCFLAGS = -v           # debuging
    !else
    DEBUGCCFLAGS  = -v- -vi -O2     # no debuging
    !endif
defining the WARNINGS macro will enable the warnings
    WARNINGS  = 1

    !ifdef WARNINGS
    WARNFLAGS     = -w-par -w-stu -w-inl    # warnings
    !else
WARNFLAGS = -w- # no warnings
    !endif

compile flags

    CCDOS16FLAGS = -W- -R -ml -f -P -c $(DEBUGCCFLAGS) $(WARNFLAGS)
    CCWIN32FLAGS = $(DEBUGCCFLAGS) $(WARNFLAGS) -c -P -W -3 -d

link flags

    LNDOS16FLAGS = -v -c -Tde -x -L$(LIBDIRS) c0l.obj
    LNWIN32FLAGS = -Tpe -aa -c -v -L$(LIBDIRS) c0w32 $(LIBDIR)\import32 $(LIBDIR)\tcl75 $(LIBDIR)\tk41

libraries to link

    LNDOS16LIBS = emu.lib mathl.lib cl.lib
    LNWIN32LIBS = cw32i.lib hush.lib

platform specification

just defining WIN32 or DOS16 will be sufficient to choose the right compiler, flags and libraries
    !ifdef WIN32
      CC = $(CCWIN32)
      LINK = $(LINKWIN32)
      CONFIG = bcc32.cfg
      CCFLAGS = $(CCWIN32FLAGS)
      LNFLAGS = $(LNWIN32FLAGS)
      LNLIBS = $(LNWIN32LIBS)
      DEFINES = $(WIN32DEFS)
    !else
    !ifdef DOS16
        CC = $(CCDOS16)
        LINK = $(LINKDOS16)
        CONFIG = turboc.cfg
        CCFLAGS = $(CCDOS16FLAGS)
        LNFLAGS = $(LNDOS16FLAGS)
        LNLIBS = $(LNDOS16LIBS)
        DEFINES = $(DOS16DEFS)
    !else
    !message
    !message Warning: neither WIN32 nor DOS16 defined, so LINK and CC are undefined as well
    !message
    !endif
    !endif

internal tools

    MKDIR  = makedir.bat
    RM     = delete.bat
    RMTREE = rmtree.bat

    $(MKDIR):
        copy &&|
    @echo off
    ctty nul
    mkdir %1
    ctty con
    | $(MKDIR) > nul

    $(RM):
        copy &&|
    @echo off
    if exist %1 del %1
    | $(RM) > nul

    $(RMTREE):
        copy &&|
    @echo off
    ctty nul
    deltree /Y %1
    ctty con
    | $(RMTREE) > nul

    delbatches: $(RM)
        $(RM) $(RMTREE)
        $(RM) $(MKDIR)
        if exist $(RM) del $(RM)