Mercurial > hg > xemacs-beta
diff src/make-src-depend @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 3ecd8885ac67 |
children | 3d3049ae1304 |
line wrap: on
line diff
--- a/src/make-src-depend Mon Aug 13 11:33:40 2007 +0200 +++ b/src/make-src-depend Mon Aug 13 11:35:02 2007 +0200 @@ -45,6 +45,10 @@ $generated_header{$_} = 1; } +# Although this is not technically true, it ought to be true, +# and makes the generated Makefile smaller. +$uses{'lisp.h'}{'config.h'} = 1; + for my $file (keys %exists) { open (FILE, $file) or die "$file: $!"; undef $/; $_ = <FILE>; @@ -52,11 +56,11 @@ s/[ \t]+//g; # Find include dependencies for (/^\#include([^\n]+)/gm) { - if (m@^\"([A-Za-z0-9_-]+\.h)\"@) { + if (m@^\"([A-Za-z0-9._-]+\.h)\"@) { $uses{$file}{$1} = 1 if exists $exists{$1}; - } elsif (m@<([A-Za-z0-9_-]+\.h)>@) { + } elsif (m@<([A-Za-z0-9._-]+\.h)>@) { $uses{$file}{$1} = 1 if exists $generated_header{$1}; - } elsif (m@\"../lwlib/([A-Za-z0-9_-]+\.h)\"@) { + } elsif (m@\"../lwlib/([A-Za-z0-9._-]+\.h)\"@) { $uses{$file}{"\$(LWLIB_SRCDIR)/lwlib.h"} = 1; } } @@ -80,18 +84,17 @@ # Print file header print -"## This file automatically generated by $myName. Do not modify. +"## This file is automatically generated by \`$myName'. Do not modify. -#ifdef USE_UNION_TYPE +#if defined(USE_UNION_TYPE) LISP_UNION_H=lisp-union.h #else LISP_UNION_H=lisp-disunion.h #endif "; -my @LISP_H = ('lisp.h', 'config.h'); -#@LISP_H = grep (! /lisp-(dis)?union\.h/, @LISP_H); -print "LISP_H = @{[grep (!/lisp-(dis)?union\.h/, @LISP_H)]} \$(LISP_UNION_H)\n"; +my @LISP_H = ('lisp.h', keys %{$uses{'lisp.h'}}); +print "LISP_H=@{[grep (!/lisp-(dis)?union\.h/, @LISP_H)]} \$(LISP_UNION_H)\n"; sub PrintDeps { my $file = shift; @@ -105,7 +108,7 @@ sub PrintPatternDeps { my ($pattern, $CPP_SYMBOL) = @_; - print "#ifdef $CPP_SYMBOL\n"; + print "#if defined($CPP_SYMBOL)\n"; for my $file (sort grep (/$pattern/ && /\.c$/, keys %uses)) { PrintDeps($file); delete $uses{$file}; @@ -113,14 +116,16 @@ print "#endif\n"; } -PrintPatternDeps ('-msw', "HAVE_MS_WINDOWS"); -PrintPatternDeps ('-x', "HAVE_X_WINDOWS"); -PrintPatternDeps ('database', "HAVE_DATABASE"); -PrintPatternDeps ('^mule', "MULE"); +PrintPatternDeps ('-msw\\.', "HAVE_MS_WINDOWS"); +PrintPatternDeps ('-x\\.', "HAVE_X_WINDOWS"); +PrintPatternDeps ('-tty\\.', "HAVE_TTY"); +PrintPatternDeps ('^database', "HAVE_DATABASE"); +PrintPatternDeps ('^mule', "MULE"); PrintPatternDeps ('^(?:External|extw-)', "EXTERNAL_WIDGET"); for my $file (sort grep (/\.c$/, keys %uses)) { PrintDeps($file); } +# Surprisingly robust regexp to remove comments from arbitrary C code sub RemoveComments { $_[0] =~ s{ (