Commit 8e63e8ea authored by Ian Lynagh's avatar Ian Lynagh

Build and install inplace the count_lines and compareSizes utils

parent 76dfa394
......@@ -398,6 +398,7 @@ ghc/stage2/package-data.mk: compiler/stage2/package-data.mk
utils/haddock/dist/package-data.mk: compiler/stage2/package-data.mk
utils/hsc2hs/dist-install/package-data.mk: compiler/stage2/package-data.mk
utils/compare_sizes/dist/package-data.mk: compiler/stage2/package-data.mk
# add the final two package.conf dependencies: ghc-prim depends on RTS,
# and RTS depends on libffi.
......@@ -553,6 +554,9 @@ BUILD_DIRS += \
$(GHC_TOUCHY_DIR)
endif
BUILD_DIRS += utils/count_lines
BUILD_DIRS += utils/compare_sizes
ifneq "$(CLEANING)" "YES"
# After compiler/, because these packages depend on it
BUILD_DIRS += \
......@@ -595,6 +599,7 @@ utils/runghc_dist_DISABLE = YES
utils/hpc_dist_DISABLE = YES
utils/hsc2hs_dist-install_DISABLE = YES
utils/ghc-pkg_dist-install_DISABLE = YES
utils/compare_sizes_dist_DISABLE = YES
compiler_stage2_DISABLE = YES
compiler_stage3_DISABLE = YES
ghc_stage2_DISABLE = YES
......
......@@ -23,12 +23,12 @@ define build-perl
# $2 = distdir
ifeq "$$($1_$2_TOPDIR)" "YES"
$1_$2_INPLACE = $(INPLACE_TOPDIR)/$$($1_$2_PROG)
$1_$2_INPLACE = $$(INPLACE_TOPDIR)/$$($1_$2_PROG)
else
$1_$2_INPLACE = $(INPLACE_BIN)/$$($1_$2_PROG)
$1_$2_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG)
endif
$(call all-target,$$($1_$2_INPLACE))
$(call all-target,$1_$2,$$($1_$2_INPLACE))
$(call clean-target,$1,$2,$1/$2 $$($1_$2_INPLACE))
.PHONY: clean_$1
......
The Glasgow Haskell Compiler License
Copyright 2002, The University Court of the University of Glasgow.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither name of the University nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
......@@ -89,7 +89,8 @@ getTree isFileInteresting root dir subdir
dir' = dir <//> subdir
doEntry :: FilePath -> IO (Maybe Tree)
doEntry e = liftM Just (getTree isFileInteresting root dir' e)
`catch` \_ -> -- XXX Do this better
`catchIO` \_ -> -- XXX We ought to check this is a
-- "not a directory" exception really
if isFileInteresting e
then do let fn = dir' <//> e
h <- openFile (root </> fn) ReadMode
......@@ -98,6 +99,9 @@ getTree isFileInteresting root dir subdir
return $ Just $ File e fn size
else return Nothing
catchIO :: IO a -> (IOError -> IO a) -> IO a
catchIO = catch
----------------------------------------------------------------------
-- Comparing the trees
......
name: compareSizes
version: 0.1.0.0
cabal-version: >= 1.6
license: BSD3
build-type: Simple
license-file: LICENSE
stability: experimental
synopsis: Size comparison util
description: Size comparison util
category: Development
executable compareSizes
build-depends:
base >= 4 && < 5,
directory,
filepath
main-is: Main.hs
utils/compare_sizes_USES_CABAL = YES
utils/compare_sizes_PACKAGE = compareSizes
utils/compare_sizes_MODULES = Main
utils/compare_sizes_dist_PROG = compareSizes$(exeext)
$(eval $(call build-prog,utils/compare_sizes,dist,1))
#! /usr/bin/perl
\begin{code}
use FindBin;
%DirCount = ();
......@@ -65,3 +67,6 @@ foreach $m (sort (keys %ModCount)) {
$totcmts += $ModComments{$m};
}
printf "\n%-20s %6d %6d\n", 'TOTAL:', $tot, $totcmts;
\end{code}
utils/count_lines_PERL_SRC = count_lines.lprl
utils/count_lines_dist_PROG = count_lines
$(eval $(call build-perl,utils/count_lines,dist))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment