Skip to content

Commit efcf4e0

Browse files
Default cache location.
1 parent bedbeb0 commit efcf4e0

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

CProgramBuilder.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
-O3
33
-o
44
Release
5+
--dependency-cache
56
-s
67
-j4
78
code

code/config.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ size_t global_file_len;
2020
size_t global_file_cap;
2121
const unsigned VERSION_MAJOR=0;
2222
const unsigned VERSION_MINOR=3;
23-
const unsigned VERSION_PATCH=6;
23+
const unsigned VERSION_PATCH=7;
2424
int initialize_global_file_data(void)
2525
{
2626
int failed=1;
@@ -134,6 +134,8 @@ void help_screen(const char*program)
134134
puts("-s: Show commands being executed on the screen.");
135135
puts("--cc PROGRAM: Specifies the C compiler.");
136136
puts("--c++ PROGRAM: Specifies the C++ compiler.");
137+
puts("--dependency-cache: Stores the dependent files in CProgramBuilder.cache.");
138+
puts("--dependency-cache=FILE: Stores the dependent files in the specified file.");
137139
puts("--version: Shows the program version.");
138140
puts("--help: Shows this message.");
139141
}

code/cpbuild.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include<ctype.h>
2-
#include <stddef.h>
32
#include<stdint.h>
43
#include<stdio.h>
54
#include<stdlib.h>
@@ -114,7 +113,6 @@ int parse_cache(FILE*handle,string_hashtable*table)
114113
push_vector_char(&depends,&ch,&ch+1);
115114
if(!isdependency)
116115
{
117-
printf("inserting file %s\n",file);
118116
fail=insert_string_hashtable(table,file,depends);
119117
file=stackbuf;
120118
}
@@ -190,10 +188,8 @@ int cache_again(string_hashtable*c,const char*file,char*const*args)
190188
char*it=arr.str;
191189
char*it2=arr.str;
192190
char space=0;
193-
fwrite(arr.str,1,arr.len,stdout);
194191
for(;it!=last&&*it!=':';++it);
195192
for(++it;it!=last&&(*it=='\\'||isspace(*it));++it);
196-
printf("arr.len is %u, it has offset %zu\n",arr.len,it-arr.str);
197193
for(;it!=last;++it)
198194
{
199195
if(*it=='\\'||isspace(*it))
@@ -210,8 +206,6 @@ int cache_again(string_hashtable*c,const char*file,char*const*args)
210206
}
211207
*it2++='\n';
212208
arr.len-=last-it2;
213-
fwrite(arr.str,1,arr.len,stdout);
214-
printf("arr.len is %u\n",arr.len);
215209
char*new=strdup(file);
216210
if(new!=NULL)
217211
{
@@ -432,7 +426,6 @@ int buildfile(string_hashtable*cache,char*filename,char*outfile,const cpbuild_op
432426
char*start=arr.str;
433427
char*last=arr.str+arr.len;
434428
char*it=arr.str;
435-
fwrite(start,1,arr.len,stdout);
436429
for(;!recompile&&it!=last;++it)
437430
{
438431
next=*it=='\n';
@@ -546,6 +539,10 @@ int fill_default_options(cpbuild_options_t*opt)
546539
else
547540
memcpy(opt->compilerpp,cpb_default_option_list+3,4);
548541
}
542+
if(opt->cache!=NULL&&opt->cache[0]=='\0')
543+
{
544+
opt->cache="CProgramBuilder.cache";
545+
}
549546
opt->parallel=opt->parallel<1?1:opt->parallel;
550547
opt->objdir=opt->objdir==NULL?".":opt->objdir;
551548
return succ;

0 commit comments

Comments
 (0)