| 227 |
dpurdie |
1 |
# -*- mode: perl; tabs: 8; indent-width: 4; show-tabs: yes; -*-
|
|
|
2 |
#
|
|
|
3 |
# Module name : TOOLSET/KeilC51V41
|
|
|
4 |
# Module type : Makefile system
|
|
|
5 |
# Environment(s):
|
|
|
6 |
#
|
|
|
7 |
# Description:
|
|
|
8 |
# Keil C51 ( Version 4.1) toolset
|
|
|
9 |
# A very simple toolset to support
|
|
|
10 |
# 1) C compiliation
|
|
|
11 |
# 2) Generation of libaries
|
|
|
12 |
# 3) Merging of libraries
|
|
|
13 |
#
|
|
|
14 |
# Does not support ( because its not needed yet )
|
|
|
15 |
# a) Shared libraries
|
|
|
16 |
# b) Executables
|
|
|
17 |
# c) Assembler files
|
|
|
18 |
#
|
|
|
19 |
# Version Who Date Description
|
|
|
20 |
# DDP 04-Jan-05 Created
|
|
|
21 |
#............................................................................#
|
|
|
22 |
|
|
|
23 |
##############################################################################
|
|
|
24 |
# ToolsetInit()
|
|
|
25 |
# Runtime initialisation
|
|
|
26 |
#
|
|
|
27 |
##############################################################################
|
|
|
28 |
|
|
|
29 |
ToolsetInit();
|
|
|
30 |
|
|
|
31 |
sub ToolsetInit
|
|
|
32 |
{
|
|
|
33 |
my $KeilVersion = "C51V41";
|
|
|
34 |
|
|
|
35 |
#.. Parse arguments
|
|
|
36 |
#
|
|
|
37 |
foreach $_ ( @args ) {
|
|
|
38 |
Message( "KeilC51V41: unknown option $_ -- ignored\n" );
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
#.. Standard.rul requirements
|
|
|
42 |
#
|
| 261 |
dpurdie |
43 |
$s = 'asm';
|
|
|
44 |
$o = 'o51';
|
|
|
45 |
$a = 'lib';
|
| 227 |
dpurdie |
46 |
$exe = "";
|
|
|
47 |
|
|
|
48 |
#.. Define environment
|
|
|
49 |
#
|
|
|
50 |
Init( "KeilC51V41" );
|
|
|
51 |
|
|
|
52 |
ToolsetDefine( "#################################################" );
|
|
|
53 |
ToolsetDefine( "# Compiler version" );
|
|
|
54 |
ToolsetDefine( "#" );
|
|
|
55 |
ToolsetDefine( "KeilC51_Version = \"$KeilVersion\"" );
|
|
|
56 |
ToolsetDefine( "" );
|
|
|
57 |
ToolsetDefine( "#" );
|
|
|
58 |
|
|
|
59 |
ToolsetDefines( "KeilC51V41.def" );
|
|
|
60 |
ToolsetRules ( "KeilC51V41.rul" );
|
|
|
61 |
ToolsetRules ( "standard.rul" );
|
|
|
62 |
|
|
|
63 |
#
|
|
|
64 |
# Extend the cleanup rule
|
|
|
65 |
#
|
|
|
66 |
ToolsetGenerate( '*.lst' );
|
|
|
67 |
|
|
|
68 |
#
|
|
|
69 |
# The keil compiler cannot handle long filenames
|
|
|
70 |
# This is a problem in many VOBS, so attempt to generate
|
|
|
71 |
# makefiles with a relative GBE_ROOT.
|
|
|
72 |
#
|
|
|
73 |
$::UseRelativeRoot = 1;
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
###############################################################################
|
|
|
80 |
# ToolsetCC( $source, $obj, \@args )
|
|
|
81 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
82 |
# required to compile the source file 'source' to 'obj'
|
|
|
83 |
#
|
|
|
84 |
###############################################################################
|
|
|
85 |
|
|
|
86 |
sub ToolsetCC
|
|
|
87 |
{
|
|
|
88 |
my( $source, $obj, $pArgs ) = @_;
|
|
|
89 |
|
|
|
90 |
Debug( "CC: $source -> $obj" );
|
|
|
91 |
foreach ( @$pArgs ) {
|
|
|
92 |
Debug( "option: $_" );
|
|
|
93 |
if ( /--Shared$/ ) { # Building a 'shared' object
|
|
|
94 |
$cflags = "$cflags \$(SHCFLAGS)";
|
|
|
95 |
Debug( "CC: as shared object" );
|
|
|
96 |
} else { # unknown option
|
|
|
97 |
Message( "CC: unknown option $_ -- ignored\n" );
|
|
|
98 |
}
|
|
|
99 |
}
|
|
|
100 |
|
|
|
101 |
MakePrint( "\n\t\$(CC)\n" );
|
|
|
102 |
MakePrint( "\$(OBJDIR)/$i.${o}:\tCFLAGS +=$cflags\n" )
|
|
|
103 |
if ( $cflags );
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
###############################################################################
|
|
|
107 |
# ToolsetCCDepend( $depend, \@sources )
|
|
|
108 |
# This subroutine takes the user options and builds the
|
|
|
109 |
# rule(s) required to build the dependencies for the source
|
|
|
110 |
# files 'sources' to 'depend'.
|
|
|
111 |
#
|
|
|
112 |
###############################################################################
|
|
|
113 |
|
|
|
114 |
sub ToolsetCCDepend
|
|
|
115 |
{
|
|
|
116 |
MakePrint( "\t\$(CCDEPEND)\n" );
|
|
|
117 |
}
|
|
|
118 |
|
|
|
119 |
###############################################################################
|
|
|
120 |
# ToolsetAR( $name, \@args, \@objs )
|
|
|
121 |
# This subroutine takes the user options and builds the rules
|
|
|
122 |
# required to build the library 'name'.
|
|
|
123 |
#
|
|
|
124 |
# Arguments:
|
|
|
125 |
# n/a
|
|
|
126 |
#
|
|
|
127 |
# Output:
|
|
|
128 |
# [ $(BINDIR)/name$.${a}: .... ]
|
|
|
129 |
# $(AR)
|
|
|
130 |
#
|
|
|
131 |
###############################################################################
|
|
|
132 |
|
|
|
133 |
sub ToolsetAR
|
|
|
134 |
{
|
|
|
135 |
my( $name, $pArgs, $pObjs ) = @_;
|
|
|
136 |
|
|
|
137 |
#.. Parse arguments
|
|
|
138 |
#
|
|
|
139 |
foreach $_ ( @$pArgs )
|
|
|
140 |
{
|
|
|
141 |
Message( "AR: unknown option $_ -- ignored\n" );
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
#
|
|
|
145 |
MakeEntry( "\$(LIBDIR)/$name\$(GBE_TYPE).${a}:\t", "", " \\\n\t\t", ".${o}", @$pObjs );
|
|
|
146 |
|
|
|
147 |
#.. Build library rule (just append to standard rule)
|
|
|
148 |
#
|
|
|
149 |
MakePrint( "\n\t\$(AR)\n\n" );
|
|
|
150 |
}
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
###############################################################################
|
|
|
154 |
# ToolsetARMerge()
|
|
|
155 |
# Generate the recipe to merge libraries.
|
|
|
156 |
# The dependency list is created by the caller.
|
|
|
157 |
#
|
|
|
158 |
###############################################################################
|
|
|
159 |
|
|
|
160 |
sub ToolsetARMerge
|
|
|
161 |
{
|
|
|
162 |
MakePrint( "\n\t\$(ARMERGE)\n\n" );
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
|
|
|
166 |
#.. Successful termination
|
|
|
167 |
1;
|
|
|
168 |
|