Rev 227 | Rev 287 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
# -*- mode: perl; indent-width: 4; show-tabs: yes; -*-## Module name : wc4gw# Module type : Makefile system# Compiler(s) : ANSI C# Environment(s): DOS## Description:# Watcom C/C++ toolset for DOS4GW## 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/WC4GW,v $# $Revision: 1.2 $ $Date: 2004/05/06 09:11:13 $ $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( "wc4gw.def" );ToolsetRules( "wc386.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() handles both CC and CXX source}################################################################################ 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:# --X## Output:# [ $(BINDIR)/name$.${a}: .... ]# $(AR)################################################################################sub ToolsetAR{my( $name, $pArgs, $pObjs ) = @_;local( $name_ld );#.. Parse arguments#foreach $_ ( @$pArgs ) {Message( "AR: unknown option $_ -- ignored\n" );}#.. Build library rule (just append to standard rule)#MakeEntry( "\$(LIBDIR)/$name\$(GBE_TYPE).${a}:\t", "", "\\\n\t\t", "", @$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 (default 4K)## Output:# $(BINDIR)/name${exe}:# $(LD)## name_ld += ...# :################################################################################sub ToolsetLD{my( $name, $pArgs, $pObjs, $pLibs ) = @_;my( $stack );local( $ldname );#.. Parse arguments#$stack = "4k"; # stackforeach $_ ( @$pArgs ){if (/^--Stack=(.*)/) { # ISP module$stack = "$1";} else {Message( "LD: unknown option $_ -- ignored\n" );}}#.. Command file and library dependencies#push( @$pLibs, "\$(watcom)/lib386/dos/clib3r" );push( @$pLibs, "\$(watcom)/lib386/dos/emu387" );push( @$pLibs, "\$(watcom)/lib386/math387r" );MakePrint( "\n" ); # not appended to list#.. 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( "SYSTEM DOS4G" );LdPrt( "ifeq \"\$(DEBUG)\" \"1\"");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 CaseExact" );LdCmd( "OPTION NoDefaultLibs" );LdCmd( "OPTION Map=\$(subst /,\\\\,\$(BINDIR)/${name}.map)" );LdCmd( "OPTION Stack=$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},WC386_LIB)" );}}#.. Successful termination1;