diff --git a/commands/make/generate.make.inc b/commands/make/generate.make.inc
index 68311eb..13020bc 100644
--- a/commands/make/generate.make.inc
+++ b/commands/make/generate.make.inc
@@ -139,12 +139,13 @@ function _drush_make_generate_projects($all_extensions, $version_options) {
     $libraries = libraries_get_libraries();
     foreach ($libraries as $library_name => $library_path) {
       $path = explode('/', $library_path);
-      $project_libraries[$library_name] = array(
+      $project_library = array(
         'directory_name' => $path[(count($path) - 1)],
-        'custom_download' => TRUE,
         'type' => 'library',
         '_type' => 'librarie', // For plural.
       );
+      $library_name = _drush_generate_get_download_settings($project_library, $library_path, $version_options);
+      $project_libraries[$library_name] = $project_library;
     }
   }
   return array($projects, $project_libraries);
@@ -172,17 +173,38 @@ function _drush_generate_custom_project($name, $extension, $version_options) {
   $project['_type'] = $extension->type;
   $project['type'] = $extension->type;
   $info_file = $extension->filename;
-  $location = DRUPAL_ROOT . '/' . dirname($info_file);
+  $project_name = _drush_generate_get_download_settings($project, DRUPAL_ROOT . '/' . dirname($info_file), $version_options);
+  return array($project_name, $project);
+}
+
+/**
+ * Try to detect he appropriate download configuration for a project / library.
+ *
+ * Extends the $project parameter with the download settings and returns the
+ * appropriate project name.
+ *
+ * @param array $project
+ *   The configuration array of the project / library as reference.
+ * @param string $path
+ *   The file path to the project / library.
+ * @param array $version_options
+ *   The version options array.
+ *
+ * @return string
+ *   The appropriate project name.
+ *
+ */
+function _drush_generate_get_download_settings(&$project, $path, $version_options) {
   // To start off, we will presume that our custom extension is
   // stored in a folder named after its project, and there are
   // no subfolders between the .info file and the project root.
-  $project_name = basename($location);
-  drush_shell_cd_and_exec($location, 'git rev-parse --git-dir 2> ' . drush_bit_bucket());
+  $project_name = basename($path);
+  drush_shell_cd_and_exec($path, 'git rev-parse --git-dir 2> ' . drush_bit_bucket());
   $output = drush_shell_exec_output();
   if (!empty($output)) {
     $git_dir = $output[0];
     // Find the actual base of the git repository.
-    $repo_root = $git_dir == ".git" ? $location : dirname($git_dir);
+    $repo_root = $git_dir == ".git" ? $path : dirname($git_dir);
     // If the repository root is at the drupal root or some parent
     // of the drupal root, or some other location that could not
     // pausibly be a project, then there is nothing we can do.
@@ -237,7 +259,7 @@ function _drush_generate_custom_project($name, $extension, $version_options) {
   if (!isset($project['download][type'])) {
     $project['custom_download'] = TRUE;
   }
-  return array($project_name, $project);
+  return $project_name;
 }
 
 /**
