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

📄 automake.in

📁 这是一个自动生成MAKEFILE的工具。相信大家都听说过。在LINUX工程项目里是很好的帮手。希望对大家有点帮助。
💻 IN
📖 第 1 页 / 共 5 页
字号:
}# Search a file for a "version.texi" Texinfo include.  Return the name# of the include file if found, or the empty string if not.  A# "version.texi" file is actually any file whose name matches# "vers*.texi".sub scan_texinfo_file{    local ($filename) = @_;    if (! open (TEXI, $filename))    {	&am_error ("couldn't open \`$filename': $!");	return '';    }    print "automake: reading $filename\n" if $verbose;    local ($vfile, $outfile);    while (<TEXI>)    {	if (/^\@setfilename +(\S+)/)	{	    $outfile = $1;	    last if ($vfile);	}	if (/^\@include\s+(vers[^.]*\.texi)\s*$/)	{	    # Found version.texi include.	    $vfile = $1;	    last if $outfile;	}    }    close (TEXI);    return ($outfile, $vfile);}# Handle all Texinfo source.sub handle_texinfo{    &am_line_error ('TEXINFOS',		    "\`TEXINFOS' is an anachronism; use \`info_TEXINFOS'")	if &variable_defined ('TEXINFOS');    return if (! &variable_defined ('info_TEXINFOS')	       && ! &variable_defined ('html_TEXINFOS'));    if (&variable_defined ('html_TEXINFOS'))    {	&am_line_error ('html_TEXINFOS',			"HTML generation not yet supported");	return;    }    local (@texis) = &variable_value_as_list ('info_TEXINFOS', 'all');    local (@info_deps_list, @dvis_list, @texi_deps);    local ($infobase, $info_cursor);    local (%versions);    local ($done) = 0;    local ($vti);    local ($tc_cursor, @texi_cleans);    local ($canonical);    foreach $info_cursor (@texis)    {	# FIXME: This is mildly hacky, since it recognizes "txinfo".	# I don't feel like making it right.	($infobase = $info_cursor) =~ s/\.te?xi(nfo)?$//;	# If 'version.texi' is referenced by input file, then include	# automatic versioning capability.	local ($out_file, $vtexi) = &scan_texinfo_file ($relative_dir							. "/" . $info_cursor);	if ($out_file eq '')	{	    &am_error ("\`$info_cursor' missing \@setfilename");	    next;	}	if ($out_file =~ /\.(.+)$/ && $1 ne 'info')	{	    # FIXME should report line number in input file.	    &am_error ("output of \`$info_cursor', \`$out_file', has unrecognized extension");	    next;	}	if ($vtexi)	{	    &am_error ("\`$vtexi', included in \`$info_cursor', also included in \`$versions{$vtexi}'")		if (defined $versions{$vtexi} && $vtexi ne "version.texi");	    $versions{$vtexi} = $info_cursor;	    # We number the stamp-vti files.  This is doable since the	    # actual names don't matter much.  We only number starting	    # with the second one, so that the common case looks nice.	    $vti = 'vti' . ($done ? ".$done" : '');	    &push_dist_common ($vtexi, 'stamp-' . $vti);	    push (@clean, $vti);	    # Only require once.	    &require_conf_file_with_line ('info_TEXINFOS', $FOREIGN,					  'mdate-sh')		if ! $done;	    ++$done;	    local ($conf_pat, $conf_dir);	    if ($config_aux_dir eq '.' || $config_aux_dir eq '')	    {		$conf_dir = '$(srcdir)/';	    }	    else	    {		$conf_dir = $config_aux_dir;		$conf_dir .= '/' unless $conf_dir =~ /\/$/;	    }	    ($conf_pat = $conf_dir) =~ s/(\W)/\\$1/g;	    $output_rules .=		&file_contents_with_transform		    ('s/\@TEXI\@/' . $info_cursor . '/g; '		     . 's/\@VTI\@/' . $vti . '/g; '		     . 's/\@VTEXI\@/' . $vtexi . '/g;'		     . 's,\@MDDIR\@,' . $conf_pat . ',g;'		     . 's,\@CONFIGURE_AC\@,' . $configure_ac . ',g;',		     'texi-vers');	    &push_phony_cleaners ($vti);	}	# If user specified file_TEXINFOS, then use that as explicit	# dependency list.	@texi_deps = ();	push (@texi_deps, $info_cursor);	push (@texi_deps, $vtexi) if $vtexi;	# Canonicalize name first.	($canonical = $infobase) =~ tr/A-Za-z0-9_/_/c;	if (&variable_defined ($canonical . "_TEXINFOS"))	{	    push (@texi_deps, '$(' . $canonical . '_TEXINFOS)');	    &push_dist_common ('$(' . $canonical . '_TEXINFOS)');	}	$output_rules .= ("\n" . $out_file . ": "			  . join (' ', @texi_deps)			  . "\n" . $infobase . ".dvi: "			  . join (' ', @texi_deps)			  . "\n\n");	push (@info_deps_list, $out_file);	push (@dvis_list, $infobase . '.dvi');	# Generate list of things to clean for this target.  We do	# this explicitly because otherwise too many things could be	# removed.  In particular the ".log" extension might	# reasonably be used in other contexts by the user.	foreach $tc_cursor ('aux', 'cp', 'cps', 'dvi', 'fn', 'fns',			    'ky', 'kys', 'ps', 'log', 'pg', 'toc', 'tp', 'tps',			    'vr', 'vrs', 'op', 'tr', 'cv', 'cn')	{	    push (@texi_cleans, $infobase . '.' . $tc_cursor);	}    }    # Find these programs wherever they may lie.  Yes, this has    # intimate knowledge of the structure of the texinfo distribution.    &define_program_variable ('MAKEINFO', 'build', 'texinfo/makeinfo',			      'makeinfo',			      # Circumlocution to avoid accidental			      # configure substitution.			      '@MAKE' . 'INFO@');    &define_program_variable ('TEXI2DVI', 'src', 'texinfo/util',			      'texi2dvi');    # Set transform for including texinfos.am.  First, handle --cygnus    # stuff.    local ($xform);    if ($cygnus_mode)    {	$xform = 's/^NOTCYGNUS.*$//; s/^CYGNUS//;';    }    else    {	$xform = 's/^CYGNUS.*$//; s/^NOTCYGNUS//;';    }    # Handle location of texinfo.tex.    local ($need_texi_file) = 0;    local ($texinfo_tex);    if ($cygnus_mode)    {	$texinfo_tex = '$(top_srcdir)/../texinfo/texinfo.tex';	&define_variable ('TEXINFO_TEX', $texinfo_tex);    }    elsif ($config_aux_dir ne '.' && $config_aux_dir ne '')    {	$texinfo_tex = $config_aux_dir . '/texinfo.tex';	&define_variable ('TEXINFO_TEX', $texinfo_tex);    }    elsif (&variable_defined ('TEXINFO_TEX'))    {	# The user defined TEXINFO_TEX so assume he knows what he is	# doing.	$texinfo_tex = ('$(srcdir)/'			. &dirname (&variable_value ('TEXINFO_TEX')));    }    else    {	$texinfo_tex = '.';	$need_texi_file = 1;    }    local ($xxform);    ($xxform = $texinfo_tex) =~ s/(\W)/\\$1/g;    $xform .= ' s/\@TEXINFODIR\@/' . $xxform . '/g;';    $output_rules .= &file_contents_with_transform ($xform, 'texinfos');    push (@phony, 'install-info-am', 'uninstall-info');    push (@dist_targets, 'dist-info');    # How to clean.  The funny name is due to --cygnus influence; in    # Cygnus mode, `clean-info' is a target that users can use.    $output_rules .= "\nmostlyclean-aminfo:\n";    &pretty_print_rule ("\t-rm -f", "\t  ", @texi_cleans);    $output_rules .= ("\nclean-aminfo:\n\ndistclean-aminfo:\n\n"		      . "maintainer-clean-aminfo:\n\t"		      # Eww.  But how else can we find all the output		      # files from makeinfo?		      . ($cygnus_mode ? '' : 'cd $(srcdir) && ')		      . 'for i in $(INFO_DEPS); do' . " \\\n"		      . "\t" . '  rm -f $$i;' . " \\\n"		      . "\t" . '  if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then' . " \\\n"		      . "\t" . '    rm -f $$i-[0-9]*;' . " \\\n"		      . "\t" . '  fi;' . " \\\n"		      . "\tdone\n");    &push_phony_cleaners ('aminfo');    if ($cygnus_mode)    {	$output_rules .= "clean-info: mostlyclean-aminfo\n";    }    push (@suffixes, '.texi', '.texinfo', '.txi', '.info', '.dvi', '.ps');    if (! defined $options{'no-installinfo'})    {	push (@uninstall, 'uninstall-info');	push (@installdirs, '$(DESTDIR)$(infodir)');	unshift (@install_data, 'install-info-am');	# Make sure documentation is made and installed first.  Use	# $(INFO_DEPS), not 'info', because otherwise recursive makes	# get run twice during "make all".	unshift (@all, '$(INFO_DEPS)');    }    push (@clean, 'aminfo');    push (@info, '$(INFO_DEPS)');    push (@dvi, '$(DVIS)');    &define_variable ("INFO_DEPS", join (' ', @info_deps_list));    &define_variable ("DVIS", join (' ', @dvis_list));    # This next isn't strictly needed now -- the places that look here    # could easily be changed to look in info_TEXINFOS.  But this is    # probably better, in case noinst_TEXINFOS is ever supported.    &define_variable ("TEXINFOS", &variable_value ('info_TEXINFOS'));    # Do some error checking.  Note that this file is not required    # when in Cygnus mode; instead we defined TEXINFO_TEX explicitly    # up above.    &require_file_with_line ('info_TEXINFOS', $FOREIGN, 'texinfo.tex')	if $need_texi_file && ! defined $options{'no-texinfo.tex'};}# Handle any man pages.sub handle_man_pages{    &am_line_error ('MANS', "\`MANS' is an anachronism; use \`man_MANS'")	if &variable_defined ('MANS');    return if ! &variable_defined ('man_MANS');    # Find all the sections in use.  We do this by first looking for    # "standard" sections, and then looking for any additional    # sections used in man_MANS.    local ($sect, %sections, %vlist);    # Add more sections as needed.    foreach $sect ('0'..'9', 'n', 'l')    {	if (&variable_defined ('man' . $sect . '_MANS'))	{	    $sections{$sect} = 1;	    $vlist{'$(man' . $sect . '_MANS)'} = 1;	}    }    if (&variable_defined ('man_MANS'))    {	$vlist{'$(man_MANS)'} = 1;	foreach (&variable_value_as_list ('man_MANS', 'all'))	{	    # A page like `foo.1c' goes into man1dir.	    if (/\.([0-9a-z])([a-z]*)$/)	    {		$sections{$1} = 1;	    }	}    }    # Now for each section, generate an install and unintall rule.    # Sort sections so output is deterministic.    local (@namelist);    foreach $sect (sort keys %sections)    {	&define_variable ('man' . $sect . 'dir', '$(mandir)/man' . $sect);	push (@installdirs, '$(DESTDIR)$(mandir)/man' . $sect)	    unless defined $options{'no-installman'};	$output_rules .= &file_contents_with_transform ('s/\@SECTION\@/'							. $sect . '/g;',							'mans');	push (@phony, 'install-man' . $sect, 'uninstall-man' . $sect);	push (@namelist, 'install-man' . $sect);    }    # We don't really need this, but we use it in case we ever want to    # support noinst_MANS.    &define_variable ("MANS", join (' ', sort keys %vlist));    # Generate list of install dirs.    $output_rules .= ("install-man: \$(MANS)\n"		      . "\t\@\$(NORMAL_INSTALL)\n");    &pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @namelist);    push (@phony, 'install-man');    $output_rules .= "uninstall-man:\n\t\@\$(NORMAL_UNINSTALL)\n";    grep ($_ = 'un' . $_, @namelist);    &pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @namelist);    push (@phony, 'uninstall-man');    $output_vars .= &file_contents ('mans-vars');    if (! defined $options{'no-installman'})    {	push (@install_data, 'install-man');	push (@uninstall, 'uninstall-man');	push (@all, '$(MANS)');    }}# Handle DATA variables.sub handle_data{    &am_install_var ('-noextra', 'data', 'DATA', 'data', 'sysconf',		     'sharedstate', 'localstate', 'pkgdata',		     'noinst', 'check');}# Handle TAGS.sub handle_tags{    push (@phony, 'tags');    local (@tag_deps) = ();    if (&variable_defined ('SUBDIRS'))    {	$output_rules .= ("tags-recursive:\n"			  . "\tlist=\'\$(SUBDIRS)\'; for subdir in \$\$list; do \\\n"			  # Never fail here if a subdir fails; it			  # isn't important.			  . "\t  test \"\$\$subdir\" = . || (cd \$\$subdir"			  . " && \$(MAKE) \$(AM_MAKEFLAGS) tags); \\\n"			  . "\tdone\n");	push (@tag_deps, 'tags-recursive');	push (@phony, 'tags-recursive');    }    if (&saw_sources_p (1)	|| &variable_defined ('ETAGS_ARGS')	|| @tag_deps)    {	local ($xform) = '';	local ($one_hdr);	foreach $one_hdr (@config_headers)	{	    if ($relative_dir eq &dirname ($one_hdr))	    {		# The config header is in this directory.  So require it.		local ($var);		($var = &basename ($one_hdr)) =~ s/(\W)/\\$1/g;		$xform .= ' ' if $xform;		$xform .= $var;	    }	}	$xform = ('s/\@CONFIG\@/' . $xform . '/;'		  . 's/\@DIRS\@/' . join (' ', @tag_deps) . '/;');	if (&variable_defined ('SUBDIRS'))	{	    $xform .= 's/^SUBDIRS//;';	}	else	{	    $xform .= 's/^SUBDIRS.*$//;';	}	$output_rules .= &file_contents_with_transform ($xform, 'tags');	$output_rules .= &file_contents ('tags-clean');	push (@clean, 'tags');	&push_phony_cleaners ('tags');	&examine_variable ('TAGS_DEPENDENCIES');    }    elsif (&variable_defined ('TAGS_DEPENDENCIES'))    {	&am_line_error ('TAGS_DEPENDENCIES',			"doesn't make sense to define \`TAGS_DEPENDENCIES' without sources or \`ETAGS_ARGS'");    }    else    {	# Every Makefile must define some sort of TAGS rule.	# Otherwise, it would be possible for a top-level "make TAGS"	# to fail because some subdirectory failed.	$output_rules .= "tags: TAGS\nTAGS:\n\n";    }}# Handle multilib support.sub handle_multilib{    return unless $seen_multilib;    $output_rules .= &file_contents ('multilib.am');    &push_phony_cleaners ('multi');    push (@phony, 'all-multi', 'install-multi');}# Worker for handle_dist.sub handle_dist_worker{    local ($makefile) = @_;    $output_rules .= 'distdir: $(DISTFILES)' . "\n";    # Initialization; only at top level.    if ($relative_dir eq '.')    {	if (defined $options{'check-news'})	{	    # For Gnits users, this is pretty handy.  Look at 15 lines	    # in case some explanatory text is desirable.	    $output_rules .= '	@if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" > /dev/null; then :; else \\	  echo "NEWS not updated; not releasing" 1>&2; \\	  exit 1; \\	fi';	}	# Create dist directory.	$output_rules .= ("\t-rm -rf \$(distdir)\n"			  . "\tmkdir \$(distdir)\n"			  . "\t-chmod 777 \$(distdir)\n");    }    # Only run automake in `dist' target if --include-deps and    # `no-dependencies' not specified.  That way the recipient of a    # distribution can run "make dist" and not need Automake.  You    # might be wondering why we run automake once for each directory    # we distribute, instead of running it once at the top level.  The    # answer is that we want to

⌨️ 快捷键说明

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