#!/usr/bin/perl use File::Basename ; use Cwd 'abs_path'; use Getopt::Long ; use strict; # read the trick_ver.txt file and print the trick version sub print_version() { my @all_lines ; my $file_contents ; my ($current_version) ; my $trick_ver_txt = "$ENV{TRICK_HOME}/share/trick/trick_ver.txt" ; open FILE, "$trick_ver_txt" or die "$0: Couldn't find $trick_ver_txt\n" ; @all_lines = ; close FILE ; $file_contents = join "" , @all_lines ; ($current_version) = $file_contents =~ /current_version\s*=\s*"([^"]+)"/ ; print "$current_version\n" ; } # print the prefix which is also TRICK_HOME sub print_prefix() { print "$ENV{TRICK_HOME}\n" ; } # Run a special rule in Makefile.sim that prints the value of the environment variable we request sub print_makefile_var($) { open(README, "make -f $ENV{TRICK_HOME}/share/trick/makefiles/Makefile.trickconfig print-@_ | ") or die "Couldn't fork $!\n" ; while () { /=(.*)/ && print "$1\n" ; } close(README) ; } sub print_usage() { print "\ Usage: trick-config