/* */
/* */
/* */
-/* (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 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 a standard path for the libraries and objects */
- AddSearchPath (CC65_LIB, SEARCH_LIB | SEARCH_OBJ);
+ /* Add specific paths from the environment */
+ AddSearchPathFromEnv (LibSearchPath, "LD65_LIB");
+ AddSearchPathFromEnv (ObjSearchPath, "LD65_OBJ");
+ AddSearchPathFromEnv (CfgSearchPath, "LD65_CFG");
- /* Add paths from the environment */
- AddSearchPathFromEnv ("LD65_LIB", SEARCH_LIB);
- AddSearchPathFromEnv ("LD65_OBJ", SEARCH_OBJ);
- AddSearchPathFromEnv ("LD65_CFG", SEARCH_CFG);
+ /* 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");
}