Subversion Repositories DevTools

Rev

Rev 227 | Blame | Compare with Previous | Last modification | View Log | RSS feed

# -*- mode: mak; -*-
###############################################################################
# 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
#       depend and depend.err
#
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> $@.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

#