]> git.sur5r.net Git - cc65/commitdiff
Added search paths similar to that of the linker and compiler.
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 24 Sep 2009 14:49:52 +0000 (14:49 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 24 Sep 2009 14:49:52 +0000 (14:49 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@4217 b7a2c559-68d2-44c3-8de9-860c34a00d81

doc/ca65.sgml
src/ca65/incpath.c
src/ca65/incpath.h
src/ca65/main.c
src/ca65/make/gcc.mak

index eb09a2735299deac03e6b0fa048a287583158cfa..0aa1b33cc7e1f9f095f78a387f1b809a9c47e9dc 100644 (file)
@@ -267,7 +267,8 @@ Here is a description of all the command line options:
   Name a directory which is searched for include files. The option may be
   used more than once to specify more than one directory to search. The
   current directory is always searched first before considering any
-  additional directories.
+  additional directories. See also the section about <ref id="search-paths"
+  name="search paths">.
 
 
   <tag><tt>-U, --auto-import</tt></tag>
@@ -299,6 +300,21 @@ Here is a description of all the command line options:
 <p>
 
 
+
+<sect>Search paths<label id="search-paths"><p>
+
+Include files are searched in the following places:
+
+<enum>
+<item>The current directory.
+<item>The value of the environment variable <tt/CA65_INC/ if it is defined.
+<item>A subdirectory named <tt/asminc/ of the directory defined in the
+      environment variable <tt/CC65_HOME/, if it is defined.
+<item>Any directory added with the <tt/-I/ option on the command line.
+</enum>
+
+
+
 <sect>Input format<p>
 
 <sect1>Assembler syntax<p>
index 2abd99f6203c57e7d3c360cc9053141fedd8b81f..124e4b20be6849c8a6af397ff9ca34a66d095c6b 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000-2003 Ullrich von Bassewitz                                       */
-/*               Römerstrasse 52                                             */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 2000-2009, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -76,3 +76,23 @@ char* FindInclude (const char* Name)
 
 
 
+void InitIncludePaths (void)
+/* Initialize the include path search list */
+{
+    /* Add some standard paths to the include search path */
+    AddSearchPath ("", INC_STD);               /* Current directory */
+
+    /* Add some compiled in search paths if defined at compile time */
+#ifdef CA65_INC
+    AddSearchPath (CA65_INC, INC_STD);
+#endif
+
+    /* Add specific paths from the environment */
+    AddSearchPathFromEnv ("CA65_INC", INC_STD);
+
+    /* Add paths relative to a main directory defined in an env var */
+    AddSubSearchPathFromEnv ("CC65_HOME", "asminc", INC_STD);
+}
+
+
+
index a2b71e55333fb41a8fb0ccd9d00b87aca6816a6b..41891c9b856aedfe7cb604d037190562d6ccc52d 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000-2003 Ullrich von Bassewitz                                       */
-/*               Römerstrasse 52                                             */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 2000-2009, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -52,6 +52,9 @@ char* FindInclude (const char* Name);
  * the complete path, if found, return 0 otherwise.
  */
 
+void InitIncludePaths (void);
+/* Initialize the include path search list */
+
 
 
 /* End of incpath.h */
index 4b801c6ef074c24383cf4b297e4001ee77f11b03..faec11ecf8a35ad4efcd4a396b5c48dcc87c39c2 100644 (file)
@@ -796,6 +796,9 @@ int main (int argc, char* argv [])
     /* Initialize the cmdline module */
     InitCmdLine (&argc, &argv, "ca65");
 
+    /* Initialize the include search paths */
+    InitIncludePaths ();
+
     /* Enter the base lexical level. We must do that here, since we may
      * define symbols using -D.
      */
index 6030e9de30877b910a4d1c719dc7bf9d46445767..9a8ea79ba8bec1999866bbcb22751364e59de930 100644 (file)
@@ -10,7 +10,12 @@ EXE          = ca65
 # Library dir
 COMMON = ../common
 
-CFLAGS         = -g -O2 -Wall -W -std=c89 -I$(COMMON)
+# Several search paths. You may redefine these on the command line
+CA65_INC = \"/usr/lib/cc65/asminc/\"
+
+CFLAGS         = -g -O2 -Wall -W -std=c89
+CFLAGS += -I$(COMMON)
+CFLAGS += -DCA65_INC=$(CA65_INC)
 CC     = gcc
 EBIND  = emxbind
 LDFLAGS        =