Finish Generate rule.
authorAndrey Mokhov <andrey.mokhov@gmail.com>
Mon, 21 Sep 2015 00:03:02 +0000 (01:03 +0100)
committerAndrey Mokhov <andrey.mokhov@gmail.com>
Mon, 21 Sep 2015 00:03:02 +0000 (01:03 +0100)
src/Rules/Generate.hs

index 055dccb..535f99b 100644 (file)
@@ -23,33 +23,15 @@ generatePackageCode _ target @ (PartialTarget stage package) =
     let path        = targetPath stage package
         packagePath = pkgPath package
         buildPath   = path -/- "build"
-    in do
+    in do -- TODO: do we need to copy *.(l)hs-boot files here? Never happens?
         buildPath </> "*.hs" %> \file -> do
             dirs  <- interpretPartial target $ getPkgDataList SrcDirs
             files <- getDirectoryFiles "" $
                 [ packagePath </> d </> takeBaseName file <.> "*" | d <- dirs ]
             let gens = [ (f, b) | f <- files, Just b <- [determineBuilder f] ]
-                (src, builder) = head gens
             when (length gens /= 1) . putError $
                 "Exactly one generator expected for " ++ file
                 ++ "(found: " ++ show gens ++ ")."
+            let (src, builder) = head gens
             need [src]
             build $ fullTarget target builder [src] [file]
-
--- $1/$2/build/%.hs : $1/$3/%.ly | $$$$(dir $$$$@)/.
---     $$(call cmd,HAPPY) $$($1_$2_ALL_HAPPY_OPTS) $$< -o $$@
-
--- $1/$2/build/%.hs : $1/$3/%.y | $$$$(dir $$$$@)/.
---     $$(call cmd,HAPPY) $$($1_$2_ALL_HAPPY_OPTS) $$< -o $$@
-
--- $1/$2/build/%_hsc.c $1/$2/build/%_hsc.h $1/$2/build/%.hs : $1/$3/%.hsc $$$$(hsc2hs_INPLACE) | $$$$(dir $$$$@)/.
---     $$(call cmd,hsc2hs_INPLACE) $$($1_$2_ALL_HSC2HS_OPTS) $$< -o $$@
-
--- # Now the rules for hs-boot files.
-
--- $1/$2/build/%.hs-boot : $1/$3/%.hs-boot
---     "$$(CP)" $$< $$@
-
--- $1/$2/build/%.lhs-boot : $1/$3/%.lhs-boot
---     "$$(CP)" $$< $$@
-