]> git.sur5r.net Git - cc65/blobdiff - src/ld65/filepath.c
Removed unneeded include files.
[cc65] / src / ld65 / filepath.c
index 8db7357444c4e7b422ce5ab17df669e49faff1d6..aa7d547e275f50f441e2020ff40acbe5f088a3af 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2003      Ullrich von Bassewitz                                       */
-/*               Römerstrasse 52                                             */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 2003-2010, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
 
 
 
-/* common */
-#include "searchpath.h"
-
 /* ld65 */
 #include "filepath.h"
 
 
 
 /*****************************************************************************/
-/*                                  Data                                    */
+/*                                  Data                                    */
 /*****************************************************************************/
 
 
 
-/* If the standard library search path is not given, use a hardcoded one */
-#ifndef CC65_LIB
-#define CC65_LIB        "/usr/lib/cc65/lib/"
-#endif
+SearchPath*      LibSearchPath;         /* Library path */
+SearchPath*      ObjSearchPath;         /* Object file path */
+SearchPath*      CfgSearchPath;         /* Config file path */
 
 
 
 /*****************************************************************************/
-/*                                  Code                                    */
+/*                                  Code                                    */
 /*****************************************************************************/
 
 
 void InitSearchPaths (void)
 /* Initialize the path search list */
 {
+    /* Create the search path lists */
+    LibSearchPath = NewSearchPath ();
+    ObjSearchPath = NewSearchPath ();
+    CfgSearchPath = NewSearchPath ();
+
     /* Always search all stuff in the current directory */
-    AddSearchPath ("", SEARCH_LIB | SEARCH_OBJ | SEARCH_CFG);
+    AddSearchPath (LibSearchPath, "");
+    AddSearchPath (ObjSearchPath, "");
+    AddSearchPath (CfgSearchPath, "");
 
-    /* Add a standard path for the libraries and objects */
-    AddSearchPath (CC65_LIB, SEARCH_LIB | SEARCH_OBJ);
+    /* Add some compiled in search paths if defined at compile time */
+#if defined(LD65_LIB)
+    AddSearchPath (LibSearchPath, LD65_LIB);
+#endif
+#if defined(LD65_OBJ)
+    AddSearchPath (ObjSearchPath, LD65_OBJ);
+#endif
+#if defined(LD65_CFG)
+    AddSearchPath (CfgSearchPath, LD65_CFG);
+#endif
 
-    /* Add paths from the environment */
-    AddSearchPathFromEnv ("LD65_LIB", SEARCH_LIB);
-    AddSearchPathFromEnv ("LD65_OBJ", SEARCH_OBJ);
-    AddSearchPathFromEnv ("LD65_CFG", SEARCH_CFG);
+    /* Add specific paths from the environment */
+    AddSearchPathFromEnv (LibSearchPath, "LD65_LIB");
+    AddSearchPathFromEnv (ObjSearchPath, "LD65_OBJ");
+    AddSearchPathFromEnv (CfgSearchPath, "LD65_CFG");
 
-    /* Add compatibility stuff */
-    AddSearchPathFromEnv ("CC65_LIB", SEARCH_LIB | SEARCH_OBJ);
+    /* Add paths relative to a main directory defined in an env var */
+    AddSubSearchPathFromEnv (LibSearchPath, "CC65_HOME", "lib");
+    AddSubSearchPathFromEnv (ObjSearchPath, "CC65_HOME", "obj");
+    AddSubSearchPathFromEnv (CfgSearchPath, "CC65_HOME", "cfg");
 }