root/juggler/trunk/release/scripts/mkmakefile.pl

Revision 20974, 21.9 kB (checked in by patrick, 1 year ago)

Copyright update.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/usr/bin/env perl
2
3 # ************** <auto-copyright.pl BEGIN do not edit this line> **************
4 #
5 # VR Juggler is (C) Copyright 1998-2008 by Iowa State University
6 #
7 # Original Authors:
8 #   Allen Bierbaum, Christopher Just,
9 #   Patrick Hartling, Kevin Meinert,
10 #   Carolina Cruz-Neira, Albert Baker
11 #
12 # This library is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU Library General Public
14 # License as published by the Free Software Foundation; either
15 # version 2 of the License, or (at your option) any later version.
16 #
17 # This library is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 # Library General Public License for more details.
21 #
22 # You should have received a copy of the GNU Library General Public
23 # License along with this library; if not, write to the
24 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 # Boston, MA 02111-1307, USA.
26 #
27 # *************** <auto-copyright.pl END do not edit this line> ***************
28
29 # This script can generate three types of template Makefile.in's from use with
30 # a configure script:
31 #
32 #    1. A Doozer++ makefile that can do one of the following three build
33 #       processes:
34 #           A. Build object files from an auto-detected list of sources
35 #              coming from one or more user-specified directories
36 #           B. Recurse through a list of directories
37 #           C. A and B together
38 #    2. A makefile capable of compiling a single application from an
39 #       arbitrary auto-detected list of sources from an arbitrary list of
40 #       user-specified directories.
41 #    3. A makefile capable of compiling multiple applications from an
42 #       arbitrary list of user-specified sources (compared against an
43 #       auto-detected list for error checking) from an arbitrary list of
44 #       user-specified directories.
45 #
46 # Given the right information, a "real" Makefile can be generated automatically
47 # for any of the above types as part of the creation process.
48 #
49 # The makefiles generated can be used without modification, though in typical
50 # use, they will probably serve as more of a starting point requiring only
51 # minor modifications.
52
53 require 5.004;
54
55 use strict 'vars';
56 use vars qw($dir_prfx $exp_file $gmake $sub_objdir);
57 use vars qw(@basic_libs @extra_libs @includes);
58 use vars qw(%VARS);
59
60 use File::Basename;
61 use File::Copy;
62 use Getopt::Long;
63 use Text::Wrap qw(wrap $columns);
64
65 $columns = 76;
66
67 # Do this to include the path to the script in @INC.
68 my $path;
69
70 BEGIN {
71     $path = (fileparse("$0"))[1];
72 }
73
74 use lib($path);
75 use InstallOps;
76 use SourceList;
77
78 # Subroutine prototypes.
79 sub printHelp();
80 sub findSources($$);
81 sub readSources($);
82 sub printObjMakefile($$@);
83 sub printAppMakefile($$$);
84 sub printMultiAppMakefile($$$);
85 sub printAppMakefileStart_in($$);
86 sub printAppObjs_in($$$);
87 sub printAppSuffixRules_in($$);
88 sub printAppMakefileEnd_in($;@);
89 sub expandAll($);
90
91 # Set default values for all variables used as storage by GetOptions().
92 my $app     = '';
93 my %apps    = ();
94 my $dotin   = 1;
95 my $gmake   = 0;
96 my $heading = '';
97 my $help    = 0;
98 my @srcdirs = ();
99 my @subdirs = ();
100 my @nosrcs  = ();
101
102 $dir_prfx   = '';
103 $sub_objdir = '';
104 @basic_libs = ();
105 @extra_libs = ();
106 @includes   = ();
107
108 my @saved_ARGV = @ARGV;
109
110 GetOptions('app=s' => \$app, 'apps=s' => \%apps, 'basiclibs=s' => \@basic_libs,
111            'dirprefix=s' => \$dir_prfx, 'dotin!' => \$dotin,
112            'expfile=s' => \$exp_file, 'extralibs=s' => \@extra_libs,
113            'gmake' => \$gmake, 'heading=s' => \$heading, 'help' => \$help,
114            'includes=s' => \@includes, 'nosrcs=s' => \@nosrcs,
115            'srcdir=s' => \@srcdirs, 'subdirs=s' => \@subdirs,
116            'subobjdir=s' => \$sub_objdir)
117    or printHelp() && exit(1);
118
119 printHelp() && exit(0) if $help;
120
121 # This allows source directories to be specified using multiple options
122 # and/or using the form --<option>=opt1,opt2,...,optN.
123 @basic_libs = split(/,/, join(',', @basic_libs));
124 @extra_libs = split(/,/, join(',', @extra_libs));
125 @includes   = split(/,/, join(',', @includes));
126 @nosrcs     = split(/,/, join(',', @nosrcs));
127 @srcdirs    = split(/,/, join(',', @srcdirs));
128 @subdirs    = split(/,/, join(',', @subdirs));
129
130 my $all_src = findSources(\@srcdirs, \@nosrcs);
131
132 # Set the generated file name once since all the subroutines will create a
133 # file with the same name.
134 my $makefile_name  = 'Makefile';
135 $makefile_name    .= ".in" if $dotin;
136
137 # Create $makefile_name here.
138 open(MAKEFILE, "> $makefile_name")
139    or die "ERROR: Could not create $makefile_name: $!\n";
140
141 if ( $heading )
142 {
143    if ( open(HEADING, "$heading") )
144    {
145       print MAKEFILE while <HEADING>;
146       close(HEADING);
147    }
148    else
149    {
150       warn "WARNING: Could not read from heading file $heading: $!\n";
151    }
152 }
153
154 # Add a little commercial for this script.
155 print MAKEFILE "# Generated by mkmakefile.pl using the following options:\n";
156 print MAKEFILE wrap("#    ", "#    ", @saved_ARGV), "\n\n";
157
158 # Generate a single-application makefile.
159 if ( $app )
160 {
161    printAppMakefile(MAKEFILE, $all_src, "$app");
162 }
163 # Generate a multi-application makefile.
164 elsif ( keys(%apps) )
165 {
166    printMultiAppMakefile(MAKEFILE, $all_src, \%apps);
167 }
168 # Generate a Doozer++ object-building makefile.
169 else
170 {
171    printObjMakefile(MAKEFILE, $all_src, @subdirs);
172 }
173
174 close(MAKEFILE) or warn "WARNING: Could not close $makefile_name: $!\n";
175
176 # Now replace all the @...@ strings if this is not a Makefile.in.
177 expandAll($makefile_name) unless $dotin;
178
179 exit(0);
180
181 # =============================================================================
182 # Subroutines follow.
183 # =============================================================================
184
185 # -----------------------------------------------------------------------------
186 # Print a usage message explaining how to use this script.
187 # -----------------------------------------------------------------------------
188 sub printHelp()
189 {
190    print <<EOF;
191 Usage:
192     $0
193         [ --app=<name> | --apps <name1>=<srcs1> [ --apps <name2>=<srcs2> ... ]]
194         [ --basiclibs=<lib1> [...] ] [ --dirprefix=<prefix> ]
195         [ --dotin | --nodotin --expfile=<file> ] [ --extralibs=<lib1> [...] ]
196         [ --gmake ] [ --heading=<file> ] [ --includes=<option> [...] ]
197         [ --nosrcs=<file1> [...] ] [ --srcdir=<dirs> [...] ]
198         [ --subdirs=<dirs> [...] ] [ --subobjdir=<dir> ]
199
200 For application makefiles:
201
202     --app=<name>
203         Specify the name of the application to be compiled.
204
205   or
206
207     --apps <name1>=<srcs1> --apps <name2>=<srcs2> ... --apps <nameN>=<srcsN>
208         Specify the names of multiple applications and the lists of source
209         files that will be compiled for each application.
210
211     --basiclibs=<lib1> --basliclibs=<lib2> ... --basiclibs=<libN>
212         Provide additional basic libraries that should be linked.  These
213         are in addition to the default basic libraries linked.  Typically,
214         these are optional libraries built as part of the system being
215         compiled needed for a specific application.
216
217     --extralibs=<lib1> --basliclibs=<lib2> ... --extralibs=<libN>
218         Provide additional extra libraries that should be linked.  These
219         are in addition to the default extra libraries linked.  Typically,
220         these are optional system libraries needed for a specific application.
221
222     --gmake
223         Use GNU make features.
224
225     --srcdir=<dirs1> --srcdir=<dirs2> ... --srcdir=<dirsN>
226         Give a list of directories besides the current directory where
227         source files will be found.  Each directory can be given as an
228         argument to a separate --srcdir option, or they can all be passed
229         to a single --srcdir option as a comma-separated list (no spaces).
230
231 For object makefiles:
232
233     --dirprefix=<prefix>
234         Name a prefix for the directory containing the source files.
235
236     --subdirs=<dirs1> --subdirs=<dirs2> ... --subdirs=<dirsN>
237         Give a list of subdirectories of the current directory where the
238         build must recurse.  Each subdirectory can be given as an argument
239         to a separate --subdirs option, or they can all be passed to a
240         single --subdirs option as a comma-separated list (no spaces).
241
242     --subobjdir=<dir>
243         Name the subdirectory of \$(OBJDIR) where the object files will go.
244
245 For all types of makefiles:
246
247     --dotin (default)
248         Generate Makefile.in
249
250   or
251
252     --nodotin --expfile=<Perl file>
253         Generate a fully expanded Makefile using the \%VARS hash in the
254         file named as the argument to --expfile.
255
256     --heading=<file>
257         Print the contents of the given file at the top of the generated
258         makefile before anything else is written.
259
260     --includes=-I<path1> --includes=-I<path2> ... --includes=-I<pathN>
261         Extend the include path to use the specified additional options.
262         The options must be specified using the compiler option that
263         extends the include path.  Each option can be given as an argument
264         to a separate --includes option, or they can all be passed to a
265         single --includes option as a comma-separated list (no spaces).
266
267     --nosrcs=<file1> --nosrcs=<file2> ... --nosrcs=<fileN>
268         List files that should be excluded when preparing the source list.
269         Each file can be given as an argument to a separate --nosrcs option,
270         or they can all be passed to a single --nosrcs option as a
271         comma-separated list (no spaces).  Any paths used must be the same
272         as used for --srcdir.
273 EOF
274 }
275
276 # -----------------------------------------------------------------------------
277 # Find all the source files in the given directories.
278 # -----------------------------------------------------------------------------
279 sub findSources($$)
280 {
281    my @dirs   = @{$_[0]};
282    my @nosrcs = @{$_[1]};
283
284    # Make sure that the current directory is in the list of directories to
285    # search.
286    my $found_dot = 0;
287
288    foreach ( @dirs )
289    {
290       if ( "$_" eq "." )
291       {
292          $found_dot = 1;
293          last;
294       }
295    }
296
297    push(@dirs, ".") unless $found_dot;
298
299    # Create the primary SourceList object.  It will be populated with
300    # information in the following loop.
301    my $srcs = new SourceList();
302    my $dir;
303
304    # Loop over the given source directories.
305    foreach $dir ( @dirs )
306    {
307       next if $srcs->hasDirectory("$dir");
308       $srcs->readSources("$dir", @nosrcs)
309          or warn "Failed to read sources in $dir\n";
310    }
311
312    return $srcs;
313 }
314
315 # -----------------------------------------------------------------------------
316 # Generate a makefile for use with Doozer++ that can compile object files and
317 # recurse into subdirectories if necessary.
318 # -----------------------------------------------------------------------------
319 sub printObjMakefile($$@)
320 {
321    my $handle  = shift;
322    my $srcs    = shift;
323    my @subdirs = @_;
324
325    my $include_dir = '@includedir@';
326    $include_dir .= "/$dir_prfx" if $dir_prfx;
327
328    # Print out the basic stuff that is common to all types of Doozer++
329    # makefiles.
330    print $handle <<MK_START;
331 default: all
332
333 # Include common definitions here.
334 #include ...
335
336 includedir      = $include_dir
337 srcdir          = \@srcdir\@
338 top_srcdir      = \@top_srcdir\@
339 INSTALL         = \@INSTALL\@
340 MK_START
341
342    print $handle "EXTRA_INCLUDES\t+= @includes" if @includes;
343
344    my($has_objs, $has_subdirs) = (0, 0);
345
346    # Get a list of all the files in the directory.
347    my @src_files = $srcs->getAllFiles();
348    $has_objs = 1 if $#src_files > -1;
349
350    print $handle "SUBOBJDIR\t= $sub_objdir\n" if $sub_objdir && $has_objs;
351
352    print $handle "\n";
353
354    # If there are subdirectories, list them.
355    if ( $#subdirs > -1 )
356    {
357       $has_subdirs = 1;
358       print $handle "DIRPRFX\t= $dir_prfx/\n\n" if $dir_prfx;
359
360       print $handle "# Subdirectories to compile.\n";
361       print $handle "SUBDIR\t=";
362
363       foreach ( @subdirs )
364       {
365          print $handle " $_" unless "$_" eq "." ;
366       }
367
368       print $handle "\n\n";
369    }
370
371    # If there are object files to compile, list the source files.
372    if ( $has_objs )
373    {
374       print $handle "SRCS\t= ", join(' ', sort(@src_files)), "\n";
375
376       # If the directory list has more than one element (which would be
377       # the current directory), add an assignment for $(EXTRA_SRCS_PATH) so
378       # that make will know where to find all the source files.
379       my @other_dirs = $srcs->getDirectories();
380       if ( $#other_dirs > 0 )
381       {
382          print $handle "EXTRA_SRCS_PATH\t= ", join(' ', sort(@other_dirs)),
383                        "\n";
384       }
385
386       print $handle "\n";
387    }
388
389    warn "No object files found, no subdirectories listed!\n"
390       unless $has_objs || $has_subdirs;
391
392    # Include the mk file that build objects and recurses if both object files
393    # and subdirectories must be handled.
394    if ( $has_objs && $has_subdirs )
395    {
396       print $handle "include \$(MKPATH)/dpp.obj-subdir.mk\n\n";
397    }
398    # If we have only objects to build, include that mk file.
399    elsif ( $has_objs )
400    {
401       print $handle "include \$(MKPATH)/dpp.obj.mk\n\n";
402    }
403    # If we have only subdirectories, include the recursion file.
404    elsif ( $has_subdirs )
405    {
406       print $handle "\$(RECTARGET): recursive\n\n";
407       print $handle "include \$(MKPATH)/dpp.subdir.mk\n\n";
408    }
409
410    # If this directory has object files, generate the dependency including
411    # code too.
412    if ( $has_objs )
413    {
414       print $handle <<MK_END;
415 # -----------------------------------------------------------------------------
416 # Include dependencies generated automatically.
417 # -----------------------------------------------------------------------------
418 ifndef DO_CLEANDEPEND
419 -include \$(DEPEND_FILES)
420 endif
421 MK_END
422    }
423 }
424
425 # -----------------------------------------------------------------------------
426 # Generate a makefile capable of compiling a single application.  This is
427 # relatively simple.
428 # -----------------------------------------------------------------------------
429 sub printAppMakefile($$$)
430 {
431    my $handle = shift;
432    my $srcs   = shift;
433    my $app    = shift;
434
435    print $handle "default: $app\@EXEEXT\@\n\n";
436
437    printAppMakefileStart_in($handle, $srcs);
438    printAppObjs_in($handle, 'OBJS', $srcs);
439
440    # Print the target for the application.
441    print $handle <<MK_END;
442 # -----------------------------------------------------------------------------
443 # Application build targets.
444 # -----------------------------------------------------------------------------
445 $app\@EXEEXT\@: \$(OBJS)
446         \$(LINK) \@EXE_NAME_FLAG\@ \$(OBJS) \$(BASIC_LIBS) \$(EXTRA_LIBS)
447
448 MK_END
449
450    printAppSuffixRules_in($handle, $srcs);
451    printAppMakefileEnd_in($handle, "$app");
452 }
453
454 # -----------------------------------------------------------------------------
455 # Print a makefile that can compile multiple applications.  This would be
456 # simpler, but I put in some sanity checking that verifies that the source
457 # files listed on the command line actually exist.
458 # -----------------------------------------------------------------------------
459 sub printMultiAppMakefile($$$)
460 {
461    my $handle = shift;
462    my $srcs   = shift;
463    my %apps   = %{$_[0]};
464
465    print $handle "default: all\n\n";
466
467    printAppMakefileStart_in($handle, $srcs);
468
469    my @cur_srcs = ();
470    my @all_apps = sort(keys(%apps));
471    my $app;
472
473    # Loop over all the applications and verify that their specific source
474    # files exist.
475    foreach $app ( @all_apps )
476    {
477       @cur_srcs = split(/,/, "$apps{$app}");
478
479       # Create a new SourceList object for this application's source list.
480       my $cur_app_src = new SourceList(@cur_srcs);
481
482       # This the actual sanity check loop.
483       my $file;
484       foreach $file ( @cur_srcs )
485       {
486          # Find the current file in the known list.
487          my $dir = $srcs->findFile("$file");
488
489          # If it was found, insert it into the correct directory block for
490          # the SourceList object.
491          if ( $dir )
492          {
493             $cur_app_src->insertFile("$file", "$dir");
494          }
495          # If it was not found, complain.
496          else
497          {
498             warn "WARING: Could not find file $file!\n";
499          }
500       }
501
502       # Finally, generate the object list for this application.
503       printAppObjs_in($handle, "${app}_OBJS", $cur_app_src);
504    }
505
506    print $handle <<EOF;
507 # -----------------------------------------------------------------------------
508 # Application build targets.
509 # -----------------------------------------------------------------------------
510 EOF
511
512    print $handle "all:";
513
514    foreach ( @all_apps )
515    {
516       print $handle " $_\@EXEEXT\@";
517    }
518
519    print $handle "\n\n";
520
521    # Loop over the applications again and print the targets that build the
522    # actual executables.
523    foreach ( @all_apps )
524    {
525       print $handle <<MK_END;
526 $_\@EXEEXT\@: \$(${_}_OBJS)
527         \$(LINK) \@EXE_NAME_FLAG\@ \$(${_}_OBJS) \$(BASIC_LIBS) \$(EXTRA_LIBS)
528
529 MK_END
530    }
531
532    printAppSuffixRules_in($handle, $srcs);
533    printAppMakefileEnd_in($handle, @all_apps);
534 }
535
536 # -----------------------------------------------------------------------------
537 # Print the variable assignments and other "leading" information common to all
538 # applications to be compiled using this system.
539 # -----------------------------------------------------------------------------
540 sub printAppMakefileStart_in($$)
541 {
542    my $handle = shift;
543    my $srcs   = shift;
544
545    my @dirs = sort($srcs->getDirectories());
546
547    # Construct the complete list of include paths.
548    my $inc_line = '@APP_INCLUDES@';
549    $inc_line .= " @includes" if @includes;
550
551    # Add each of the source directories to the include path.
552    foreach ( @dirs )
553    {
554       if ( "$_" eq "." )
555       {
556          $inc_line .= ' -I$(srcdir)';
557       }
558       else
559       {
560          $inc_line .= " -I\$(srcdir)/$_";
561       }
562    }
563
564    print $handle <<MK_START;
565 # Basic options.
566 srcdir          = \@srcdir\@
567 CFLAGS          = \@APP_CFLAGS\@ \$(EXTRA_CFLAGS) \$(INCLUDES) \$(DEFS)
568 CXXFLAGS        = \@APP_CXXFLAGS\@ \$(EXTRA_CFLAGS) \$(INCLUDES) \$(DEFS)
569 DEFS            = \@APP_DEFS\@
570 EXTRA_CFLAGS    = \@APP_EXTRA_CFLAGS\@ \$(DEBUG_CFLAGS)
571 DEBUG_CFLAGS    = \@APP_DEBUG_CFLAGS\@
572 OPTIM_CFLAGS    = \@APP_OPTIM_CFLAGS\@
573 INCLUDES        = $inc_line
574
575 EXTRA_LFLAGS    = \@APP_EXTRA_LFLAGS\@ \$(DEBUG_LFLAGS)
576 DEBUG_LFLAGS    = \@APP_DEBUG_LFLAGS\@
577 OPTIM_LFLAGS    = \@APP_OPTIM_LFLAGS\@
578 LINK_FLAGS      = \@APP_LINK_FLAGS\@ \$(EXTRA_LFLAGS)
579 LINKALL_ON      = \@APP_LINKALL_ON\@
580 LINKALL_OFF     = \@APP_LINKALL_OFF\@
581
582 # Libraries needed for linking.
583 BASIC_LIBS      = \@APP_BASIC_LIBS_BEGIN\@ \@APP_BASIC_LIBS\@ @basic_libs \@APP_BASIC_EXT_LIBS\@ \@APP_BASIC_LIBS_END\@
584 EXTRA_LIBS      = \@APP_EXTRA_LIBS_BEGIN\@ \@APP_EXTRA_LIBS\@ @extra_libs \@APP_EXTRA_LIBS_END\@
585
586 # Commands to execute.
587 C_COMPILE       = \@APP_CC\@ \$(CFLAGS)
588 CXX_COMPILE     = \@APP_CXX\@ \$(CXXFLAGS)
589 LINK            = \@APP_LINK\@ \$(LINK_FLAGS)
590
591 MK_START
592
593    # Fill in the VPATH info.  We'll take advantage of GNU make syntax where
594    # possible.
595    if ( $gmake )
596    {
597       my($suffix, $dir);
598       foreach $suffix ( $srcs->getSuffixes() )
599       {
600          print $handle 'vpath %', "$suffix ";
601
602          foreach $dir ( @dirs )
603          {
604             if ( $srcs->hasSuffix("$dir", "$suffix") )
605             {
606                if ( "$dir" eq "." )
607                {
608                   print $handle '$(srcdir) ';
609                }
610                else
611                {
612                   print $handle "\$(srcdir)/$dir ";
613                }
614             }
615          }
616
617          print $handle "\n";
618       }
619    }
620    else
621    {
622       print $handle "VPATH\t= \@srcdir\@";
623
624       foreach ( @dirs )
625       {
626          print $handle ":\@srcdir\@/$_" if "$_" ne ".";
627       }
628    }
629
630    # Finish the VPATH line.
631    print $handle "\n\n";
632 }
633
634 # -----------------------------------------------------------------------------
635 # Print the assignment for the list of object files to be compiled.  This code
636 # looks pretty simple, but the ugliness is being hidden by the SourceList
637 # class.
638 # -----------------------------------------------------------------------------
639 sub printAppObjs_in($$$)
640 {
641    my($handle, $obj_var, $srcs) = @_;
642
643    # Get the list of files as a scalar and change the suffixes to @OBJEXT@.
644    my $files = join(' ', sort($srcs->getAllFiles()));
645    $files    =~ s/\.(cpp|cxx|c\+\+|cc|c)/.\@OBJEXT\@/gi;
646
647    # XXX: Wrap me!
648    print $handle "$obj_var\t= $files\n\n";
649 }
650
651 # -----------------------------------------------------------------------------
652 # Print the suffix rules needed for this appliation makefile.  Only the rules
653 # needed for the known sources are generated to keep the file simple.
654 # -----------------------------------------------------------------------------
655 sub printAppSuffixRules_in($$)
656 {
657    my($handle, $srcs) = @_;
658
659    my @suffixes = sort($srcs->getSuffixes());
660
661    print $handle "# Suffix rules for building object files.\n";
662    print $handle ".SUFFIXES: ", join(' ', @suffixes), " .\@OBJEXT\@\n\n";
663
664    # XXX: Could use GNU stuff too.
665    foreach ( @suffixes )
666    {
667       print $handle "$_.\@OBJEXT\@:\n";
668
669       # C source file.
670       if ( "$_" eq ".c" )
671       {
672          print $handle "\t\$(C_COMPILE) \@OBJ_NAME_FLAG\@ \@OBJ_BUILD_FLAG\@ \$<\n\n";
673       }
674       # C++ source file.
675       else
676       {
677          print $handle "\t\$(CXX_COMPILE) \@OBJ_NAME_FLAG\@ \@OBJ_BUILD_FLAG\@ \$<\n\n";
678       }
679    }
680 }
681
682 # -----------------------------------------------------------------------------
683 # Finish off the application makefile by adding 'clean' and 'clobber' targets.
684 # -----------------------------------------------------------------------------
685 sub printAppMakefileEnd_in($;@)
686 {
687    my $handle = shift;
688    my @apps   = @_;
689
690    my($dirt, $cruft) = ('', '');
691    foreach ( @_ )
692    {
693       $dirt  .= "$_\@EXEEXT\@ ";
694       $cruft .= "$_.ilk ";
695    }
696
697    print $handle <<MK_END;
698 # -----------------------------------------------------------------------------
699 # Clean-up targets.
700 # -----------------------------------------------------------------------------
701 clean:
702         rm -f Makedepend *.\@OBJEXT\@ $cruft so_locations *.?db core*
703         rm -rf ii_files
704
705 clobber:
706         \@\$(MAKE) clean
707         rm -f $dirt
708 MK_END
709 }
710
711 # -----------------------------------------------------------------------------
712 # Expand all the @...@ strings using the %VARS hash.
713 # -----------------------------------------------------------------------------
714 sub expandAll($)
715 {
716    my $filename = shift;
717
718    # Suck in the full %VARS hash.
719    require "$exp_file" if $exp_file;
720
721    warn "WARNING: No expansion values!\n" unless keys(%VARS) && $exp_file;
722
723    replaceTags("$filename", %VARS);
724 }
Note: See TracBrowser for help on using the browser.