summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ghc.mk5
-rw-r--r--rules/build-perl.mk6
-rw-r--r--utils/compare_sizes/LICENSE31
-rw-r--r--utils/compare_sizes/Main.hs (renamed from utils/compare_sizes/compareSizes.hs)6
-rw-r--r--utils/compare_sizes/compareSizes.cabal19
-rw-r--r--utils/compare_sizes/ghc.mk8
-rw-r--r--utils/count_lines/count_lines.lprl (renamed from utils/count_lines/count_lines)5
-rw-r--r--utils/count_lines/ghc.mk5
8 files changed, 81 insertions, 4 deletions
diff --git a/ghc.mk b/ghc.mk
index f47aece28e..9eaa7cd3e2 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -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
diff --git a/rules/build-perl.mk b/rules/build-perl.mk
index 669f3d7be4..f3ea2b67b1 100644
--- a/rules/build-perl.mk
+++ b/rules/build-perl.mk
@@ -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
diff --git a/utils/compare_sizes/LICENSE b/utils/compare_sizes/LICENSE
new file mode 100644
index 0000000000..b5059b71f6
--- /dev/null
+++ b/utils/compare_sizes/LICENSE
@@ -0,0 +1,31 @@
+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.
diff --git a/utils/compare_sizes/compareSizes.hs b/utils/compare_sizes/Main.hs
index a0397bf2fa..302efafb22 100644
--- a/utils/compare_sizes/compareSizes.hs
+++ b/utils/compare_sizes/Main.hs
@@ -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
diff --git a/utils/compare_sizes/compareSizes.cabal b/utils/compare_sizes/compareSizes.cabal
new file mode 100644
index 0000000000..32acb1d6e7
--- /dev/null
+++ b/utils/compare_sizes/compareSizes.cabal
@@ -0,0 +1,19 @@
+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
+
diff --git a/utils/compare_sizes/ghc.mk b/utils/compare_sizes/ghc.mk
new file mode 100644
index 0000000000..1c9dbee4a9
--- /dev/null
+++ b/utils/compare_sizes/ghc.mk
@@ -0,0 +1,8 @@
+
+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))
+
diff --git a/utils/count_lines/count_lines b/utils/count_lines/count_lines.lprl
index 1e0942c93f..cec332616e 100644
--- a/utils/count_lines/count_lines
+++ b/utils/count_lines/count_lines.lprl
@@ -1,5 +1,7 @@
#! /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}
+
diff --git a/utils/count_lines/ghc.mk b/utils/count_lines/ghc.mk
new file mode 100644
index 0000000000..c467413381
--- /dev/null
+++ b/utils/count_lines/ghc.mk
@@ -0,0 +1,5 @@
+
+utils/count_lines_PERL_SRC = count_lines.lprl
+utils/count_lines_dist_PROG = count_lines
+
+$(eval $(call build-perl,utils/count_lines,dist))