⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 automake.in

📁 这是一个自动生成MAKEFILE的工具。相信大家都听说过。在LINUX工程项目里是很好的帮手。希望对大家有点帮助。
💻 IN
📖 第 1 页 / 共 5 页
字号:
				  . " ansi2knr" . $objext . "\n\n");	    }	    # Make sure ansi2knr can be found: if no path specified,	    # specify "./".	    if ($options{'ansi2knr'} eq 'ansi2knr')	    {		# Substitution from AM_C_PROTOTYPES.  This makes it be		# built only when necessary.		&define_configure_variable ('ANSI2KNR');		# ansi2knr needs to be built before subdirs, so unshift it.		unshift (@all, '$(ANSI2KNR)');	    }	    else	    {		# Found in another directory.		&define_variable ("ANSI2KNR", $options{'ansi2knr'});	    }	    $output_rules .= &file_contents ('clean-kr');	    push (@clean, 'kr');	    &push_phony_cleaners ('kr');	    $included_knr_compile = 1;	}    }    return $extension;}# Call finish function for each language that was used.sub finish_languages{    local ($ext, $name, $lang, %done);    local ($non_c) = 1;    foreach $ext (sort keys %extension_seen)    {	$lang = $extension_map{$ext};	next if defined $done{$lang};	$done{$lang} = 1;	$non_c = 0 if $lang !~ /(objc|cxx|f77|ratfor)$/;	# Compute the function name of the finisher and then call it.	$name = 'lang_' . $lang . '_finish';	do $name ();    }    # If the project is entirely C++ or entirely Fortran 77, don't    # bother with the C stuff.  But if anything else creeps in, then use    # it.    if (! $non_c || scalar keys %suffix_rules > 0)    {	local ($ltcompile, $ltlink) = &libtool_compiler;	&define_configure_variable ('CFLAGS');	&define_variable ('COMPILE',			  '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)');	&define_variable ('LTCOMPILE',			  $ltcompile .			  '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)')	    if ($seen_libtool);	&define_variable ('CCLD', '$(CC)');	&define_variable ('LINK', $ltlink . '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@');    }}# Output a rule to build from a YACC source.  The output from YACC is# compiled with C or C++, depending on the extension of the YACC file.sub output_yacc_build_rule{    local ($yacc_suffix, $use_ylwrap, $c_suffix) = @_;    local ($suffix);    ($suffix = $yacc_suffix) =~ tr/y/c/;    push (@suffixes, $yacc_suffix, $suffix);    # Generate rule for c/c++.    $output_rules .= "$yacc_suffix$suffix:\n\t";    if ($use_ylwrap)    {	$output_rules .= ('$(SHELL) $(YLWRAP)'			  . ' "$(YACC)" $< y.tab.c $*' . $suffix			  . ' y.tab.h $*.h -- $(AM_YFLAGS) $(YFLAGS)');    }    else    {	$output_rules .= ('$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*'			  . $suffix . "\n"			  . "\tif test -f y.tab.h; then \\\n"			  . "\tif cmp -s y.tab.h \$*.h; then rm -f y.tab.h; else mv y.tab.h \$*.h; fi; \\\n"			  . "\telse :; fi");    }    $output_rules .= "\n";}sub output_lex_build_rule{    local ($lex_suffix, $use_ylwrap) = @_;    local ($c_suffix);    ($c_suffix = $lex_suffix) =~ tr/l/c/;    push (@suffixes, $lex_suffix);    &define_configure_variable ('LEX_OUTPUT_ROOT');    &define_configure_variable ('LEXLIB');    $output_rules .= "$lex_suffix$c_suffix:\n\t";    if ($use_ylwrap)    {        # Is the $@ correct here?  If so, why not use it in the ylwrap        # build rule for yacc above?	$output_rules .= '$(SHELL) $(YLWRAP)'	    . ' "$(LEX)" $< $(LEX_OUTPUT_ROOT).c $@ -- $(AM_LFLAGS) $(LFLAGS)';    }    else    {	$output_rules .= '$(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@';    }    $output_rules .= "\n";}# Check to make sure a source defined in LIBOBJS is not explicitly# mentioned.  This is a separate function (as opposed to being inlined# in handle_source_transform) because it isn't always appropriate to# do this check.sub check_libobjs_sources{    local ($one_file, $unxformed) = @_;    local ($prefix, $file, @files);    foreach $prefix ('', 'EXTRA_')    {	if (&variable_defined ($prefix . $one_file . '_SOURCES'))	{	    @files = &variable_value_as_list (($prefix					       . $one_file . '_SOURCES'),					      'all');	}	elsif ($prefix eq '')	{	    @files = ($unxformed . '.c');	}	else	{	    next;	}	foreach $file (@files)	{	    if (defined $libsources{$file})	    {		&am_line_error ($prefix . $one_file . '_SOURCES',				"automatically discovered file \`$file' should not be explicitly mentioned");	    }	}    }}# Does much of the actual work for handle_source_transform.# Arguments are:#   object extension (e.g., `$U.lo')#   list of source files to transform# Result is a list#   first element is name of linker to use (empty string for default linker)#   remaining elements are names of objectssub handle_single_transform_list{    local ($obj, @files) = @_;    local (@result) = ();    local ($nonansi_obj) = $obj;    $nonansi_obj =~ s/_//g;    local (%linkers_used) = ();    if (@files > 0)    {	# Turn sources into objects.	foreach (@files)	{	    # Skip things that look like configure substitutions.	    next if /^\@.*\@$/;	    # We don't support source files in a subdirectory.  The	    # reason is that we'd want to put the .o into a similar	    # subdirectory, but this means finding a good way to make	    # the directory.  Later.	    if (/\//)	    {		&am_error		    ("not supported: source file `$_' is in subdirectory");		next;	    }	    # Split file name into base and extension.	    local ($base, $extension, $linker, $object);	    next if ! /^(.*)\.(.*)$/;	    $base = $1;	    $extension = $2;	    local ($lang) = $extension_map{$extension};	    if ($lang)	    {		&saw_extension ($extension);		# Found the language, so see what it says.		local ($subr) = 'lang_' . $lang . '_rewrite';		# Note: computed subr call.		local ($r) = do $subr ($base, $extension);		# Skip this entry if we were asked not to process it.		next if ! $r;		# Now extract linker and other info.		$linker = $language_map{$lang . '-linker'};		if ($language_map{$lang . '-ansi-p'})		{		    $object = $base . $obj;		}		else		{		    $object = $base . $nonansi_obj;		}	    } 	    elsif ($extension =~ /^$source_suffix_pattern$/) 	    {		# We just rewrite it.  Maybe we should do more.		$object = $base . '.' . $suffix_rules{$extension};		$linker = ''; 	    }	    else	    {		# No error message here.  Used to have one, but it was		# very unpopular.		next;	    }	    $linkers_used{$linker} = 1;	    push (@result, $object);	    # Transform .o or $o file into .P file (for automatic	    # dependency code).	    $dep_files{'.deps/' . $base . '.P'} = 1;	}    }    return (&resolve_linker (%linkers_used), @result);}# Handle SOURCE->OBJECT transform for one program or library.# Arguments are:#   canonical (transformed) name of object to build#   actual name of object to build#   object extension (ie either `.o' or `$o'.# Return result is name of linker variable that must be used.# Empty return means just use `LINK'.sub handle_source_transform{    # one_file is canonical name.  unxformed is given name.  obj is    # object extension.    local ($one_file, $unxformed, $obj) = @_;    local ($linker) = '';    if (&variable_defined ($one_file . "_OBJECTS"))    {	&am_line_error ($one_file . '_OBJECTS',			$one_file . '_OBJECTS', 'should not be defined');	# No point in continuing.	return;    }    local (@files, @result, $prefix, $temp);    foreach $prefix ('', 'EXTRA_')    {	@files = ();	local ($var) = $prefix . $one_file . "_SOURCES";	if (&variable_defined ($var))	{	    push (@sources, '$(' . $prefix . $one_file . "_SOURCES)");	    push (@objects, '$(' . $prefix . $one_file . "_OBJECTS)")		unless $prefix eq 'EXTRA_';	    local (@conds) = &variable_conditions ($var);	    if (! @conds)	    {		@files = &variable_value_as_list ($var, '');	    }	    else	    {		local ($cond);		foreach $cond (@conds)		{		    @files = &variable_value_as_list ($var, $cond);		    ($temp, @result) = &handle_single_transform_list ($obj,								      @files);		    $linker = $temp if $linker eq '';		    # Define _OBJECTS conditionally.		    &define_pretty_variable ($one_file . '_OBJECTS', $cond,					     @result)			unless $prefix eq 'EXTRA_';		}		next;	    }	}	elsif ($prefix eq '')	{	    &define_variable ($one_file . "_SOURCES", $unxformed . ".c");	    push (@sources, $unxformed . '.c');	    push (@objects, $unxformed . $obj);	    push (@files, $unxformed . '.c');	}	($temp, @result) = &handle_single_transform_list ($obj, @files);	$linker = $temp if $linker eq '';	&define_pretty_variable ($one_file . "_OBJECTS", '', @result)	    unless $prefix eq 'EXTRA_';    }    return $linker;}# Handle the BUILT_SOURCES variable.sub handle_built_sources{    return unless &variable_defined ('BUILT_SOURCES');    local (@sources) = &variable_value_as_list ('BUILT_SOURCES', 'all');    local ($s);    foreach $s (@sources)    {	if (/^\@.*\@$/)	{	    # FIXME: is this really the right thing to do?	    &am_line_error ('BUILT_SOURCES',			    "\`BUILT_SOURCES' should not contain a configure substitution");	    last;	}    }    # We don't care about the return value of this function.  We just    # want to make sure to update %dep_files with the contents of    # BUILT_SOURCES.    &handle_single_transform_list (".o", @sources);}# Special-case @ALLOCA@ and @LIBOBJS@ in _LDADD or _LIBADD variables.# Also, generate _DEPENDENCIES variable if appropriate.# Arguments are:#   transformed name of object being built, or empty string if no object#   name of _LDADD/_LIBADD-type variable to examine#   boolean (lex_seen) which is true if a lex source file was seen in this#     object.  valid only for LDADDs, not LIBADDs.# Returns 1 if LIBOBJS seen, 0 otherwise.sub handle_lib_objects{    local ($xname, $var, $lex_seen) = @_;    local ($ret);    die "automake: programming error 1 in handle_lib_objects\n"	if ! &variable_defined ($var);    die "automake: programming error 2 in handle_lib_objects\n"	if $lex_seen && $var =~ /LIBADD/;    local (@conds) = &variable_conditions ($var);    if (! @conds)    {	$ret = &handle_lib_objects_cond ($xname, $var, $lex_seen, '');    }    else    {	local ($cond);	$ret = 0;	foreach $cond (@conds)	{	    if (&handle_lib_objects_cond ($xname, $var, $lex_seen, $cond))	    {		$ret = 1;	    }	}    }    return $ret;}# Subroutine of handle_lib_objects: handle a particular condition.sub handle_lib_objects_cond{    local ($xname, $var, $lex_seen, $cond) = @_;    # We recognize certain things that are commonly put in LIBADD or    # LDADD.    local ($lsearch);    local (@dep_list) = ();    local ($seen_libobjs) = 0;    local ($flagvar) = 0;    foreach $lsearch (&variable_value_as_list ($var, $cond))    {	# Skip -lfoo and -Ldir; these are explicitly allowed.	next if $lsearch =~ /^-[lL]/;	if (! $flagvar && $lsearch =~ /^-/)	{	    if ($var =~ /^(.*)LDADD$/)	    {		&am_line_error ($var, "linker flags such as \`$lsearch' belong in \`${1}LDFLAGS");	    }	    else	    {		# Only get this error once.		$flagvar = 1;		&am_line_error ($var, "you cannot use linker flags such as \`$lsearch' in \`$var'");	    }	}	# Assume we have a file of some sort, and push it onto the	# dependency list.  Autoconf substitutions are not pushed;	# rarely is a new dependency substituted into (eg) foo_LDADD	# -- but "bad things (eg -lX11) are routinely substituted.	# Note that LIBOBJS and ALLOCA are exceptions to this rule,	# and handled specially below.	push (@dep_list, $lsearch)	    unless $lsearch =~ /^\@.*\@$/;	# Automatically handle @LIBOBJS@ and @ALLOCA@.  Basically this	# means adding entries to dep_files.	if ($lsearch =~ /^\@(LT)?LIBOBJS\@$/)	{	    push (@dep_list, $lsearch);	    $seen_libobjs = 1;	    if (! keys %libsources)	    {		&am_line_error ($var, "\@$1" . "LIBOBJS\@ seen but never set in \`$configure_ac'");	    }	    local ($iter, $rewrite);	    foreach $iter (keys %libsources)	    {		if ($iter =~ /\.([cly])$/)		{		    &saw_extension ($1);		    &saw_extension ('c');		}		if ($iter =~ /\.h$/)		{		    &require_file_with_line ($var, $FOREIGN, $iter);		}		elsif ($iter ne 'alloca.c')		{		    ($rewrite = $iter) =~ s/\.c$/.P/;		    $dep_files{'.deps/' . $rewrite} = 1;		    &require_file_with_line ($var, $FOREIGN, $iter);		}	    }	}	elsif ($lsearch =~ /^\@(LT)?ALLOCA\@$/)	{	    push (@dep_list, $lsearch);	    &am_line_error ($var,			    "\@$1" . "ALLOCA\@ seen but \`AC_FUNC_ALLOCA' not in \`$configure_ac'")		if ! defined $libsources{'alloca.c'};	    $dep_files{'.deps/alloca.P'} = 1;	    &require_file_with_line ($var, $FOREIGN, 'alloca.c');	    &saw_extension ('c');	}    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -