Rev 227 | Blame | Last modification | View Log | RSS feed
# -*- 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 = wcc386cc_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 = 1cc_error_filter = $(awk) -f $(GBE_ROOT)/warnings.wcendififdef tnt70wc_includes += $(tnt70)/includeendifwc_includes += $(watcom)/hwc_flags = -mf -s -ez -wx -ei -zq -w3wc_flags += -fpi -zcifeq "$(DEBUG)" "1"wc_flags += -DDEBUG -d2elsewc_flags += -oxendififdef ALVLwc_flags += -DALVL=$(ALVL)endififdef DLVLwc_flags += -DDLVL=$(DLVL)endifwc_flags += -D__SOURCE__=\"$(notdir $<)\"ifdef tnt70wc_flags += -D__TNT__elsewc_flags += -D__DOS4G__endifdefine 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"endefifndef LEAVETMPdefine cc_post@$(rm) -f $(cc_cmdfile)endefelsedefine cc_postendefendif################################################################################.. 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 += -DDEBUGendififdef ALVLwc_depend += -DALVL=$(ALVL)endififdef DLVLwc_depend += -DDLVL=$(DLVL)endifwc_depend += -D__SOURCE__=\"$(notdir $<)\"ifdef tnt70wc_depend += -D__TNT__elsewc_depend += -D__DOS4G__endifccdep = @$(SCM_BIN)/mkdependccdep_init =ccdep_o_switch = -f -ccdep_source = $(filter %.c %.cc %.cpp, $+) > $(subst /,/,$@).tmp 2> $@.errccdep_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 /,/,$@).tmpendef#.. C++ Compiler definition#cxx = wcc386cxx_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"endefifndef LEAVETMPdefine cxx_post@$(rm) -f $(cxx_cmdfile)endefelsedefine cxx_postendefendif################################################################################.. Assembler definition#ifdef TS_MASM_AS#.. Assembler (Microsoft 6.11)#as = mlas_init =as_i_switch = /Ias_o_switch =as_object = /Fl$(basename $@).lst /Fo$@as_source =as_cmdfile = $(subst /,\\,$(basename $@)).cmdas_flags = @$(as_cmdfile)as_term = ; # ; force use of 'sh.exe'ifdef tnt70as_includes += $(tnt70)/includeendifas_includes += $(masm)/includeml_flags = /c /Zm /Cp /X /nologoml_flags += /D__WATCOMC__ # Target C/C++ compilerifeq "$(DEBUG)" "1"ml_flags += /W2 /Zd /DDEBUGendififdef DLVLml_flags += /DDLVL=$(DLVL)endififdef ALVLml_flags += /DALVL=$(ALVL)endifas_defines := $(addprefix /D,$(as_defines))as_defines += $(ml_flags)elseifdef TS_PHARLAP_AS#... Pharlap 386asm#as = 386asmas_init =as_i_switch = -i$(space)as_o_switch =as_object = -l$(basename $@).lst -o$@as_source =as_cmdfile = $(subst /,\\,$(basename $@)).cmdas_flags = @$(as_cmdfile)ifdef tnt70as_includes += $(tnt70)/includeendifas_defines +=386asm_flags = -nos -nol -twocase386asm_flags += -d __WATCOMC__ # Target C/C++ compilerifdef DLVL386asm_flags += -d DLVL=$(DLVL)endififdef ALVL386asm_flags += -d ALVL=$(ALVL)endififeq "$(DEBUG)" "1"386asm_flags += -d DEBUG -LNUMendifas_defines := $(addprefix -d ,$(as_defines))as_defines += $(386asm_flags)else#... WASM (default)#ifndef TS_WASM_ASTS_WASM_AS =endifas = @export WASM; WASM='\$(patsubst %,%,$(ASFLAGS)) \$(patsubst %,%,$(as_defines)) \$(patsubst %,$(as_i_switch)%,$(subst /,\\,$(INCDIRS))) \$(patsubst %,$(as_i_switch)%,$(subst /,\\,$(as_includes))) \$(as_object)'; \wasm /3as_init =as_i_switch = -i=as_o_switch =as_object = -fo=$(subst /,\\,$@)as_source = $(subst /,\\,$<)as_cmdfile = $(subst /,\\,$(basename $@)).cmdas_flags = @WASMas_includes +=as_defines +=wasm_flags = /we /zqwasm_flags += -d__WATCOMC__ # Target C/C++ compilerifdef DLVLwasm_flags += -dDLVL=$(DLVL)endififdef ALVLwasm_flags += -dALVL=$(ALVL)endififeq "$(DEBUG)" "1"wasm_flags += /dDEBUG /d2endifas_defines := $(addprefix /d,$(as_defines))as_defines += $(wasm_flags)define as_preendefdefine as_postendefendif #WASMendif #MASMifndef as_predefine 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 /,\\,$<))"endefifndef LEAVETMPdefine as_post@$(rm) -f $(as_cmdfile)endefelsedefine as_postendefendifendif #!as_pre#.. Archiver#ar = wlibar_init =ar_cmdfile = $(subst /,\\,$(basename $@).ar)ar_flags = -b -c -n -q -p=512ar_o_switch = $(subst /,\\,$@) @$(ar_cmdfile)ar_term = ; # ; force use of 'sh.exe'define ar_pre@$(cmdfile) -ko$(ar_cmdfile) \$(patsubst %,%\\n,$(subst /,\\\\,$^))endefifndef LEAVETMPdefine ar_post@$(rm) -f $(ar_cmdfile)endefelsedefine ar_postendefendif#.. Linker#ifdef TS_PHARLAP_LDTS_PHARLAP_LD = 1ld = 386linkld_cmdfile = $(subst /,\\,$(basename $@).ld)ld_flags = @$(ld_cmdfile)ld_o_switch = -exe $@ld_term = ; # ; force use of 'sh.exe'ld_pre =ld_post =elseTS_WATCOM_LD = 1ld = wlinkld_cmdfile = $(subst /,\\,$(basename $@).ld)ld_flags = @$(ld_cmdfile)ld_o_switch =ld_term = ; # ; force use of 'sh.exe'endif #WLINKdefine ld_pre@export WC386_LIB; \WC386_LIB="$(subst $(space),;,$(LIBDIRS))"; \$(cmdfile) -ko$(ld_cmdfile) "$($(notdir $(basename $@))_ld)"endefifndef LEAVETMPdefine ld_post@$(rm) -f $(ld_cmdfile)endefelsedefine ld_postendefendifdefine LDDEPEND@export WC386_LIB; \WC386_LIB="$(subst $(space),;,$(LIBDIRS))"; \$(cmdfile) -ko$(BINDIR)/$(notdir $(basename $@)).dep "$($(notdir $(basename $@))_dp)"endef#