Subversion Repositories DevTools

Rev

Blame | Last modification | View Log | RSS feed

#--- Auto-generated Platform Dependent Makefile -----------------------------
# -*- mode: mak; tabs: 9; -*-
# Generated from GBE_MAKELIB=/work/Devl/TOOLS/makelib.pl2 (version 2.22)
#           and  makefile.pl
#           on   Fri Jun 28 15:09:22 2002
#
# Copyright (C) 1995-2002 ERG Transit Systems, All rights reserved
#
# Platform  DOS16
# Located   in   e:/WORK/NET/SRC/RPC40/RPCGEN
#............................................................................
GBE_ROOT        = e:/WORK/NET
GBE_MAKELIB     = /work/Devl/TOOLS/makelib.pl2
GBE_TARGET      = DOS16
GBE_TARGETMACH  = 
GBE_PLATFORM    = DOS16
ifeq "$(DEBUG)" "0"
GBE_TYPE        = P
else
GBE_TYPE        = D
endif

SHELL           = /work/Devl/BIN.win32/sh
SHELLARGS       =
EXTENDED_LINE   = /work/Devl/BIN.win32/extend.lst
export EXTENDED_LINE MAKE

MFLAGS          = --no-print --warn -r

#--------- Targets ----------------------------------------------------------

.PHONY:         default all build install package unpackage uninstall \
                clean unbuild clobber

default:        make_usage
all:            install package
build:          make_init makefiles generate install_hdr depend make_lib \
                install_lib make_shlib install_shlib make_prog \
                install_class
install:        build install_prog
package:        package_hdr package_lib package_prog package_class
unpackage:      unpackage_prog unpackage_lib unpackage_hdr
uninstall:      uninstall_hdr uninstall_lib uninstall_prog
clean:          make_init2 unmake_prog unmake_test unmake_lib unobj \
                undepend ungenerate rmlitter make_undir
unbuild:        clean uninstall
clobber:        unpackage unbuild

#--------- Macros -----------------------------------------------------------

OBJDIR          = $(GBE_TARGET)$(GBE_TYPE).OBJ
LIBDIR          = $(GBE_TARGET).LIB
BINDIR          = $(GBE_TARGET)$(GBE_TYPE).BIN
CLSDIR          = classes$(GBE_TYPE)

PKGDIR          = $(GBE_ROOT)/pkg
INCDIR_PKG      = $(PKGDIR)/include
LIBDIR_PKG      = $(PKGDIR)/lib/$(GBE_TARGET)
BINDIR_PKG      = $(PKGDIR)/bin/$(GBE_TARGET)$(GBE_TYPE)
CLSDIR_PKG      = $(PKGDIR)/classes

LOCALDIR        = $(GBE_ROOT)/local
INCDIR_LOCAL    = $(LOCALDIR)/inc
LIBDIR_LOCAL    = $(LOCALDIR)/lib/$(GBE_TARGET)
BINDIR_LOCAL    = $(LOCALDIR)/bin/$(GBE_TARGET)$(GBE_TYPE)
CLSDIR_LOCAL    = $(LOCALDIR)/classes

INTERFACEDIR    = $(GBE_ROOT)/interface
INCDIR_INTERFACE= $(INTERFACEDIR)/include
LIBDIR_INTERFACE= $(INTERFACE)/lib/$(GBE_TARGET)
BINDIR_INTERFACE= $(INTERFACE)/bin/$(GBE_TARGET)$(GBE_TYPE)
CLSDIR_INTERFACE= $(INTERFACE)/classes

.SUFFIXES:      .c .C .cc .cpp

#
##############################################################################
# Windows toolset:
##############################################################################
#

echo            := echo
cmdfile         := $(GBE_BIN)/cmdfile
rm              := $(GBE_BIN)/rm
cp              := $(GBE_BIN)/cp
mv              := $(GBE_BIN)/mv
mkdir           := $(GBE_BIN)/mkdir
rmdir           := $(GBE_BIN)/rmdir
chmod           := $(GBE_BIN)/chmod
pwd             := $(GBE_BIN)/sh -c pwd
grep            := $(GBE_BIN)/grep
touch           := $(GBE_BIN)/touch
awk             := $(GBE_BIN)/awk

flex            := $(GBE_BIN)/flex
yacc            := $(GBE_BIN)/yacc
rpcgen          := $(GBE_BIN)/rpcgen

#
##############################################################################
# Compat for older (embedded) makefiles
##############################################################################
#

SCM_ROOT        = $(GBE_ROOT)
SCM_TYPE        = $(GBE_TYPE)
SCM_BIN         = $(GBE_BIN)
SCM_PLATFORM    = $(GBE_PLATFORM)

#
###############################################################################
# Brain hurts stuff... $(space) becomes a macro containing 1 space
# other aren't so bad.  These are used to make argument lists is a few
# places where we have to translate from a space seperated list to a
# something else seperated list (or vicky verka).
###############################################################################
#
comma           := ,
plus            := +
semicolon       := ;
empty           :=
space           := $(empty) $(empty)


#
###############################################################################
# A little macro used within each of the rules for translating a file from
# one type to another to print the environment if the variable SHOWENV has
# been defined.
###############################################################################
#
ifdef SHOWENV
define show_environment
        $(GBE_BIN)/printenv
endef
else
define show_environment
endef
endif

#
###############################################################################
# File:         dos16.def
# Contents:     DOS16 defines
###############################################################################

#
###############################################################################
# File:         TOOLSET/wcdos.def
# Contents:     WATCOM defines
###############################################################################

toolset         = wcdos

o               = obj
s               = asm
a               = lib
exe             = exe

.SUFFIXES:      .asm

.PHONY:         watcom
watcom:
        @$(echo) [Toolset WCDOS - Watcom C/C++ 16 bit]; \
        if [ -z "$$WATCOM" ]; then echo WATCOM env var not set; exit 2; fi


watcom          := $(subst \,/,$(strip $(WATCOM)))
ifeq "$(findstring $(PATH),$(WATCOM))" ""
PATH            := $(PATH);$(watcom)/bin;$(watcom)/binb
endif

ifdef MASM
masm            := $(subst \,/,$(strip $(MASM)))
ifneq "$(masm)" ""
ifeq "$(findstring $(PATH),$(MASM))" ""
PATH            := $(PATH);$(masm)/bin
endif
endif
else
masm            :=
endif

ifdef TASM
tasm            := $(subst \,/,$(strip $(TASM)))
ifneq "$(tasm)" ""
ifeq "$(findstring $(PATH),$(TASM))" ""
PATH            := $(PATH);$(tasm)/bin
endif
endif
else
tasm            :=
endif

#

CFLAGS              = \
        -DFUSION\
        -DEMBEDDED
CLINTFLAGS          = \
        -DFUSION\
        -DEMBEDDED
CDEPENDFLAGS        = \
        -DFUSION\
        -DEMBEDDED
CXXFLAGS            = \
        -DFUSION
CXXLINTFLAGS        = \
        -DFUSION
CXXDEPENDFLAGS      = \
        -DFUSION
ASFLAGS             = 
LDFLAGS             = 

INCDIRS             = 
INCDIRS            += \
        .
INCDIRS            += $(INCDIR_LOCAL)
INCDIRS            += $(GBE_ROOT)/interface/include
INCDIRS            += \
        $(GBE_ROOT)/../EOS/LOCAL/INC

NODEPDIRS           = 

DIRS                = .

LIBDIRS             = $(LIBDIR)
LIBDIRS            += $(LIBDIR_LOCAL)
LIBDIRS            += $(GBE_ROOT)/interface/lib/$(GBE_MACHTYPE)
LIBDIRS            += $(GBE_ROOT)/interface/lib/$(GBE_TARGET)
LIBDIRS            += \
        $(GBE_ROOT)/../EOS/LOCAL/LIB/$(GBE_TARGET)\
        $(GBE_ROOT)/../EOS/LOCAL/LIB/$(EOS_KERNEL)

CSRCS               = \
        rpc_clnt.c\
        rpc_cout.c\
        rpc_hout.c\
        rpc_main.c\
        rpc_pars.c\
        rpc_samp.c\
        rpc_scan.c\
        rpc_svco.c\
        rpc_tblo.c\
        rpc_util.c\
        rindex.c
CXXSRCS             = 
ASSRCS              = 
INITS               = \
        watcom
OBJS                =
OBJS               += \
        $(OBJDIR)/rpc_clnt.obj\
        $(OBJDIR)/rpc_cout.obj\
        $(OBJDIR)/rpc_hout.obj\
        $(OBJDIR)/rpc_main.obj\
        $(OBJDIR)/rpc_pars.obj\
        $(OBJDIR)/rpc_samp.obj\
        $(OBJDIR)/rpc_scan.obj\
        $(OBJDIR)/rpc_svco.obj\
        $(OBJDIR)/rpc_tblo.obj\
        $(OBJDIR)/rpc_util.obj\
        $(OBJDIR)/rindex.obj
SHOBJS              =
PROGOBJS            =
TESTPROGOBJS        =
LIBS                =
SHDIRS              =
SHLIBS              =
PROGS               = \
        $(BINDIR)/rpcgen.exe

#--------- Special targets --------------------------------------------------

.PHONY:         debug
debug:
        @$(MAKE) -f $(GBE_PLATFORM).mk DEBUG=1 build

.PHONY:         prod
prod:
        @$(MAKE) -f $(GBE_PLATFORM).mk DEBUG=0 build

rpcgen: make_init $(BINDIR)/rpcgen.exe



.PHONY:         package_setALL
package_setALL:


#--------- Standard rules ---------------------------------------------------

.PHONY:         make_usage
make_usage:
        @echo -e\
        " make [SHOWENV=1] [LEAVETMP=1] [OPTIONS=[opt][,...]] {DEBUG=0|1} target(s)\n"\
        "\n"\
        "Build one or more of the following targets for the platform\n"\
        "DOS16, recursively checking each configured sub directories.\n"\
        "\n"\
        "Valid targets include:\n"\
        "  all:             build, install and package\n"\
        "  build:           build everything\n"\
        "  debug:           build all things for debug\n"\
        "  prod:            build all things for production\n"\
        "  install:         install of public usage\n"\
        "  depend:          construct the dependencies\n"\
        "  lint:            lints C and C++ source\n"\
        "  package:         build all packages\n"\
        "  package-{set}:   build specific package\n"\
        "  unpackage:       remove all packages\n"\
        "  run_tests:       Run the tests specified in the makefile\n"\
        "  makefiles:       rebuild the makefile recursively\n"\
        "  rmlitter:        remove litter (core, bak, tmp, err and cmd files)\n"\
        "  clean:           delete generate, obj, libraries and programs\n"\
        "  unbuild:         delete everything which can be remade\n"\
        "\n"\
        "Application targets:\n"\
        "  rpcgen\n"\
        "\n"

.PHONY:         make_init make_init2
make_init:      make_init2 make_dir $(INITS)
make_init2:
        @if [ -z "$(GBE_BIN)" ]; then echo GBE_BIN not available; exit 2; fi; \
        if [ -z "$(GBE_PERL)" ]; then echo GBE_PERL not available; exit 2; fi; \
        if [ -z "$(DEBUG)" ]; then echo DEBUG not defined; exit 2; fi

.PHONY:         rmlitter
rmlitter:
        -$(rm) -f core *.bak *.tmp *.err $(OBJDIR)/*.err $(OBJDIR)/*.cmd

.PHONY:         make_dir
make_dir:
        @$(mkdir) -p $(OBJDIR) $(BINDIR)

.PHONY:         make_undir
make_undir:     toolset_undir
        -@$(rmdir) $(SHDIRS) $(OBJDIR) $(LIBDIR) $(BINDIR)

.PHONY:         generate
generate:       make_init 

.PHONY:         ungenerate
ungenerate:     toolset_ungen
        

.PHONY:         unobj
unobj:          toolset_unobj
        -$(rm) -f $(OBJS) $(SHOBJS) $(PROGOBJS) $(TESTPROGOBJS)

.PHONY:         make_lib
make_lib:       

.PHONY:         make_shlib
make_shlib:     

.PHONY:         unmake_lib
unmake_lib:     toolset_unlib
        

.PHONY:         make_script
make_script:    

.PHONY:         unmake_script
unmake_script:
        

.PHONY:         make_prog
make_prog:       $(PROGS)

.PHONY:         run_tests
run_tests:       $(PROGS)

.PHONY:         unmake_prog
unmake_prog:    toolset_unprog unmake_script
        -$(rm) -f $(PROGS)

.PHONY:         make_test
make_test:       

.PHONY:         unmake_prog
unmake_test:    toolset_untestprog unmake_script
        

install_class:  

install_hdr:    

install_lib:    

install_shlib:  

install_prog:   

.PHONY:         uninstall_prog
uninstall_prog: 

.PHONY:         uninstall_lib
uninstall_lib:  uninstall_shlib

.PHONY:         uninstall_shlib
uninstall_shlib:         

.PHONY:         uninstall_hdr
uninstall_hdr:  

uninstall_class:        

package_hdr:    

package_class:  

package_lib:    package_shlib

package_shlib:  

package_prog:   

.PHONY:         unpackage_prog
unpackage_prog: 

.PHONY:         unpackage_lib
unpackage_lib:  unpackage_shlib

unpackage_shlib:        

.PHONY:         unpackage_hdr
unpackage_hdr:  


#--------- Depend -----------------------------------------------------------

depend:                 $(OBJDIR)/depend

$(OBJDIR)/depend:       DOS16.mk $(GBE_MAKELIB)
$(OBJDIR)/depend:       $(CSRCS) $(CXXSRCS)
        @echo [$@] Doing a make depend..
        -@$(rm) -f $(OBJDIR)/depend
        $(CCDEPEND)
        -@$(touch) -f $(OBJDIR)/depend
undepend:
        -@$(rm) -f $(OBJDIR)/depend

#--------- Automated tests --------------------------------------------------


#--------- Construct Programs -----------------------------------------------

$(BINDIR)/rpcgen.exe:   \
                $(OBJDIR)/rpc_clnt.obj \
                $(OBJDIR)/rpc_cout.obj \
                $(OBJDIR)/rpc_hout.obj \
                $(OBJDIR)/rpc_main.obj \
                $(OBJDIR)/rpc_pars.obj \
                $(OBJDIR)/rpc_samp.obj \
                $(OBJDIR)/rpc_scan.obj \
                $(OBJDIR)/rpc_svco.obj \
                $(OBJDIR)/rpc_tblo.obj \
                $(OBJDIR)/rpc_util.obj \
                $(OBJDIR)/rindex.obj 
$(BINDIR)/rpcgen.exe:
        $(LD)

$(BINDIR)/rpcgen.dep:   $(SCM_PLATFORM).mk
        $(LDDEPEND)

ifeq "$(IFLAG)" "2"
-include        $(BINDIR)/rpcgen.dep
endif

rpcgen_ld += FORMAT     DOS\\n
ifdef DEBUG
rpcgen_ld += DEBUG      Watcom All\\n
endif
rpcgen_ld += FILE       $(subst /,\\\\,$(strip $(OBJDIR)/rpc_clnt)).obj\\n
rpcgen_ld += FILE       $(subst /,\\\\,$(strip $(OBJDIR)/rpc_cout)).obj\\n
rpcgen_ld += FILE       $(subst /,\\\\,$(strip $(OBJDIR)/rpc_hout)).obj\\n
rpcgen_ld += FILE       $(subst /,\\\\,$(strip $(OBJDIR)/rpc_main)).obj\\n
rpcgen_ld += FILE       $(subst /,\\\\,$(strip $(OBJDIR)/rpc_pars)).obj\\n
rpcgen_ld += FILE       $(subst /,\\\\,$(strip $(OBJDIR)/rpc_samp)).obj\\n
rpcgen_ld += FILE       $(subst /,\\\\,$(strip $(OBJDIR)/rpc_scan)).obj\\n
rpcgen_ld += FILE       $(subst /,\\\\,$(strip $(OBJDIR)/rpc_svco)).obj\\n
rpcgen_ld += FILE       $(subst /,\\\\,$(strip $(OBJDIR)/rpc_tblo)).obj\\n
rpcgen_ld += FILE       $(subst /,\\\\,$(strip $(OBJDIR)/rpc_util)).obj\\n
rpcgen_ld += FILE       $(subst /,\\\\,$(strip $(OBJDIR)/rindex)).obj\\n
rpcgen_ld += $(patsubst %,LIBPATH       %\\n,$(subst /,\\\\,$(LIBDIRS)))\\n
rpcgen_ld += LIBRARY    $(subst /,\\\\,$(strip $(watcom)/lib286/dos/clibl)).lib\\n
rpcgen_ld += LIBRARY    $(subst /,\\\\,$(strip $(watcom)/lib286/dos/emu87)).lib\\n
rpcgen_ld += LIBRARY    $(subst /,\\\\,$(strip $(watcom)/lib286/math87l)).lib\\n
rpcgen_ld += OPTION     DosSeg\\n
rpcgen_ld += OPTION     CaseExact\\n
rpcgen_ld += OPTION     NoDefaultLibs\\n
rpcgen_ld += OPTION     Map=$(subst /,\\\\,$(BINDIR)/rpcgen.map)\\n
rpcgen_ld += OPTION     Verbose\\n
rpcgen_ld += NAME       $(subst /,\\\\,$(BINDIR)/rpcgen.exe)\\n

rpcgen_dp += $(BINDIR)/rpcgen.exe:      @(vpath2,$(watcom)/lib286/dos/clibl.lib,WCX86_LIB)\\n
rpcgen_dp += $(BINDIR)/rpcgen.exe:      @(vpath2,$(watcom)/lib286/dos/emu87.lib,WCX86_LIB)\\n
rpcgen_dp += $(BINDIR)/rpcgen.exe:      @(vpath2,$(watcom)/lib286/math87l.lib,WCX86_LIB)\\n

#--------- Construct Libraries ----------------------------------------------


#--------- Construct Objects ------------------------------------------------

$(OBJDIR)/rindex.obj:                   rindex.c DOS16.mk
        $(CC)
$(OBJDIR)/rpc_clnt.obj:                 rpc_clnt.c DOS16.mk
        $(CC)
$(OBJDIR)/rpc_cout.obj:                 rpc_cout.c DOS16.mk
        $(CC)
$(OBJDIR)/rpc_hout.obj:                 rpc_hout.c DOS16.mk
        $(CC)
$(OBJDIR)/rpc_main.obj:                 rpc_main.c DOS16.mk
        $(CC)
$(OBJDIR)/rpc_pars.obj:                 rpc_pars.c DOS16.mk
        $(CC)
$(OBJDIR)/rpc_samp.obj:                 rpc_samp.c DOS16.mk
        $(CC)
$(OBJDIR)/rpc_scan.obj:                 rpc_scan.c DOS16.mk
        $(CC)
$(OBJDIR)/rpc_svco.obj:                 rpc_svco.c DOS16.mk
        $(CC)
$(OBJDIR)/rpc_tblo.obj:                 rpc_tblo.c DOS16.mk
        $(CC)
$(OBJDIR)/rpc_util.obj:                 rpc_util.c DOS16.mk
        $(CC)

#--------- Installations ----------------------------------------------------


#--------- Packaging --------------------------------------------------------


#--------- Makefile targets -------------------------------------------------

GBE_DEPENDS             +=
ifndef NOSCMDEPEND
GBE_DEPENDS             += \
        e:/WORK/NET/makefile.pl\
        /work/Devl/TOOLS/makelib.pl2\
        /work/Devl/CFG/rules.win\
        /work/Devl/CFG/Rules\
        /work/Devl/CFG/PLATFORM/dos16.def\
        /work/Devl/CFG/PLATFORM/DOS16\
        /work/Devl/CFG/TOOLSET/wcdos.def\
        /work/Devl/CFG/TOOLSET/wcdos.rul\
        /work/Devl/CFG/TOOLSET/standard.rul\
        /work/Devl/CFG/TOOLSET/wcdos
endif

.PHONY:         makefile
$(GBE_PLATFORM).mk:     $(GBE_DEPENDS)
        @echo One or more SCM components have changed, "rebuild" required
        @exit 10

.PHONY:         makefiles
makefiles:
        $(MAKE) -srf Makefile makefiles

.PHONY:         unmakefiles
unmakefiles:
        $(MAKE) -srf Makefile unmakefiles

#--------- Custom Rules -----------------------------------------------------


#--------- Toolset rules ----------------------------------------------------

TOOLSETGENERATED    = \
        $(BINDIR)/rpcgen.ld\
        $(BINDIR)/rpcgen.dep\
        $(BINDIR)/rpcgen.map

.PHONY:         toolset_ungen
toolset_ungen:
        -$(rm) -f $(TOOLSETGENERATED)

.PHONY:         toolset_unobj
toolset_unobj:
        

.PHONY:         toolset_unlib
toolset_unlib:
        

.PHONY:         toolset_unprog
toolset_unprog:
        

.PHONY:         toolset_untestprog
toolset_untestprog:
        

.PHONY:         toolset_undir
toolset_undir:
        

#..
# Copyright (c) 1996-2001 ERG Transit Systems.
#
# File:         TOOLSET/wcdos.rul[e]
# Contents:     WATCOM/DOS rules
#
# Revision History:
#       xx/08/99 APY    Created
#       22/03/00 APY    NODEPDIRS
#       08/06/00 APY    TS_TASM_AS
#       14/06/00 APY    LDDEPEND
#       13/11/01 APY    ; appended to several directives, forcing use of
#                       'sh.exe' during execution.  Required by WIN32
#                       toolsets,
###############################################################################
# Additional options above those supported by the basic build
# environment are...
#
# TS_MASM_AS:
#       If this variable is defined then the masm assembler will be
#       used rather than the watcom one.
#
# TS_TASM_AS:
#       If this variable is defined then the tasm assembler will be
#       used rather than the watcom one.
#
###############################################################################

###############################################################################
#..     Remove "undef" warnings
#
cc_includes     +=
cc_defines      +=
cxx_includes    +=
cxx_defines     +=

###############################################################################
#..     C Compiler definition
#
cc              = @export INCLUDE; INCLUDE='\
                        $(patsubst %,%;,$(INCDIRS))\
                        $(patsubst %,%;,$(cc_includes))\
                        $(patsubst %,%;,$(wc_includes))';\
                  export WCC; WCC='\
                        $(patsubst %, %,$(CFLAGS))\
                        $(patsubst %, -d%,$(cc_defines))\
                        $(patsubst %, %,$(wc_flags))';\
                  wcc
cc_init         =
cc_o_switch     = $(subst /,\\,-fo=$@)
cc_source       = $(subst /,\\,$<) > $(subst /,\\,$(basename $<)).err 2>&1
cc_cmdfile      =
cc_flags        =
cc_term         = ;                             # ; force use of 'sh.exe'

wc_includes     += $(watcom)/h

wc_flags        = -ml -ei -zq -fpi
#wc_flags       += -s
ifeq "$(DEBUG)" "1"
wc_flags        += -dDEBUG -d2
else
wc_flags        += -ox
endif
ifdef ALVL
wc_flags        += -dALVL=$(ALVL)
endif
ifdef DLVL
wc_flags        += -dDLVL=$(DLVL)
endif

define cc_pre
        @echo [\$<] compiling..
endef

define cc_post
endef

#..     C/C++ dependencies
#
wc_depend       =  -D__STDC__ -D__WATCOMC__=1000 -D__LARGE__ -DMSDOS
ifeq "$(DEBUG)" "1"
wc_depend       += -DDEBUG
endif
ifdef ALVL
wc_depend       += -DALVL=$(ALVL)
endif
ifdef DLVL
wc_depend       += -DDLVL=$(DLVL)
endif

ccdep           = @$(SCM_BIN)/mkdepend
ccdep_init      =
ccdep_o_switch  = -f -
ccdep_source    = $(filter %.c %.cc %.cpp, $+) > $(subst /,\\,$@) 2> depend.err
ccdep_flags     = -MM \
                $(patsubst %,%,$(CFLAGS)) \
                $(patsubst %,-D%,$(cc_defines)) \
                $(patsubst %,%,$(wc_depend)) \
                $(patsubst %,-I %,$(INCDIRS)) \
                $(patsubst %,-Y %,$(cc_includes)) \
                $(patsubst %,-Y %,$(wc_includes)) \
                $(patsubst %,-Y %,$(NODEPDIRS))
ccdep_pre       =
ccdep_post      =

#..     C++ Compiler definition
#
cxx             = @export INCLUDE; INCLUDE='\
                        $(patsubst %,%;,$(INCDIRS))\
                        $(patsubst %,%;,$(cc_includes))\
                        $(patsubst %,%;,$(wc_includes))';\
                  export WCC; WCC='\
                        $(patsubst %, %,$(CXXFLAGS))\
                        $(patsubst %, -d%,$(cc_defines))\
                        $(patsubst %, %,$(wc_flags))';\
                  wcc
cxx_init        =
cxx_o_switch    = $(subst /,\\,-fo=$@)
cxx_source      = $(subst /,\\,$<) > $(subst /,\\,$(basename $<)).err 2>&1
cxx_cmdfile     =
cxx_flags       =
cxx_term        = ;                             # ; force use of 'sh.exe'

define cxx_pre
        @echo [\$<] compiling..
endef

define cxx_post
endef


###############################################################################
#..     Assembler definition
#

ifdef TS_TASM_AS
#..     Assembler (TASM)
#
as              = tasm
as_init         =
as_i_switch     = -i
as_flags        =
as_o_switch     =
as_source       = $(subst /,\\,$<), $(subst /,\\,$@) @$(as_cmdfile)
as_cmdfile      = $(subst /,\\,$(basename $@).cmd)
as_term         = ;                             # ; force use of 'sh.exe'

as_includes     +=
as_defines      +=

tasm_flags      = -mx -t -w2
ifeq "$(DEBUG)" "1"
tasm_flags      += -zi /dDEBUG
endif
ifdef DLVL
tasm_flags      += -dDLVL=$(DLVL)
endif
ifdef ALVL
tasm_flags      += -dALVL=$(ALVL)
endif
as_defines      := $(addprefix -d,$(as_defines))
as_defines      += $(tasm_flags)

else
ifdef TS_MASM_AS
#..     Assembler (Microsoft 6.11)
#
as              = ml
as_init         =
as_i_switch     = /I
as_flags        = @$(as_cmdfile)
as_o_switch     = /Fo$(subst /,\\,$@)
as_source       = $(subst /,\\,$<)
as_cmdfile      = $(subst /,\\,$(basename $@).cmd)
as_term         = ;                             # ; force use of 'sh.exe'

as_includes     += $(masm)/include
as_defines      +=

ml_flags        = /c /Zm /Cp /X /nologo
ifeq "$(DEBUG)" "1"
ml_flags        += /W2 /Zd /DDEBUG
endif
ifdef DLVL
ml_flags        += /DDLVL=$(DLVL)
endif
ifdef ALVL
ml_flags        += /DALVL=$(ALVL)
endif
as_defines      := $(addprefix /D,$(as_defines))
as_defines      += $(ml_flags)

else
#...    WASM (default)
#
ifndef TS_WASM_AS
TS_WASM_AS      = 1
endif
as              = wasm
as_init         =
as_i_switch     = -i=
as_flags        = @$(as_cmdfile)
as_o_switch     = /fo=$(subst /,\\,$@)
as_source       = $(subst /,\\,$<)
as_cmdfile      = $(subst /,\\,$(basename $@).cmd)
as_term         = ;                             # ; force use of 'sh.exe'

as_includes     +=
as_defines      +=

wasm_flags      = /we /zq
ifdef DLVL
wasm_flags      += -dDLVL=$(DLVL)
endif
ifdef ALVL
wasm_flags      += -dALVL=$(ALVL)
endif
ifeq "$(DEBUG)" "1"
wasm_flags      += /dDEBUG /d2
endif
as_defines      := $(addprefix /d,$(as_defines))
as_defines      += $(wasm_flags)

endif           #MASM
endif           #TASM

define as_pre
        @$(cmdfile) -ko$(as_cmdfile) "\
                $(patsubst %,%\\n,$(ASFLAGS)) \
                $(patsubst %,%\\n,$(as_defines)) \
                $(patsubst %,$(as_i_switch)%\\n,$(subst /,\\\\,$(INCDIRS))) \
                $(patsubst %,$(as_i_switch)%\\n,$(subst /,\\\\,$(as_includes)))"
endef

ifndef LEAVETMP
define as_post
        @$(rm) -f $(as_cmdfile)
endef
else
define as_post
endef
endif           #LEAVETMP


#..     Archiver
#
ar              = wlib
ar_init         =
ar_cmdfile      = $(subst /,\\,$(basename $@).ar)
ar_flags        = -b -c -n -q -p=512
ar_o_switch     = $(subst /,\\,$@) @$(ar_cmdfile)
ar_term         = ;                             # ; force use of 'sh.exe'

define ar_pre
        @$(cmdfile) -ko$(ar_cmdfile) \
                "$(patsubst %,%\\n,$(subst /,\\\\,$^))"
endef

ifndef LEAVETMP
define ar_post
        @$(rm) -f $(ar_cmdfile)
endef
else
define ar_post
endef
endif

#..     Linker
#
ld              = wlink
ld_cmdfile      = $(subst /,\\,$(basename $@).ld)
ld_flags        = @$(ld_cmdfile)
ld_o_switch     =
ld_term         = ;                             # ; force use of 'sh.exe'

define ld_pre
        @export WCX86_LIB; \
                WCX86_LIB="$(subst $(space),;,$(LIBDIRS))"; \
        $(cmdfile) -ko$(ld_cmdfile) "$($(notdir $(basename $@))_ld)"
endef

ifndef LEAVETMP
define ld_post
        @$(rm) -f $(ld_cmdfile)
endef
else
define ld_post
endef
endif

define LDDEPEND
        @export WCX86_LIB; \
                WCX86_LIB="$(subst $(space),;,$(LIBDIRS))"; \
        $(cmdfile) -ko$(BINDIR)/$(notdir $(basename $@)).dep "$($(notdir $(basename $@))_dp)"
endef

#
###############################################################################
# Copyright (c) ERG Electronics Ltd. 1996-99
#
# File:         TOOLSET/standard.rul[e]
#
# Contents:     Toplevel toolset driver for doing stuff
#
#       CC              Compile a C source file
#       CCDEPEND
#       CXX             Compile a C++ source file
#       CCDEPEND
#       AS              Compile an assembler file
#       ASDEPEND
#       AR              Archive
#       LD              Linker
#       SHLD            Linked (shared library)
#
# Revision History:
#       `95      JONW   CMOS dev env
#       xx/08/99 APY    Ported
#       10/03/00 APY    Modified 'cc' output filtering
#       13/11/00        ${exe} now embeddes '.' if required.
#       29/11/00        SHLD and SHLDDEPEND
#       16/11/01        xx_term
#
###############################################################################

###############################################################################
#  Compile a C file.
###############################################################################

cc_term         +=

ifdef cc_error_filter
 ifdef cc_redirect
define CC
        @$(cc_pre)
        @$(show_environment)
        $(cc) $(cc_flags) $(cc_o_switch) $(cc_source) > $(basename $@).err $(cc_term)
        @$(cc_error_filter) < $(basename $@).err
        @$(cc_post)
endef
 else
  ifdef cc_redirect_stderr
define CC
        @$(cc_pre)
        @$(show_environment)
        $(cc) $(cc_flags) $(cc_o_switch) $(cc_source) 2>&1 | $(cc_error_filter) $(cc_term)
        @$(cc_post)
endef
  else
define CC
        @$(cc_pre)
        @$(show_environment)
        $(cc) $(cc_flags) $(cc_o_switch) $(cc_source) | $(cc_error_filter) $(cc_term)
        @$(cc_post)
endef
  endif
 endif
else
define CC
        @$(cc_pre)
        $(cc) $(cc_flags) $(cc_o_switch) $(cc_source) $(cc_term)
        @$(cc_post)
endef
endif

$(OBJDIR)/%.${o}:       %.c $(cc_init)
        $(CC)

define CCDEPEND
        @$(ccdep_pre)
        @$(show_environment)
        $(ccdep) $(ccdep_flags) $(ccdep_o_switch) $(ccdep_source) $(cc_term)
        @$(ccdep_post)
endef


###############################################################################
#  Compile a C++ file.
###############################################################################

cxx_term        +=

ifdef cxx_error_filter
 ifdef cxx_redirect
define CXX
        @$(cxx_pre)
        @$(show_environment)
        $(cxx) $(cxx_flags) $(cxx_o_switch) $(cxx_source) > $(basename $@).err $(cxx_term)
        @$(cxx_error_filter) < $(basename $@).err
        @$(rm) $(basename $@).err
        @$(cxx_post)
endef
 else
  ifdef cxx_redirect_stderr
define CXX
        @$(cxx_pre)
        @$(show_environment)
        $(cxx) $(cxx_flags) $(cxx_o_switch) $(cxx_source) 2>&1 | $(cxx_error_filter) $(cxx_term)
        @$(cxx_post)
endef
  else
define CXX
        @$(cxx_pre)
        @$(show_environment)
        $(cxx) $(cxx_flags) $(cxx_o_switch) $(cxx_source) | $(cxx_error_filter) $(cxx_term)
        @$(cxx_post)
endef
  endif
 endif
else
define CXX
        @$(cxx_pre)
        $(cxx) $(cxx_flags) $(cxx_o_switch) $(cxx_source) $(cxx_term)
        @$(cxx_post)
endef
endif

$(OBJDIR)/%.${o}:       %.cc $(cxx_init)
        $(CXX)

$(OBJDIR)/%.${o}:       %.cpp $(cxx_init)
        $(CXX)

###############################################################################
#  Assemble a file of assembler.
###############################################################################

as_term         +=


ifdef as_error_filter
 ifdef as_redirect
define AS
        @$(as_pre)
        @$(show_environment)
        $(as) $(as_flags) $(as_o_switch) $(as_source) > $(basename $@).as $(as_term)
        @$(as_error_filter) < $(basename $@).as
        @$(rm) $(basename $@).as
        @$(as_post)
  endef
 else
define AS
        @$(as_pre)
        @$(show_environment)
        $(as) $(as_flags) $(as_o_switch) $(as_source) | $(as_error_filer) $(as_term)
        @$(as_post)
endef
 endif
else
define AS
        @$(as_pre)
        $(as) $(as_flags) $(as_o_switch) $(as_source) $(as_term)
        @$(as_post)
endef
endif

$(OBJDIR)/%.${o}:       %.${s} $(as_init)
        $(AS)

###############################################################################
#  Build a library
###############################################################################

ar_term         +=

define AR
        @$(ar_pre)
        @$(show_environment)
        $(ar) $(ar_flags) $(ar_o_switch) $(ar_term)
        @$(ar_post)
endef

ifdef ar_depend
$(BINDIR)/%.${a}:       $(ar_depend) $(ar_init)
        $(AR)
endif

###############################################################################
# Generate a large relocatable object module from a bunch of object
# modules. Only bother with this if the compiler suite defines a
# `rel' extension for file names.
###############################################################################

rel_ld_term     +=

ifdef rel
ifneq (${a},${rel})
#
#       Only have the rules for a large relocatable build if it's not
#       the same as a normal library build.
#
$(BINDIR)/%.$(rel):     $(rel_ld_init)
        @$(rel_ld_pre)
        @$(show_environment)
        $(rel_ld) $(rel_ldflags) $(rel_ld_o_switch) $(rel_ld_term)
        @$(rel_ld_post)
endif
endif

###############################################################################
#  Link a shared library
###############################################################################

shld_term       +=

ifdef shld
define SHLD
        @$(shld_pre)
        @$(show_environment)
        $(shld) $(shld_flags) $(shld_o_switch) $(shld_term)
        @$(shld_post)
endef
endif

###############################################################################
#  Link an executable
###############################################################################

ld_term         +=

define LD
        @$(ld_pre)
        @$(show_environment)
        $(ld) $(ld_flags) $(ld_o_switch) $(ld_term)
        @$(ld_post)
endef

ifdef ld_depend
$(BINDIR)/%$(exe):      $(ld_depend) $(ld_init)
        $(LD)
endif

#

#--------- Dependencies -----------------------------------------------------

ifndef NODEPEND
 ifdef IFLAG
  ifneq "$(IFLAG)" "0"
-include        $(OBJDIR)/depend
  endif
 endif
endif

#DO NOT DELETE - mkdepend depends on it