Rev 261 | Blame | Last modification | View Log | RSS feed
# -*- mode: perl; indent-width: 4; show-tabs: yes; -*-## Module name : wcdos# Module type : Makefile system# Compiler(s) : ANSI C# Environment(s): DOS## Description:# Watcom C/C++ toolset for DOS## Version Who Date Description# 1.0 APY 07/05/99 Created# 13/06/00 --Stack# 14/06/00 Build application dependency list# APY 13/11/00 ${exe} now embeddes '.' if required.## $Source: /cvsroot/etm/devl/CFG/TOOLSET/WCDOS,v $# $Revision: 1.2 $ $Date: 2004/05/06 09:11:25 $ $State: Exp $# $Author: ayoung $ $Locker: $#............................................................................################################################################################ ToolsetInit()# Runtime initialisation###############################################################################ToolsetInit();sub ToolsetInit{#.. standard.rul requirements$s = 'asm';$o = 'obj';$a = 'lib';$exe = ".exe";#.. define WATCOM environmentInit( "watcom" );ToolsetDefines( "wcdos.def" );ToolsetRules( "wcdos.rul" );ToolsetRules( "standard.rul" );}################################################################################ ToolsetCC( $source, $obj, \@args )# This subroutine takes the user options and builds the rule(s)# required to compile the source file 'source' to 'obj'################################################################################sub ToolsetCC{MakePrint( "\n\t\$(CC)\n" );}################################################################################ ToolsetCCDepend( $depend, \@sources )# This subroutine takes the user options and builds the# rule(s) required to build the dependencies for the source# files 'sources' to 'depend'.################################################################################sub ToolsetCCDepend{MakePrint( "\t\$(CCDEPEND)\n" );}################################################################################ ToolsetCXX( $source, $obj, \@args )# This subroutine takes the user options and builds the rule(s)# required to compile the source file 'source' to 'obj'################################################################################sub ToolsetCXX{MakePrint( "\n\t\$(CXX)\n" );}################################################################################ ToolsetCXXDepend( $depend, \@sources )# This subroutine takes the user options and builds the# rule(s) required to build the dependencies for the source# files 'sources' to 'depend'.################################################################################sub ToolsetCXXDepend{ToolsetCCDepend();}################################################################################ ToolsetAS( $source, $obj, \@args )# This subroutine takes the user options and builds the rule(s)# required to compile the source file 'source' to 'obj'################################################################################sub ToolsetAS{MakePrint( "\n\t\$(AS)\n" );}sub ToolsetASDepend{}################################################################################ ToolsetAR( $name, \@args, \@objs )# This subroutine takes the user options and builds the rules# required to build the library 'name'.## Arguments:# none## Output:# $(BINDIR)/name$.${a}: .... ]# $(AR)################################################################################sub ToolsetAR{my( $name, $pArgs, $pObjs ) = @_;#.. Parse arguments#foreach $_ ( @$pArgs ) {Message( "AR: unknown option $_ -- ignored\n" );}#.. Standard library builds, plus AMX configuration#MakeEntry( "\$(LIBDIR)/$name\$(GBE_TYPE).${a}:\t","", "\\\n\t\t", ".${o} ", @$pObjs );#.. Build library rule#MakePrint( "\n\t\$(AR)\n\n" );}################################################################################ ToolsetLD( $name, \@args, \@objs, \@libraries )# This subroutine takes the user options and builds the rules# required to link the program 'name'.## Arguments:# --Stack=#[k] Stack size## Output:# $(BINDIR)/name${exe}:# $(LD)## $(BINDIR)/name.dep: $(SCM_PLATFORM).mk# $(LDDEPEND)## ifeq "$(IFLAG)" "3"# -include "$(BINDIR)/name.dep"# endif## name_ld += ...# :## name_dp += ...# :################################################################################sub ToolsetLD{my( $name, $pArgs, $pObjs, $pLibs ) = @_;my( $stack );local( $ldname );#.. Parse arguments#$stack = 0;foreach $_ ( @$pArgs ){if (/^--Stack=(.*)/) { # stack size$stack = "$1";} else {Message( "LD: unknown option $_ -- ignored\n" );}}#.. Command file and library dependencies#MakePrint( "\n" ); # not appended to listpush( @$pLibs, "\$(watcom)/lib286/dos/clibl" );push( @$pLibs, "\$(watcom)/lib286/dos/emu87" );push( @$pLibs, "\$(watcom)/lib286/math87l" );#.. Cleanup rules#ToolsetGenerate( "\$(BINDIR)/${name}.ld" );ToolsetGenerate( "\$(BINDIR)/${name}.dep" );ToolsetGenerate( "\$(BINDIR)/${name}.map" );#.. Linker command file## Now the fun part... piecing together a variable $(name_ld)# which ends up in the command file.#MakePrint( "\$(BINDIR)/${name}${exe}:\n" ."\t\$(LD)\n\n" );MakePrint( "\$(BINDIR)/${name}.dep:\t\$(SCM_PLATFORM).mk\n"."\t\$(LDDEPEND)\n\n" );MakePrint( "ifeq \"\$(IFLAG)\" \"3\"\n" ."-include\t\$(BINDIR)/${name}.dep\n" ."endif\n\n" );$ldname = "${name}_ld";sub LdCmd {MakeQuote ("$ldname += @_\\n\n");}sub LdPrt {MakePrint ("@_\n");}LdCmd( "FORMAT DOS" );LdPrt( "ifdef DEBUG" );LdCmd( "DEBUG Watcom All" );LdPrt( "endif" );foreach $i ( @$pObjs ) {LdCmd( "FILE \$(subst /,\\\\,\$(strip $i)).${o}" );}LdCmd( "\$(patsubst %,LIBPATH %\\n,\$(subst /,\\\\,\$(LIBDIRS)))" );foreach $i ( @$pLibs ) {LdCmd( "LIBRARY \$(subst /,\\\\,\$(strip $i)).${a}" );}LdCmd( "OPTION DosSeg" );LdCmd( "OPTION CaseExact" );LdCmd( "OPTION NoDefaultLibs" );LdCmd( "OPTION Map=\$(subst /,\\\\,\$(BINDIR)/${name}.map)" );LdCmd( "OPTION Stack=$stack" )if ($stack);LdCmd( "OPTION Verbose" );LdCmd( "NAME \$(subst /,\\\\,\$(BINDIR)/${name}${exe})" );LdPrt( "" );#.. Dependency link,## Now piece together a variable $(name_dp) which ends up in# the command file building the application dependency list.#$ldname = "${name}_dp";foreach $i ( @$pLibs ) {LdCmd("\$(BINDIR)/${name}${exe}: @(vpath2,$i.${a},WCX86_LIB)" );}}#.. Successful termination1;