# -*- mode: mak; -*- ############################################################################### # File: TOOLSET/wc386.rul[e] # Contents: WATCOM/386 rules # # Revision History: # 95 JONW CMOS dev env # xx/08/99 APY Ported # 09/12/99 APY LDDEPEND # 10/01/00 APY WASM interface broken # 22/03/00 APY NODEPDIRS # 05/06/00 APY __SOURCE__ # 14/06/00 APY __TNT__ and __DOS4G__ # 26/02/02 APY Build system +v2 support. # - ; appended to several directives, forcing use of # 'sh.exe' during execution. Required by WIN32 # toolsets (see xx_term variables), # - added depend post processing to append OBJDIR # 09/04/02 - __WATCOMC__ defined within asm sessions # - trimmed white space # 30/05/02 - realpath() usage during assembler sessions. # (MASM and ASM386 only) # - switch doco # - (zc) enabled ############################################################################### # 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_PHARLAP_AS: # If this variable is defined then the pharlap assembler will be # used rather than the watcom one. # # TS_PHARLAP_LD: # If this variable is defined then the pharlap linker will be # used rather than the watcom one. # ############################################################################### ############################################################################### #.. Remove "undef" warnings # cc_includes += cc_defines += cxx_includes += cxx_defines += as_includes += as_defines += ############################################################################### #.. C Compiler definition # # -mf FLAT memory model # -s remove stack overflow checks # -ez generate PharLap EZ-OMF object files # -ei force enums to be type int # -zq operate quietly # -w3 set warning level number to 3 # -3r 386 register calling conventions (default). # # -fpi inline 80x87 instructions with emulation # -zc place literal strings in the code segment # cc = wcc386 cc_init = cc_o_switch = cc_object = -fo=$@ cc_source = $(subst /,\\,$<) cc_cmdfile = $(subst /,\\,$(basename $@).cmd) cc_flags = @$(cc_cmdfile) cc_term = ; # ; force use of 'sh.exe' cc_filter := "$(notdir $(wildcard $(GBE_ROOT)/warnings.wc*))" ifeq ($(strip $(cc_filter)), "warnings.wc") cc_redirect = 1 cc_error_filter = $(awk) -f $(GBE_ROOT)/warnings.wc endif ifdef tnt70 wc_includes += $(tnt70)/include endif wc_includes += $(watcom)/h wc_flags = -mf -s -ez -wx -ei -zq -w3 wc_flags += -fpi -zc 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 wc_flags += -D__SOURCE__=\"$(notdir $<)\" ifdef tnt70 wc_flags += -D__TNT__ else wc_flags += -D__DOS4G__ endif define cc_pre @echo [\$<] compiling.. @$(cmdfile) -ko$(cc_cmdfile) "\ $(patsubst %,%\\n,$(CFLAGS))\ $(patsubst %,-d%\\n,$(cc_defines))\ $(patsubst %,%\\n,$(wc_flags))\ $(patsubst %,-i=%\\n,$(subst /,\\\\,$(INCDIRS)))\ $(patsubst %,-i=%\\n,$(subst /,\\\\,$(cc_includes)))\ $(patsubst %,-i=%\\n,$(subst /,\\\\,$(wc_includes)))\ $(subst /,\\\\,$(cc_object))\\n" endef ifndef LEAVETMP define cc_post @$(rm) -f $(cc_cmdfile) endef else define cc_post endef endif ############################################################################### #.. C/C++ dependencies # depend and depend.err # wc_depend = -D__WATCOMC__=1000 -D__STDC__ wc_depend += -D__386__ -DMSDOS -D__DOS__ ifeq "$(DEBUG)" "1" wc_depend += -DDEBUG endif ifdef ALVL wc_depend += -DALVL=$(ALVL) endif ifdef DLVL wc_depend += -DDLVL=$(DLVL) endif wc_depend += -D__SOURCE__=\"$(notdir $<)\" ifdef tnt70 wc_depend += -D__TNT__ else wc_depend += -D__DOS4G__ endif ccdep = @$(SCM_BIN)/mkdepend ccdep_init = ccdep_o_switch = -f - ccdep_source = $(filter %.c %.cc %.cpp, $+) > $(subst /,/,$@).tmp 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 = define ccdep_post -sed s/\^/\$$\(OBJDIR\)\\// $(subst /,/,$@).tmp | grep \\.${o} > $(subst /,/,$@) @rm $(subst /,/,$@).tmp endef #.. C++ Compiler definition # cxx = wcc386 cxx_init = cxx_o_switch = cxx_object = -fo=$@ cxx_source = $(subst /,\\,$<) cxx_cmdfile = $(subst /,\\,$(basename $@).cmd) cxx_flags = @$(cxx_cmdfile) cxx_term = ; # ; force use of 'sh.exe' define cxx_pre @echo [\$<] compiling.. @$(cmdfile) -ko$(cxx_cmdfile) "\ $(patsubst %,%\\n,$(CXXFLAGS))\ $(patsubst %,-d%\\n,$(cxx_defines))\ $(patsubst %,%\\n,$(wc_flags))\ $(patsubst %,-i=%\\n,$(subst /,\\\\,$(INCDIRS)))\ $(patsubst %,-i=%\\n,$(subst /,\\\\,$(cxx_includes)))\ $(patsubst %,-i=%\\n,$(subst /,\\\\,$(wc_includes)))\ $(subst /,\\\\,$(cxx_object))\\n" endef ifndef LEAVETMP define cxx_post @$(rm) -f $(cxx_cmdfile) endef else define cxx_post endef endif ############################################################################### #.. Assembler definition # ifdef TS_MASM_AS #.. Assembler (Microsoft 6.11) # as = ml as_init = as_i_switch = /I as_o_switch = as_object = /Fl$(basename $@).lst /Fo$@ as_source = as_cmdfile = $(subst /,\\,$(basename $@)).cmd as_flags = @$(as_cmdfile) as_term = ; # ; force use of 'sh.exe' ifdef tnt70 as_includes += $(tnt70)/include endif as_includes += $(masm)/include ml_flags = /c /Zm /Cp /X /nologo ml_flags += /D__WATCOMC__ # Target C/C++ compiler 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 ifdef TS_PHARLAP_AS #... Pharlap 386asm # as = 386asm as_init = as_i_switch = -i$(space) as_o_switch = as_object = -l$(basename $@).lst -o$@ as_source = as_cmdfile = $(subst /,\\,$(basename $@)).cmd as_flags = @$(as_cmdfile) ifdef tnt70 as_includes += $(tnt70)/include endif as_defines += 386asm_flags = -nos -nol -twocase 386asm_flags += -d __WATCOMC__ # Target C/C++ compiler ifdef DLVL 386asm_flags += -d DLVL=$(DLVL) endif ifdef ALVL 386asm_flags += -d ALVL=$(ALVL) endif ifeq "$(DEBUG)" "1" 386asm_flags += -d DEBUG -LNUM endif as_defines := $(addprefix -d ,$(as_defines)) as_defines += $(386asm_flags) else #... WASM (default) # ifndef TS_WASM_AS TS_WASM_AS = endif as = @export WASM; WASM='\ $(patsubst %,%,$(ASFLAGS)) \ $(patsubst %,%,$(as_defines)) \ $(patsubst %,$(as_i_switch)%,$(subst /,\\,$(INCDIRS))) \ $(patsubst %,$(as_i_switch)%,$(subst /,\\,$(as_includes))) \ $(as_object)'; \ wasm /3 as_init = as_i_switch = -i= as_o_switch = as_object = -fo=$(subst /,\\,$@) as_source = $(subst /,\\,$<) as_cmdfile = $(subst /,\\,$(basename $@)).cmd as_flags = @WASM as_includes += as_defines += wasm_flags = /we /zq wasm_flags += -d__WATCOMC__ # Target C/C++ compiler 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) define as_pre endef define as_post endef endif #WASM endif #MASM ifndef as_pre 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)))\ $(as_object)\\n\ @(realpath,$(subst /,\\,$<))" endef ifndef LEAVETMP define as_post @$(rm) -f $(as_cmdfile) endef else define as_post endef endif endif #!as_pre #.. 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 # ifdef TS_PHARLAP_LD TS_PHARLAP_LD = 1 ld = 386link ld_cmdfile = $(subst /,\\,$(basename $@).ld) ld_flags = @$(ld_cmdfile) ld_o_switch = -exe $@ ld_term = ; # ; force use of 'sh.exe' ld_pre = ld_post = else TS_WATCOM_LD = 1 ld = wlink ld_cmdfile = $(subst /,\\,$(basename $@).ld) ld_flags = @$(ld_cmdfile) ld_o_switch = ld_term = ; # ; force use of 'sh.exe' endif #WLINK define ld_pre @export WC386_LIB; \ WC386_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 WC386_LIB; \ WC386_LIB="$(subst $(space),;,$(LIBDIRS))"; \ $(cmdfile) -ko$(BINDIR)/$(notdir $(basename $@)).dep "$($(notdir $(basename $@))_dp)" endef #