Merge branch 'micro' into maint
[platform/upstream/automake.git] / lib / Automake / Language.pm
1 # Copyright (C) 2013 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2, or (at your option)
6 # any later version.
7
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16 package Automake::Language;
17
18 use 5.006;
19 use strict;
20
21 use Class::Struct ();
22 Class::Struct::struct (
23         # Short name of the language (c, f77...).
24         'name' => "\$",
25         # Nice name of the language (C, Fortran 77...).
26         'Name' => "\$",
27
28         # List of configure variables which must be defined.
29         'config_vars' => '@',
30
31         # 'pure' is '1' or ''.  A 'pure' language is one where, if
32         # all the files in a directory are of that language, then we
33         # do not require the C compiler or any code to call it.
34         'pure'   => "\$",
35
36         'autodep' => "\$",
37
38         # Name of the compiling variable (COMPILE).
39         'compiler'  => "\$",
40         # Content of the compiling variable.
41         'compile'  => "\$",
42         # Flag to require compilation without linking (-c).
43         'compile_flag' => "\$",
44         'extensions' => '@',
45         # A subroutine to compute a list of possible extensions of
46         # the product given the input extensions.
47         # (defaults to a subroutine which returns ('.$(OBJEXT)', '.lo'))
48         'output_extensions' => "\$",
49         # A list of flag variables used in 'compile'.
50         # (defaults to [])
51         'flags' => "@",
52
53         # Any tag to pass to libtool while compiling.
54         'libtool_tag' => "\$",
55
56         # The file to use when generating rules for this language.
57         # The default is 'depend2'.
58         'rule_file' => "\$",
59
60         # Name of the linking variable (LINK).
61         'linker' => "\$",
62         # Content of the linking variable.
63         'link' => "\$",
64
65         # Name of the compiler variable (CC).
66         'ccer' => "\$",
67
68         # Name of the linker variable (LD).
69         'lder' => "\$",
70         # Content of the linker variable ($(CC)).
71         'ld' => "\$",
72
73         # Flag to specify the output file (-o).
74         'output_flag' => "\$",
75         '_finish' => "\$",
76
77         # This is a subroutine which is called whenever we finally
78         # determine the context in which a source file will be
79         # compiled.
80         '_target_hook' => "\$",
81
82         # If TRUE, nodist_ sources will be compiled using specific rules
83         # (i.e. not inference rules).  The default is FALSE.
84         'nodist_specific' => "\$");
85
86
87 sub finish ($)
88 {
89   my ($self) = @_;
90   if (defined $self->_finish)
91     {
92       &{$self->_finish} (@_);
93     }
94 }
95
96 sub target_hook ($$$$%)
97 {
98     my ($self) = @_;
99     if (defined $self->_target_hook)
100     {
101         $self->_target_hook->(@_);
102     }
103 }
104
105 1;
106
107 ### Setup "GNU" style for perl-mode and cperl-mode.
108 ## Local Variables:
109 ## perl-indent-level: 2
110 ## perl-continued-statement-offset: 2
111 ## perl-continued-brace-offset: 0
112 ## perl-brace-offset: 0
113 ## perl-brace-imaginary-offset: 0
114 ## perl-label-offset: -2
115 ## cperl-indent-level: 2
116 ## cperl-brace-offset: 0
117 ## cperl-continued-brace-offset: 0
118 ## cperl-label-offset: -2
119 ## cperl-extra-newline-before-brace: t
120 ## cperl-merge-trailing-else: nil
121 ## cperl-continued-statement-offset: 2
122 ## End: