diff --git a/commands/make/README.txt b/commands/make/README.txt
index 28bea71..cf60ea2 100644
--- a/commands/make/README.txt
+++ b/commands/make/README.txt
@@ -177,6 +177,9 @@ Do not use both types of declarations for a single project in your makefile.
 
   `filename` - What to name the file, if it's not an archive. Optional.
 
+  `subtree`  - if the download is an archive, only this subtree within the
+  archive will be copied to the target destination. Optional.
+
 - `download[type] = bzr`
 
   Use a bazaar repository as the source for this project. Options:
diff --git a/commands/make/make.download.inc b/commands/make/make.download.inc
index aede588..851d6a0 100644
--- a/commands/make/make.download.inc
+++ b/commands/make/make.download.inc
@@ -69,7 +69,9 @@ function make_download_file($name, $download, $download_location, $cache_duratio
       return FALSE;
     }
     drush_log(dt('@project downloaded from @url.', array('@project' => $name, '@url' => $download['url'])), 'ok');
-    return make_download_file_unpack($filename, $download_location, (isset($download['filename']) ? $download['filename'] : ''));
+    $dl_fname = isset($download['filename']) ? $download['filename'] : '';
+    $subtree = isset($download['subtree']) ? $download['subtree'] : NULL;
+    return make_download_file_unpack($filename, $download_location, $dl_fname, $subtree);
   }
   make_error('DOWNLOAD_ERROR', dt('Unable to download @project from @url.', array('@project' => $name, '@url' => $download['url'])));
   return FALSE;
@@ -170,22 +172,22 @@ function drush_mime_content_type($filename) {
  * @return mixed
  *   The download location on success, FALSE on failure.
  */
-function make_download_file_unpack($filename, $download_location, $name) {
+function make_download_file_unpack($filename, $download_location, $name, $subtree = NULL) {
   $success = FALSE;
 
   switch (drush_mime_content_type($filename)) {
     case 'application/x-gzip':
       // I'd like to just use tar -z, but apparently it breaks on windoze. Why
       // do they always have to ruin everything?
-      $success = make_download_file_unpack_gzip($filename, $download_location);
+      $success = make_download_file_unpack_gzip($filename, $download_location, $subtree);
       break;
 
     case 'application/x-tar':
-      $success = make_download_file_unpack_tar($filename, $download_location);
+      $success = make_download_file_unpack_tar($filename, $download_location, $subtree);
       break;
 
     case 'application/zip':
-      $success = make_download_file_unpack_zip($filename, $download_location);
+      $success = make_download_file_unpack_zip($filename, $download_location, $subtree);
       break;
 
     default:
@@ -203,15 +205,15 @@ function make_download_file_unpack($filename, $download_location, $name) {
  * @return boolean
  *   TRUE or FALSE depending on whether the operation was successful.
  */
-function make_download_file_unpack_tar($filename, $download_location) {
-  $tmp_path = make_tmp();
+function make_download_file_unpack_tar($filename, $download_location, $subtree = NULL) {
+  $tmp_path = make_tmp() . '/__untar__';
 
   list($main_directory) = array_reverse(explode('/', $download_location));
 
-  drush_mkdir($tmp_path . '/__unzip__');
-  drush_shell_exec('tar -x -C %s -f %s', $tmp_path . '/__unzip__', $filename);
+  drush_mkdir($tmp_path);
+  drush_shell_exec('tar -x -C %s -f %s', $tmp_path, $filename);
 
-  return _make_download_file_move($tmp_path, $filename, $download_location);
+  return _make_download_file_move($tmp_path, $filename, $download_location, $subtree);
 }
 
 /**
@@ -220,7 +222,7 @@ function make_download_file_unpack_tar($filename, $download_location) {
  * @return boolean
  *   TRUE or FALSE depending on whether the operation was successful.
  */
-function make_download_file_unpack_gzip($filename, $download_location) {
+function make_download_file_unpack_gzip($filename, $download_location, $subtree = NULL) {
   // Find out where contents will end up. Retrieve last column of output using
   // awk.
   drush_shell_exec("gzip --list %s", $filename);
@@ -237,7 +239,7 @@ function make_download_file_unpack_gzip($filename, $download_location) {
     if (isset($file)) {
       // Unzip it and then delete the tar file.
       drush_shell_exec('gzip -d %s', $filename);
-      return make_download_file_unpack_tar($file, $download_location);
+      return make_download_file_unpack_tar($file, $download_location, $subtree);
     }
   }
 }
@@ -245,15 +247,15 @@ function make_download_file_unpack_gzip($filename, $download_location) {
 /**
  * Unpack a zip file.
  */
-function make_download_file_unpack_zip($filename, $download_location) {
-  $tmp_path = make_tmp();
+function make_download_file_unpack_zip($filename, $download_location, $subtree = NULL) {
+  $tmp_path = make_tmp() . '/__unzip__';
 
   list($main_directory) = array_reverse(explode('/', $download_location));
 
-  drush_mkdir($tmp_path . '/__unzip__');
-  drush_shell_exec("unzip %s -d %s", $filename, $tmp_path . '/__unzip__');
+  drush_mkdir($tmp_path);
+  drush_shell_exec("unzip %s -d %s", $filename, $tmp_path);
 
-  return _make_download_file_move($tmp_path, $filename, $download_location);
+  return _make_download_file_move($tmp_path, $filename, $download_location, $subtree);
 }
 
 /**
@@ -262,21 +264,21 @@ function make_download_file_unpack_zip($filename, $download_location) {
  * TODO merge with core drush methods, as the __unzip__ directory will
  * potentially cause problems when running concurrently.
  */
-function _make_download_file_move($tmp_path, $filename, $download_location) {
-  drush_shell_exec('ls %s', $tmp_path . '/__unzip__');
+function _make_download_file_move($tmp_path, $filename, $download_location, $subtree = NULL) {
+  drush_shell_exec('ls %s', $tmp_path);
   $lines = drush_shell_exec_output();
   $main_directory = basename($download_location);
   if (count($lines) == 1) {
     $directory = array_shift($lines);
     if ($directory != $main_directory) {
-      drush_shell_exec('mv %s %s', $tmp_path . '/__unzip__/' . $directory, $tmp_path . '/__unzip__/' . $main_directory);
+      drush_shell_exec('mv %s %s', $tmp_path . '/' . $directory, $tmp_path . '/' . $main_directory);
     }
-    drush_shell_exec('cp -Rf %s %s', $tmp_path . '/__unzip__/' . $main_directory, dirname($download_location));
-    drush_shell_exec('rm -rf %s', $tmp_path . '/__unzip__');
+    drush_shell_exec('cp -Rf %s %s', $tmp_path . '/' . $main_directory . '/' . $subtree, dirname($download_location));
+    drush_shell_exec('rm -rf %s', $tmp_path);
   }
   elseif (count($lines) > 1) {
     drush_shell_exec('rm -rf %s', $download_location);
-    drush_shell_exec('mv %s %s', $tmp_path . '/__unzip__', $download_location);
+    drush_shell_exec('mv %s %s', $tmp_path . '/' . $subtree, $download_location);
   }
 
   // Remove the tarball.
@@ -284,8 +286,8 @@ function _make_download_file_move($tmp_path, $filename, $download_location) {
     drush_shell_exec('rm %s', $filename);
   }
 
-  if (file_exists($tmp_path . '/__unzip__')) {
-    drush_shell_exec('rm -rf %s', $tmp_path . '/__unzip__');
+  if (file_exists($tmp_path)) {
+    drush_shell_exec('rm -rf %s', $tmp_path);
   }
   return TRUE;
 }
diff --git a/tests/makeTest.php b/tests/makeTest.php
index c3510a8..5032411 100644
--- a/tests/makeTest.php
+++ b/tests/makeTest.php
@@ -167,6 +167,10 @@ class makeMakefileCase extends Drush_CommandTestCase {
     $this->runMakefileTest('file');
   }
 
+  function testMakeSubtree() {
+    $this->runMakefileTest('subtree');
+  }
+
   function testMakeMd5Succeed() {
     $this->runMakefileTest('md5-succeed');
   }
@@ -313,6 +317,13 @@ class makeMakefileCase extends Drush_CommandTestCase {
         'md5' => 'c7cab3930f644961a576d78769498172',
         'options'  => array('no-core' => NULL),
       ),
+      'subtree' => array(
+        'name'     => 'Use subtree from downloaded archive',
+        'makefile' => 'subtree.make',
+        'build'    => TRUE,
+        'md5' => '840ece0ec28834182054c49c4b7a204a',
+        'options'  => array('no-core' => NULL),
+      ),
       'md5-succeed' => array(
         'name'     => 'MD5 validation',
         'makefile' => 'md5-succeed.make',
diff --git a/tests/makefiles/subtree.make b/tests/makefiles/subtree.make
new file mode 100644
index 0000000..d7b71f4
--- /dev/null
+++ b/tests/makefiles/subtree.make
@@ -0,0 +1,7 @@
+core = 6.x
+api = 2
+
+libraries[nivo-slider][download][type] = get
+libraries[nivo-slider][download][url] = https://github.com/downloads/gilbitron/Nivo-Slider/nivo-slider2.7.1.zip
+libraries[nivo-slider][download][sha1] = bd8e14b82f5b9c6f533a4e1aa26a790cd66c3cb9
+libraries[nivo-slider][download][subtree] = nivo-slider
