2016-02-21 13:21:41 +03:00
|
|
|
#!/usr/bin/env stack
|
2018-03-31 04:43:28 +03:00
|
|
|
{- stack exec
|
|
|
|
--verbosity=info
|
2016-04-05 16:59:52 +03:00
|
|
|
--package base-prelude
|
|
|
|
--package directory
|
|
|
|
--package extra
|
|
|
|
--package safe
|
|
|
|
--package shake
|
|
|
|
--package time
|
2018-04-26 03:41:28 +03:00
|
|
|
ghc
|
2016-04-05 16:59:52 +03:00
|
|
|
-}
|
|
|
|
{-
|
2016-10-28 21:15:10 +03:00
|
|
|
One of two project scripts files (Makefile, Shake.hs).
|
|
|
|
This one provides a stronger programming language and more
|
|
|
|
platform independence than Make. It will build needed packages (above)
|
|
|
|
on first run and whenever the resolver in stack.yaml changes.
|
|
|
|
To minimise such startup delays, and reduce sensitivity to git checkout,
|
2016-12-29 22:21:32 +03:00
|
|
|
compiling is recommended; run the script in interpreted mode to do that.
|
2016-10-28 21:15:10 +03:00
|
|
|
|
|
|
|
It requires stack (https://haskell-lang.org/get-started) and
|
|
|
|
auto-installs the packages above. Also, some rules require:
|
2016-10-29 19:45:59 +03:00
|
|
|
- runhaskell
|
2016-10-28 21:15:10 +03:00
|
|
|
- groff
|
|
|
|
- m4
|
|
|
|
- makeinfo
|
2016-10-29 19:45:59 +03:00
|
|
|
- git
|
|
|
|
- patch
|
2016-10-28 21:15:10 +03:00
|
|
|
|
2016-12-31 01:32:43 +03:00
|
|
|
Usage: see below. Also:
|
|
|
|
|
|
|
|
$ find hledger-lib hledger | entr ./Shake website # rebuild web files on changes in these dirs
|
2016-04-05 16:59:52 +03:00
|
|
|
|
2016-10-28 21:15:10 +03:00
|
|
|
Shake wishes:
|
|
|
|
just one shake import
|
|
|
|
wildcards in phony rules
|
|
|
|
multiple individually accessible wildcards
|
|
|
|
not having to write :: Action ExitCode after a non-final cmd
|
|
|
|
-}
|
2016-04-05 16:59:52 +03:00
|
|
|
|
2016-10-29 20:51:43 +03:00
|
|
|
{-# LANGUAGE PackageImports, ScopedTypeVariables #-}
|
|
|
|
|
2016-04-05 16:59:52 +03:00
|
|
|
import Prelude ()
|
|
|
|
import "base-prelude" BasePrelude
|
2018-03-31 04:43:28 +03:00
|
|
|
import "directory" System.Directory as S (getDirectoryContents)
|
2016-04-05 16:59:52 +03:00
|
|
|
import "extra" Data.List.Extra
|
|
|
|
import "safe" Safe
|
|
|
|
import "shake" Development.Shake
|
|
|
|
import "shake" Development.Shake.FilePath
|
|
|
|
import "time" Data.Time
|
|
|
|
|
2016-10-28 21:15:10 +03:00
|
|
|
usage = unlines
|
|
|
|
["Usage:"
|
2016-12-29 22:21:32 +03:00
|
|
|
,"./Shake.hs # compile this script"
|
2016-10-28 21:15:10 +03:00
|
|
|
,"./Shake # show commands"
|
2017-08-01 01:53:34 +03:00
|
|
|
,"./Shake manuals # generate the txt/man/info manuals"
|
|
|
|
,"./Shake website # generate the html manuals and website"
|
2017-01-05 03:17:39 +03:00
|
|
|
-- ,"./Shake manpages # generate nroff files for man"
|
|
|
|
-- ,"./Shake txtmanpages # generate text man pages for embedding"
|
|
|
|
-- ,"./Shake infomanpages # generate info files for info"
|
2018-05-09 20:20:21 +03:00
|
|
|
-- ,"./Shake webmanpages # generate individual web man pages as markdown"
|
|
|
|
-- ,"./Shake webmanall # generate all-in-one web manual as markdown"
|
2017-01-05 03:17:39 +03:00
|
|
|
,"./Shake site/doc/VER/.snapshot # generate and save a versioned web site snapshot"
|
2016-10-28 21:15:10 +03:00
|
|
|
,"./Shake all # generate everything"
|
|
|
|
,"./Shake clean # clean generated files"
|
|
|
|
,"./Shake Clean # clean harder"
|
|
|
|
,"./Shake --help # show options, eg --color"
|
|
|
|
]
|
2016-02-21 13:21:41 +03:00
|
|
|
|
2018-05-21 06:19:50 +03:00
|
|
|
pandoc = "pandoc" -- assume pandoc from system or user install
|
2016-04-19 03:54:55 +03:00
|
|
|
makeinfo = "makeinfo"
|
2016-06-12 07:34:20 +03:00
|
|
|
-- nroff = "nroff"
|
|
|
|
groff = "groff"
|
2018-04-28 06:29:26 +03:00
|
|
|
dropDirectory2 = dropDirectory1 . dropDirectory1
|
2016-02-21 13:21:41 +03:00
|
|
|
|
|
|
|
main = do
|
|
|
|
|
2016-04-05 16:59:52 +03:00
|
|
|
shakeArgs
|
|
|
|
shakeOptions{
|
2016-04-13 06:32:01 +03:00
|
|
|
shakeVerbosity=Loud
|
2016-04-05 16:59:52 +03:00
|
|
|
-- ,shakeReport=[".shake.html"]
|
|
|
|
} $ do
|
|
|
|
|
|
|
|
want ["help"]
|
|
|
|
|
|
|
|
phony "help" $ liftIO $ putStrLn usage
|
|
|
|
|
2016-12-29 22:21:32 +03:00
|
|
|
-- phony "compile" $ need ["Shake"]
|
|
|
|
--
|
|
|
|
-- "Shake" %> \out -> do
|
|
|
|
-- need [out <.> "hs"]
|
2017-01-05 03:17:39 +03:00
|
|
|
-- unit $ cmd "./Shake.hs" -- running as stack script installs deps and compiles
|
2016-12-29 22:21:32 +03:00
|
|
|
-- putLoud "You can now run ./Shake instead of ./Shake.hs"
|
2016-04-05 16:59:52 +03:00
|
|
|
|
2017-08-01 01:53:34 +03:00
|
|
|
phony "all" $ need ["manuals", "website"]
|
2016-04-06 02:16:38 +03:00
|
|
|
|
2017-08-01 01:53:34 +03:00
|
|
|
-- manuals
|
2016-04-08 17:01:11 +03:00
|
|
|
|
|
|
|
let
|
|
|
|
manpageNames = [ -- in suggested reading order
|
|
|
|
"hledger.1"
|
|
|
|
,"hledger-ui.1"
|
|
|
|
,"hledger-web.1"
|
|
|
|
,"hledger-api.1"
|
|
|
|
,"hledger_journal.5"
|
|
|
|
,"hledger_csv.5"
|
2016-04-13 07:10:02 +03:00
|
|
|
,"hledger_timeclock.5"
|
2016-04-08 17:01:11 +03:00
|
|
|
,"hledger_timedot.5"
|
|
|
|
]
|
2017-01-26 17:40:50 +03:00
|
|
|
|
2017-12-07 05:16:35 +03:00
|
|
|
manualNames = map manpageNameToManualName manpageNames
|
|
|
|
|
|
|
|
-- hledger.1 -> hledger, hledger_journal.5 -> hledger_journal
|
|
|
|
manpageNameToManualName = dropNumericSuffix
|
|
|
|
where
|
|
|
|
dropNumericSuffix s = reverse $
|
|
|
|
case reverse s of
|
|
|
|
c : '.' : cs | isDigit c -> cs
|
|
|
|
cs -> cs
|
|
|
|
|
|
|
|
-- hledger -> hledger.1, hledger_journal -> hledger_journal.5
|
|
|
|
manualNameToManpageName s
|
|
|
|
| '_' `elem` s = s <.> "5"
|
|
|
|
| otherwise = s <.> "1"
|
|
|
|
|
|
|
|
-- manuals m4 source; may include other source files (hledger/hledger.m4.md)
|
|
|
|
m4manpages = [manualDir m </> m <.> "m4.md" | m <- manualNames]
|
|
|
|
|
|
|
|
-- manuals rendered to nroff, ready for man (hledger/hledger.1)
|
2016-04-16 13:47:00 +03:00
|
|
|
nroffmanpages = [manpageDir m </> m | m <- manpageNames]
|
2017-01-26 17:40:50 +03:00
|
|
|
|
2017-12-07 05:16:35 +03:00
|
|
|
-- manuals rendered to text, ready for embedding (hledger/hledger.txt)
|
|
|
|
txtmanpages = [manualDir m </> m <.> "txt" | m <- manualNames]
|
2017-01-26 17:40:50 +03:00
|
|
|
|
2017-12-07 05:16:35 +03:00
|
|
|
-- manuals rendered to info, ready for info (hledger/hledger.info)
|
|
|
|
infomanpages = [manualDir m </> m <.> "info" | m <- manualNames]
|
2017-01-26 17:40:50 +03:00
|
|
|
|
2018-05-06 08:18:58 +03:00
|
|
|
-- manuals rendered to markdown, ready for web output by pandoc (site/hledger.md)
|
|
|
|
webmanpages = ["site" </> manpageNameToUri m <.> "md" | m <- manpageNames]
|
|
|
|
|
|
|
|
-- versions of documentation (excluding 0.27)
|
2018-07-04 15:22:09 +03:00
|
|
|
docversions = [ "1.0" , "1.1" , "1.2" , "1.3" , "1.4" , "1.5" , "1.9", "1.10" ]
|
2018-05-06 08:18:58 +03:00
|
|
|
|
|
|
|
-- manuals rendered to html by pandoc
|
|
|
|
webhtmlpages
|
|
|
|
= map (normalise . ("site/_site" </>))
|
|
|
|
$ ( [ prefix </> manpageNameToUri mPage <.> "html"
|
|
|
|
| prefix <- "" : [ "doc" </> v | v <- docversions ]
|
|
|
|
, mPage <- manpageNames
|
|
|
|
]
|
|
|
|
++ [ mPage <.> "html"
|
|
|
|
| mPage <- [ "contributors" , "download" , "ledgertips" , "index" , "intro" , "release-notes" ]
|
|
|
|
]
|
|
|
|
++ [ prefix </> "manual" <.> "html"
|
|
|
|
| prefix <- "" : "doc/0.27" : [ "doc" </> v | v <- docversions ]
|
|
|
|
]
|
|
|
|
)
|
2017-01-26 17:40:50 +03:00
|
|
|
|
2018-05-09 20:20:21 +03:00
|
|
|
-- manuals rendered to markdown and combined, ready for web rendering
|
2017-01-05 03:17:39 +03:00
|
|
|
webmanall = "site/manual.md"
|
2016-04-16 13:47:00 +03:00
|
|
|
|
2018-04-28 06:29:26 +03:00
|
|
|
-- file extensions which should just be copied directly over to the website
|
|
|
|
webcopyfileexts = ["png", "gif", "cur", "js", "css", "eot", "ttf", "woff", "svg"]
|
|
|
|
|
2016-04-16 13:47:00 +03:00
|
|
|
-- hledger.1 -> hledger/doc, hledger_journal.5 -> hledger-lib/doc
|
|
|
|
manpageDir m
|
2017-12-07 05:16:35 +03:00
|
|
|
| '_' `elem` m = "hledger-lib"
|
|
|
|
| otherwise = dropExtension m
|
|
|
|
|
|
|
|
-- hledger -> hledger, hledger_journal -> hledger-lib
|
|
|
|
manualDir m
|
|
|
|
| '_' `elem` m = "hledger-lib"
|
|
|
|
| otherwise = m
|
2016-04-08 17:01:11 +03:00
|
|
|
|
|
|
|
-- hledger.1 -> hledger, hledger_journal.5 -> journal
|
|
|
|
manpageNameToUri m | "hledger_" `isPrefixOf` m = dropExtension $ drop 8 m
|
|
|
|
| otherwise = dropExtension m
|
|
|
|
|
|
|
|
-- hledger -> hledger.1, journal -> hledger_journal.5
|
|
|
|
manpageUriToName u | "hledger" `isPrefixOf` u = u <.> "1"
|
|
|
|
| otherwise = "hledger_" ++ u <.> "5"
|
|
|
|
|
2017-08-01 01:53:34 +03:00
|
|
|
phony "manuals" $ do
|
2016-04-16 13:47:00 +03:00
|
|
|
need $
|
|
|
|
nroffmanpages
|
2016-04-19 03:54:55 +03:00
|
|
|
++ infomanpages
|
2016-04-16 13:47:00 +03:00
|
|
|
++ txtmanpages
|
2016-04-08 17:01:11 +03:00
|
|
|
|
2016-04-16 13:47:00 +03:00
|
|
|
-- man pages
|
|
|
|
|
2016-04-16 20:09:51 +03:00
|
|
|
-- use m4 and pandoc to process macros, filter content, and convert to nroff suitable for man output
|
2016-04-16 13:47:00 +03:00
|
|
|
phony "manpages" $ need nroffmanpages
|
|
|
|
|
2017-12-07 05:16:35 +03:00
|
|
|
nroffmanpages |%> \out -> do -- hledger/hledger.1
|
|
|
|
let src = manpageNameToManualName out <.> "m4.md"
|
2016-04-16 20:09:51 +03:00
|
|
|
lib = "doc/lib.m4"
|
|
|
|
dir = takeDirectory out
|
doc: experimental m4-based man page build process
The new m4manpages, m4webmanpages targets generate nroff and markdown
man pages via an alternate, excitingly complicated process, involving
shake, hakyll, pandoc *and* m4. Currently just the hledger man page is
processed this way, and the output (hledger/doc/m4-hledger.1,
site/m4-hledger.1.md) is equivalent to that of the non-m4 process.
Pro: selecting and massaging web/man content may be smoother with m4
than with pandoc filters. File inclusion allows documentation to be
broken up into chunks, which may be easier to edit, reorganize and
reuse. Macros could reduce boilerplate and enable more featureful and
attractive docs.
Con: the non-m4 process was simpler, easier to for contributors to
understand and working well enough. YAGNI.
2016-04-06 18:23:12 +03:00
|
|
|
tmpl = "doc/manpage.nroff"
|
2016-04-16 20:09:51 +03:00
|
|
|
-- assume all other m4 files in dir are included by this one XXX not true in hledger-lib
|
|
|
|
deps <- liftIO $ filter (/= src) . filter (".m4.md" `isSuffixOf`) . map (dir </>) <$> S.getDirectoryContents dir
|
2018-04-26 02:44:30 +03:00
|
|
|
need $ src : lib : tmpl : deps
|
2016-04-16 20:09:51 +03:00
|
|
|
cmd Shell
|
|
|
|
"m4 -P -DMAN -I" dir lib src "|"
|
|
|
|
pandoc "-f markdown -s --template" tmpl
|
2018-04-22 01:00:45 +03:00
|
|
|
"--lua-filter tools/pandoc-drop-html-blocks.lua"
|
2018-04-22 01:17:00 +03:00
|
|
|
"--lua-filter tools/pandoc-drop-html-inlines.lua"
|
2018-04-22 01:23:07 +03:00
|
|
|
"--lua-filter tools/pandoc-drop-links.lua"
|
2016-04-08 07:58:42 +03:00
|
|
|
"-o" out
|
2016-02-21 13:21:41 +03:00
|
|
|
|
2016-04-16 13:47:00 +03:00
|
|
|
-- render man page nroffs to fixed-width text for embedding in executables, with nroff
|
2016-04-14 08:29:16 +03:00
|
|
|
phony "txtmanpages" $ need txtmanpages
|
|
|
|
|
2017-12-07 05:16:35 +03:00
|
|
|
txtmanpages |%> \out -> do -- hledger/hledger.txt
|
2017-12-07 07:53:36 +03:00
|
|
|
let src = manualNameToManpageName $ dropExtension out
|
2016-04-16 13:47:00 +03:00
|
|
|
need [src]
|
2016-06-12 07:34:20 +03:00
|
|
|
cmd Shell groff "-t -e -mandoc -Tascii" src "| col -bx >" out -- http://www.tldp.org/HOWTO/Man-Page/q10.html
|
2016-04-16 13:47:00 +03:00
|
|
|
|
2016-04-19 03:54:55 +03:00
|
|
|
-- use m4 and pandoc to process macros, filter content, and convert to info, suitable for info viewing
|
|
|
|
phony "infomanpages" $ need infomanpages
|
|
|
|
|
2017-12-07 05:16:35 +03:00
|
|
|
infomanpages |%> \out -> do -- hledger/hledger.info
|
2016-04-19 03:54:55 +03:00
|
|
|
let src = out -<.> "m4.md"
|
|
|
|
lib = "doc/lib.m4"
|
|
|
|
dir = takeDirectory out
|
|
|
|
-- assume all other m4 files in dir are included by this one XXX not true in hledger-lib
|
|
|
|
deps <- liftIO $ filter (/= src) . filter (".m4.md" `isSuffixOf`) . map (dir </>) <$> S.getDirectoryContents dir
|
2018-04-26 02:44:30 +03:00
|
|
|
need $ src : lib : deps
|
2016-04-19 03:54:55 +03:00
|
|
|
cmd Shell
|
|
|
|
"m4 -P -I" dir lib src "|"
|
|
|
|
pandoc "-f markdown"
|
2018-04-22 01:00:45 +03:00
|
|
|
"--lua-filter tools/pandoc-drop-html-blocks.lua"
|
2018-04-22 01:17:00 +03:00
|
|
|
"--lua-filter tools/pandoc-drop-html-inlines.lua"
|
2018-04-22 01:23:07 +03:00
|
|
|
"--lua-filter tools/pandoc-drop-links.lua"
|
2016-04-19 03:54:55 +03:00
|
|
|
"-t texinfo |"
|
|
|
|
makeinfo "--force --no-split -o" out
|
|
|
|
|
2016-04-16 13:47:00 +03:00
|
|
|
-- web site
|
|
|
|
|
2016-05-28 22:10:51 +03:00
|
|
|
phony "website" $ do
|
2018-05-06 08:18:58 +03:00
|
|
|
need $ [ "website-copy" , "website-render" ]
|
2016-04-16 13:47:00 +03:00
|
|
|
|
2016-04-16 20:09:51 +03:00
|
|
|
-- use m4 and pandoc to process macros and filter content, leaving markdown suitable for web output
|
2016-04-08 17:01:11 +03:00
|
|
|
phony "webmanpages" $ need webmanpages
|
2016-04-16 13:47:00 +03:00
|
|
|
|
|
|
|
webmanpages |%> \out -> do -- site/hledger.md
|
2017-12-07 05:16:35 +03:00
|
|
|
let manpage = manpageUriToName $ dropExtension $ takeFileName out -- hledger
|
|
|
|
manual = manpageNameToManualName manpage
|
|
|
|
dir = manpageDir manpage
|
|
|
|
src = dir </> manual <.> "m4.md"
|
2016-04-16 20:09:51 +03:00
|
|
|
lib = "doc/lib.m4"
|
2017-12-07 05:16:35 +03:00
|
|
|
heading = let h = manual
|
2016-04-09 23:36:48 +03:00
|
|
|
in if "hledger_" `isPrefixOf` h
|
|
|
|
then drop 8 h ++ " format"
|
|
|
|
else h
|
2016-04-16 20:09:51 +03:00
|
|
|
-- assume all other m4 files in dir are included by this one XXX not true in hledger-lib
|
|
|
|
deps <- liftIO $ filter (/= src) . filter (".m4.md" `isSuffixOf`) . map (dir </>) <$> S.getDirectoryContents dir
|
2018-04-26 02:44:30 +03:00
|
|
|
need $ src : lib : deps
|
2016-04-09 23:36:48 +03:00
|
|
|
liftIO $ writeFile out $ "# " ++ heading ++ "\n\n"
|
2016-04-16 20:09:51 +03:00
|
|
|
cmd Shell
|
|
|
|
"m4 -P -DMAN -DWEB -I" dir lib src "|"
|
2018-01-25 05:32:29 +03:00
|
|
|
pandoc "-f markdown -t markdown-fenced_divs --atx-headers"
|
2018-04-18 05:25:06 +03:00
|
|
|
"--lua-filter tools/pandoc-demote-headers.lua"
|
2016-04-09 23:36:48 +03:00
|
|
|
">>" out
|
2016-02-21 13:21:41 +03:00
|
|
|
|
2016-04-09 23:19:31 +03:00
|
|
|
-- adjust and combine man page mds for single-page web output, using pandoc
|
2017-01-05 03:17:39 +03:00
|
|
|
phony "webmanall" $ need [ webmanall ]
|
2016-04-16 13:47:00 +03:00
|
|
|
|
2017-01-05 03:17:39 +03:00
|
|
|
webmanall %> \out -> do
|
2016-04-08 17:01:11 +03:00
|
|
|
need webmanpages
|
2018-05-11 07:01:25 +03:00
|
|
|
liftIO $ writeFile webmanall "\\$toc\\$" -- # Big Manual\n\n -- TOC style is better without main heading,
|
2016-04-08 17:01:11 +03:00
|
|
|
forM_ webmanpages $ \f -> do -- site/hledger.md, site/journal.md
|
2017-01-05 03:17:39 +03:00
|
|
|
cmd Shell ("printf '\\n\\n' >>") webmanall :: Action ExitCode
|
2018-05-21 06:19:50 +03:00
|
|
|
cmd Shell pandoc f "-t markdown-fenced_divs --atx-headers"
|
2018-04-22 02:10:24 +03:00
|
|
|
"--lua-filter tools/pandoc-drop-toc.lua"
|
2018-04-18 05:25:06 +03:00
|
|
|
"--lua-filter tools/pandoc-demote-headers.lua"
|
2017-01-05 03:17:39 +03:00
|
|
|
">>" webmanall :: Action ExitCode
|
2016-08-07 18:28:47 +03:00
|
|
|
|
2017-01-26 17:40:50 +03:00
|
|
|
-- adjust and combine recipe mds for single-page web output, using pandoc
|
2017-01-05 03:17:39 +03:00
|
|
|
-- build the currently checked out web docs and save as a named snapshot
|
|
|
|
"site/doc/*/.snapshot" %> \out -> do
|
|
|
|
need [ webmanall ]
|
|
|
|
let snapshot = takeDirectory out
|
|
|
|
cmd Shell "mkdir -p" snapshot :: Action ExitCode
|
|
|
|
forM_ webmanpages $ \f -> do -- site/hledger.md, site/journal.md
|
|
|
|
cmd Shell "cp" f (snapshot </> takeFileName f) :: Action ExitCode
|
|
|
|
cmd Shell "cp" "site/manual.md" snapshot :: Action ExitCode
|
|
|
|
cmd Shell "cp -r site/images" snapshot :: Action ExitCode
|
|
|
|
cmd Shell "touch" out -- :: Action ExitCode
|
2016-04-16 15:55:16 +03:00
|
|
|
|
2018-04-28 06:29:26 +03:00
|
|
|
phony "website-copy" $ do
|
|
|
|
orig_files <- getDirectoryFiles "site" (map ("//*" <.>) webcopyfileexts)
|
|
|
|
need [ "site/_site" </> file
|
|
|
|
| file <- "files/README" : orig_files
|
|
|
|
, not ("_site//*" ?== file)
|
|
|
|
]
|
|
|
|
|
2018-05-06 08:18:58 +03:00
|
|
|
phony "website-render" $ do
|
|
|
|
need webhtmlpages
|
|
|
|
|
2018-04-28 06:23:14 +03:00
|
|
|
"site/_site/files/README" : [ "site/_site//*" <.> ext | ext <- webcopyfileexts ] |%> \out -> do
|
|
|
|
let input = "site" </> dropDirectory2 out
|
|
|
|
copyFile' input out
|
|
|
|
|
2018-05-06 08:18:58 +03:00
|
|
|
"site/_site//*.html" %> \out -> do
|
|
|
|
let source = "site" </> dropDirectory2 out -<.> "md"
|
|
|
|
pageTitle = takeBaseName out
|
|
|
|
template = "site/site.tmpl"
|
|
|
|
siteRoot = if "site/_site/doc//*" ?== out then "../.." else "."
|
2018-05-19 00:50:54 +03:00
|
|
|
need [source, template]
|
2018-05-06 08:18:58 +03:00
|
|
|
cmd Shell pandoc "--from markdown --to html" source
|
|
|
|
"--template" template
|
|
|
|
("--metadata=siteRoot:" ++ siteRoot)
|
|
|
|
("--metadata=title:" ++ pageTitle)
|
2018-05-19 00:50:54 +03:00
|
|
|
"--lua-filter" "tools/pandoc-site.lua"
|
2018-05-06 08:18:58 +03:00
|
|
|
"--output" out
|
|
|
|
|
2016-04-06 01:40:59 +03:00
|
|
|
-- cleanup
|
|
|
|
|
2016-02-21 13:21:41 +03:00
|
|
|
phony "clean" $ do
|
|
|
|
putNormal "Cleaning generated files"
|
2016-04-08 17:01:11 +03:00
|
|
|
removeFilesAfter "." webmanpages
|
2018-03-08 10:34:23 +03:00
|
|
|
removeFilesAfter "." [webmanall]
|
doc: experimental m4-based man page build process
The new m4manpages, m4webmanpages targets generate nroff and markdown
man pages via an alternate, excitingly complicated process, involving
shake, hakyll, pandoc *and* m4. Currently just the hledger man page is
processed this way, and the output (hledger/doc/m4-hledger.1,
site/m4-hledger.1.md) is equivalent to that of the non-m4 process.
Pro: selecting and massaging web/man content may be smoother with m4
than with pandoc filters. File inclusion allows documentation to be
broken up into chunks, which may be easier to edit, reorganize and
reuse. Macros could reduce boilerplate and enable more featureful and
attractive docs.
Con: the non-m4 process was simpler, easier to for contributors to
understand and working well enough. YAGNI.
2016-04-06 18:23:12 +03:00
|
|
|
|
|
|
|
phony "Clean" $ do
|
|
|
|
need ["clean"]
|
2018-04-28 06:23:05 +03:00
|
|
|
putNormal "Cleaning all site generated files"
|
2016-04-10 00:24:33 +03:00
|
|
|
removeFilesAfter "site" ["_*"]
|
2016-10-29 19:45:59 +03:00
|
|
|
putNormal "Cleaning object files" -- also forces rebuild of executables
|
2017-03-27 14:39:00 +03:00
|
|
|
removeFilesAfter "tools" ["*.o","*.p_o","*.hi"]
|
2016-04-10 00:24:33 +03:00
|
|
|
removeFilesAfter "site" ["*.o","*.p_o","*.hi"]
|
2016-02-21 13:21:41 +03:00
|
|
|
putNormal "Cleaning shake build files"
|
2016-04-13 06:32:01 +03:00
|
|
|
removeFilesAfter ".shake" ["//*"]
|