/* should we use the direct mode? */
static int enable_direct = 1;
+/* number of levels (1 <= nlevels <= 8) */
+static int nlevels = 2;
+
/* a list of supported file extensions, and the equivalent
extension for code that has been through the pre-processor
*/
* Transform a name to a full path into the cache directory, creating needed
* sublevels if needed. Caller frees.
*/
-static char *get_path_in_cache(const char *name, const char *suffix,
- int nlevels)
+static char *get_path_in_cache(const char *name, const char *suffix)
{
int i;
char *path;
static int find_hash(ARGS *args, enum findhash_call_mode mode)
{
int i;
- char *s;
struct stat st;
- int nlevels = 2;
struct mdfour hash;
char *object_name;
char *manifest_name;
break;
}
- if ((s = getenv("CCACHE_NLEVELS"))) {
- nlevels = atoi(s);
- if (nlevels < 1) nlevels = 1;
- if (nlevels > 8) nlevels = 8;
- }
-
hash_start(&hash);
hash_buffer(&hash, HASH_PREFIX, sizeof(HASH_PREFIX));
failed();
}
manifest_name = hash_result(&hash);
- manifest_path = get_path_in_cache(manifest_name, ".manifest",
- nlevels);
+ manifest_path = get_path_in_cache(manifest_name, ".manifest");
free(manifest_name);
cc_log("Looking for object file hash in %s",
manifest_path);
}
object_name = format_file_hash(object_hash);
- cached_obj = get_path_in_cache(object_name, ".o", nlevels);
- cached_stderr = get_path_in_cache(object_name, ".stderr", nlevels);
- cached_dep = get_path_in_cache(object_name, ".d", nlevels);
+ cached_obj = get_path_in_cache(object_name, ".o");
+ cached_stderr = get_path_in_cache(object_name, ".stderr");
+ cached_dep = get_path_in_cache(object_name, ".d");
x_asprintf(&stats_file, "%s/%c/stats", cache_dir, object_name[0]);
free(object_name);
struct tm *tm;
int put_object_in_manifest = 0;
struct file_hash *object_hash_from_manifest = NULL;
+ char *s;
t = time(NULL);
tm = localtime(&t);
enable_direct = 0;
}
+ if ((s = getenv("CCACHE_NLEVELS"))) {
+ nlevels = atoi(s);
+ if (nlevels < 1) nlevels = 1;
+ if (nlevels > 8) nlevels = 8;
+ }
+
/* process argument list, returning a new set of arguments for
pre-processing */
process_args(orig_args->argc, orig_args->argv);