diff --git a/shake-ats.cabal b/shake-ats.cabal
--- a/shake-ats.cabal
+++ b/shake-ats.cabal
@@ -1,5 +1,5 @@
 name:                shake-ats
-version:             0.1.0.1
+version:             0.1.0.2
 synopsis:            Utilities for building ATS projects with shake
 description:         Various helper functions for building [ATS](http://www.ats-lang.org/) with the [shake](http://shakebuild.com/) library
 homepage:            https://github.com/vmchale/shake-ats#readme
diff --git a/src/Development/Shake/ATS.hs b/src/Development/Shake/ATS.hs
--- a/src/Development/Shake/ATS.hs
+++ b/src/Development/Shake/ATS.hs
@@ -17,6 +17,7 @@
 import           Control.Monad
 import           Control.Monad.IO.Class
 import           Data.Either                (fromRight)
+import           Data.List                  (intercalate)
 import           Data.Maybe                 (fromMaybe)
 import           Data.Semigroup             (Semigroup (..))
 import qualified Data.Text.Lazy             as TL
@@ -62,6 +63,11 @@
         liftIO $ createDirectoryIfMissing True (home ++ "/" ++ takeDirectory dep)
         liftIO $ copyFile dep (home ++ "/" ++ dep)
 
+
+patsHomeLocs :: Int -> String
+patsHomeLocs n = intercalate ":" $ (<> ".atspkg/contrib") . ("./" <>) <$> g
+    where g = [ join $ replicate i "../" | i <- [1..n] ]
+
 -- TODO musl?
 atsBin :: Version -- ^ Library version
        -> Version -- ^ Compiler version
@@ -82,12 +88,11 @@
         cmd_ ["mkdir", "-p", dropDirectory1 out]
         path <- fromMaybe "" <$> getEnv "PATH"
         let toLibs = fmap ("-l" <>)
-        -- -D_GNU_SOURCE ???
         -- -latslib
         command
-            [EchoStderr False, AddEnv "PATSHOME" home, AddEnv "PATH" (home ++ "/bin:" ++ path), AddEnv "PATSHOMELOCS" "./.atspkg/contrib"]
+            [EchoStderr False, AddEnv "PATSHOME" home, AddEnv "PATH" (home ++ "/bin:" ++ path), AddEnv "PATSHOMELOCS" $ patsHomeLocs 5]
             (home ++ "/bin/patscc")
-            ([sourceFile, "-atsccomp", "gcc -flto -I" ++ h ++ "/ccomp/runtime/ -I" ++ h ++ " -L" ++ h' ++ "/lib", gcFlag gc, "-o", out, "-cleanaft", "-O2", "-mtune=native", "-flto"] <> toLibs libs)
+            ([sourceFile, "-DGNU_SOURCE", "-atsccomp", "gcc -flto -I" ++ h ++ "/ccomp/runtime/ -I" ++ h ++ " -L" ++ h' ++ "/lib", gcFlag gc, "-o", out, "-cleanaft", "-O2", "-mtune=native", "-flto"] <> toLibs libs)
 
 -- | Build a @.lats@ file.
 atsLex :: Rules ()
@@ -129,8 +134,6 @@
       TL.unpack
     . TL.replace (TL.pack "./") (TL.pack $ p ++ "/")
     . TL.replace (TL.pack "../") (TL.pack $ joinPath (init $ splitPath p) ++ "/")
-    . TL.replace (TL.pack "$PATSHOMELOCS") (TL.pack ".atspkg/contrib")
-    . TL.replace (TL.pack "\\\n") mempty
     . TL.pack
 
 trim :: String -> String
