diff options
author | Ian Lynagh <ian@well-typed.com> | 2013-02-22 23:47:26 +0000 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2013-02-22 23:56:38 +0000 |
commit | 8a6b56549ea12be736c47172d3cbeba9dc667918 (patch) | |
tree | 3c107dc099106ae006e031a7dfc358e00ee6b95e /rules | |
parent | e2249ff2c60fdade47489e7eb537a82fe397bd00 (diff) | |
download | haskell-8a6b56549ea12be736c47172d3cbeba9dc667918.tar.gz |
Add another chapter to the hi-rule novel
Diffstat (limited to 'rules')
-rw-r--r-- | rules/hi-rule.mk | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/rules/hi-rule.mk b/rules/hi-rule.mk index a343389967..b87e600990 100644 --- a/rules/hi-rule.mk +++ b/rules/hi-rule.mk @@ -67,9 +67,27 @@ # However, given that rule, make thinks that it can make .hi files # for any object file, even if the object file was created from e.g. # a C source file. We therefore also add a dependency on the .hs/.lhs -# source file, which means we finally end up with rules like: +# source file, which means we end up with rules like: # # a/%.hi : a/%.o b/%.hs ; +# +# But! If a file is not explicitly mentioned in a makefile, then if +# make needs to build it using such a %-rule then it treats it as an +# 'intermediate file', and deletes it when it is finished. Most .hi +# files are mentioned in .depend* files, as some other module depends on +# them, but there are some library modules that aren't imported by +# anything in the tree. +# +# We could stop make from deleting the .hi files by declaring +# ".SECONDARY:", but if we do that then make takes a pathologically long +# time with our build system. So we now generate (by calling hi-rule +# from .depend* files) rules that look like +# +# a/B.hi a/B.dyn_hi : %hi : %o x/B.hs +# +# Now all the .hi files are explicitly mentioned in the makefiles, so +# make doesn't think they are merely intermediate files, and doesn't +# delete them. ifeq "$(ExtraMakefileSanityChecks)" "NO" |