| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
#include "make.h" |
|---|
| 20 |
|
|---|
| 21 |
#include <assert.h> |
|---|
| 22 |
|
|---|
| 23 |
#include "dep.h" |
|---|
| 24 |
#include "filedef.h" |
|---|
| 25 |
#include "job.h" |
|---|
| 26 |
#include "commands.h" |
|---|
| 27 |
#include "variable.h" |
|---|
| 28 |
#include "debug.h" |
|---|
| 29 |
#include "hash.h" |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
int snapped_deps = 0; |
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
static unsigned long |
|---|
| 44 |
file_hash_1 (const void *key) |
|---|
| 45 |
{ |
|---|
| 46 |
return_ISTRING_HASH_1 (((struct file const *) key)->hname); |
|---|
| 47 |
} |
|---|
| 48 |
|
|---|
| 49 |
static unsigned long |
|---|
| 50 |
file_hash_2 (const void *key) |
|---|
| 51 |
{ |
|---|
| 52 |
return_ISTRING_HASH_2 (((struct file const *) key)->hname); |
|---|
| 53 |
} |
|---|
| 54 |
|
|---|
| 55 |
static int |
|---|
| 56 |
file_hash_cmp (const void *x, const void *y) |
|---|
| 57 |
{ |
|---|
| 58 |
return_ISTRING_COMPARE (((struct file const *) x)->hname, |
|---|
| 59 |
((struct file const *) y)->hname); |
|---|
| 60 |
} |
|---|
| 61 |
|
|---|
| 62 |
#ifndef FILE_BUCKETS |
|---|
| 63 |
#define FILE_BUCKETS 1007 |
|---|
| 64 |
#endif |
|---|
| 65 |
static struct hash_table files; |
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
static int all_secondary = 0; |
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
struct file * |
|---|
| 76 |
lookup_file (char *name) |
|---|
| 77 |
{ |
|---|
| 78 |
register struct file *f; |
|---|
| 79 |
struct file file_key; |
|---|
| 80 |
#if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS) |
|---|
| 81 |
register char *lname, *ln; |
|---|
| 82 |
#endif |
|---|
| 83 |
|
|---|
| 84 |
assert (*name != '\0'); |
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
#ifdef VMS |
|---|
| 90 |
# ifndef WANT_CASE_SENSITIVE_TARGETS |
|---|
| 91 |
if (*name != '.') |
|---|
| 92 |
{ |
|---|
| 93 |
register char *n; |
|---|
| 94 |
lname = (char *) malloc (strlen (name) + 1); |
|---|
| 95 |
for (n = name, ln = lname; *n != '\0'; ++n, ++ln) |
|---|
| 96 |
*ln = isupper ((unsigned char)*n) ? tolower ((unsigned char)*n) : *n; |
|---|
| 97 |
*ln = '\0'; |
|---|
| 98 |
name = lname; |
|---|
| 99 |
} |
|---|
| 100 |
# endif |
|---|
| 101 |
|
|---|
| 102 |
while (name[0] == '[' && name[1] == ']' && name[2] != '\0') |
|---|
| 103 |
name += 2; |
|---|
| 104 |
#endif |
|---|
| 105 |
while (name[0] == '.' && name[1] == '/' && name[2] != '\0') |
|---|
| 106 |
{ |
|---|
| 107 |
name += 2; |
|---|
| 108 |
while (*name == '/') |
|---|
| 109 |
|
|---|
| 110 |
++name; |
|---|
| 111 |
} |
|---|
| 112 |
|
|---|
| 113 |
if (*name == '\0') |
|---|
| 114 |
|
|---|
| 115 |
#ifdef VMS |
|---|
| 116 |
name = "[]"; |
|---|
| 117 |
#else |
|---|
| 118 |
#ifdef _AMIGA |
|---|
| 119 |
name = ""; |
|---|
| 120 |
#else |
|---|
| 121 |
name = "./"; |
|---|
| 122 |
#endif |
|---|
| 123 |
#endif |
|---|
| 124 |
|
|---|
| 125 |
file_key.hname = name; |
|---|
| 126 |
f = (struct file *) hash_find_item (&files, &file_key); |
|---|
| 127 |
#if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS) |
|---|
| 128 |
if (*name != '.') |
|---|
| 129 |
free (lname); |
|---|
| 130 |
#endif |
|---|
| 131 |
return f; |
|---|
| 132 |
} |
|---|
| 133 |
|
|---|
| 134 |
struct file * |
|---|
| 135 |
enter_file (char *name) |
|---|
| 136 |
{ |
|---|
| 137 |
register struct file *f; |
|---|
| 138 |
register struct file *new; |
|---|
| 139 |
register struct file **file_slot; |
|---|
| 140 |
struct file file_key; |
|---|
| 141 |
#if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS) |
|---|
| 142 |
char *lname, *ln; |
|---|
| 143 |
#endif |
|---|
| 144 |
|
|---|
| 145 |
assert (*name != '\0'); |
|---|
| 146 |
|
|---|
| 147 |
#if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS) |
|---|
| 148 |
if (*name != '.') |
|---|
| 149 |
{ |
|---|
| 150 |
register char *n; |
|---|
| 151 |
lname = (char *) malloc (strlen (name) + 1); |
|---|
| 152 |
for (n = name, ln = lname; *n != '\0'; ++n, ++ln) |
|---|
| 153 |
{ |
|---|
| 154 |
if (isupper ((unsigned char)*n)) |
|---|
| 155 |
*ln = tolower ((unsigned char)*n); |
|---|
| 156 |
else |
|---|
| 157 |
*ln = *n; |
|---|
| 158 |
} |
|---|
| 159 |
|
|---|
| 160 |
*ln = 0; |
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
name = lname; |
|---|
| 164 |
} |
|---|
| 165 |
#endif |
|---|
| 166 |
|
|---|
| 167 |
file_key.hname = name; |
|---|
| 168 |
file_slot = (struct file **) hash_find_slot (&files, &file_key); |
|---|
| 169 |
f = *file_slot; |
|---|
| 170 |
if (! HASH_VACANT (f) && !f->double_colon) |
|---|
| 171 |
{ |
|---|
| 172 |
#if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS) |
|---|
| 173 |
if (*name != '.') |
|---|
| 174 |
free (lname); |
|---|
| 175 |
#endif |
|---|
| 176 |
return f; |
|---|
| 177 |
} |
|---|
| 178 |
|
|---|
| 179 |
new = (struct file *) xmalloc (sizeof (struct file)); |
|---|
| 180 |
bzero ((char *) new, sizeof (struct file)); |
|---|
| 181 |
new->name = new->hname = name; |
|---|
| 182 |
new->update_status = -1; |
|---|
| 183 |
|
|---|
| 184 |
if (HASH_VACANT (f)) |
|---|
| 185 |
{ |
|---|
| 186 |
new->last = new; |
|---|
| 187 |
hash_insert_at (&files, new, file_slot); |
|---|
| 188 |
} |
|---|
| 189 |
else |
|---|
| 190 |
{ |
|---|
| 191 |
|
|---|
| 192 |
new->double_colon = f; |
|---|
| 193 |
f->last->prev = new; |
|---|
| 194 |
f->last = new; |
|---|
| 195 |
} |
|---|
| 196 |
|
|---|
| 197 |
return new; |
|---|
| 198 |
} |
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 |
void |
|---|
| 205 |
rename_file (struct file *from_file, char *to_hname) |
|---|
| 206 |
{ |
|---|
| 207 |
rehash_file (from_file, to_hname); |
|---|
| 208 |
while (from_file) |
|---|
| 209 |
{ |
|---|
| 210 |
from_file->name = from_file->hname; |
|---|
| 211 |
from_file = from_file->prev; |
|---|
| 212 |
} |
|---|
| 213 |
} |
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 |
void |
|---|
| 220 |
rehash_file (struct file *from_file, char *to_hname) |
|---|
| 221 |
{ |
|---|
| 222 |
struct file file_key; |
|---|
| 223 |
struct file **file_slot; |
|---|
| 224 |
struct file *to_file; |
|---|
| 225 |
struct file *deleted_file; |
|---|
| 226 |
struct file *f; |
|---|
| 227 |
|
|---|
| 228 |
file_key.hname = to_hname; |
|---|
| 229 |
if (0 == file_hash_cmp (from_file, &file_key)) |
|---|
| 230 |
return; |
|---|
| 231 |
|
|---|
| 232 |
file_key.hname = from_file->hname; |
|---|
| 233 |
while (from_file->renamed != 0) |
|---|
| 234 |
from_file = from_file->renamed; |
|---|
| 235 |
if (file_hash_cmp (from_file, &file_key)) |
|---|
| 236 |
|
|---|
| 237 |
abort (); |
|---|
| 238 |
|
|---|
| 239 |
deleted_file = hash_delete (&files, from_file); |
|---|
| 240 |
if (deleted_file != from_file) |
|---|
| 241 |
|
|---|
| 242 |
abort (); |
|---|
| 243 |
|
|---|
| 244 |
file_key.hname = to_hname; |
|---|
| 245 |
file_slot = (struct file **) hash_find_slot (&files, &file_key); |
|---|
| 246 |
to_file = *file_slot; |
|---|
| 247 |
|
|---|
| 248 |
from_file->hname = to_hname; |
|---|
| 249 |
for (f = from_file->double_colon; f != 0; f = f->prev) |
|---|
| 250 |
f->hname = to_hname; |
|---|
| 251 |
|
|---|
| 252 |
if (HASH_VACANT (to_file)) |
|---|
| 253 |
hash_insert_at (&files, from_file, file_slot); |
|---|
| 254 |
else |
|---|
| 255 |
{ |
|---|
| 256 |
|
|---|
| 257 |
|
|---|
| 258 |
|
|---|
| 259 |
if (from_file->cmds != 0) |
|---|
| 260 |
{ |
|---|
| 261 |
if (to_file->cmds == 0) |
|---|
| 262 |
to_file->cmds = from_file->cmds; |
|---|
| 263 |
else if (from_file->cmds != to_file->cmds) |
|---|
| 264 |
{ |
|---|
| 265 |
|
|---|
| 266 |
|
|---|
| 267 |
|
|---|
| 268 |
if (to_file->cmds->fileinfo.filenm != 0) |
|---|
| 269 |
error (&from_file->cmds->fileinfo, |
|---|
| 270 |
_("Commands were specified for file `%s' at %s:%lu,"), |
|---|
| 271 |
from_file->name, to_file->cmds->fileinfo.filenm, |
|---|
| 272 |
to_file->cmds->fileinfo.lineno); |
|---|
| 273 |
else |
|---|
| 274 |
error (&from_file->cmds->fileinfo, |
|---|
| 275 |
_("Commands for file `%s' were found by implicit rule search,"), |
|---|
| 276 |
from_file->name); |
|---|
| 277 |
error (&from_file->cmds->fileinfo, |
|---|
| 278 |
_("but `%s' is now considered the same file as `%s'."), |
|---|
| 279 |
from_file->name, to_hname); |
|---|
| 280 |
error (&from_file->cmds->fileinfo, |
|---|
| 281 |
_("Commands for `%s' will be ignored in favor of those for `%s'."), |
|---|
| 282 |
to_hname, from_file->name); |
|---|
| 283 |
} |
|---|
| 284 |
} |
|---|
| 285 |
|
|---|
| 286 |
|
|---|
| 287 |
|
|---|
| 288 |
if (to_file->deps == 0) |
|---|
| 289 |
to_file->deps = from_file->deps; |
|---|
| 290 |
else |
|---|
| 291 |
{ |
|---|
| 292 |
register struct dep *deps = to_file->deps; |
|---|
| 293 |
while (deps->next != 0) |
|---|
| 294 |
deps = deps->next; |
|---|
| 295 |
deps->next = from_file->deps; |
|---|
| 296 |
} |
|---|
| 297 |
|
|---|
| 298 |
merge_variable_set_lists (&to_file->variables, from_file->variables); |
|---|
| 299 |
|
|---|
| 300 |
if (to_file->double_colon && from_file->is_target && !from_file->double_colon) |
|---|
| 301 |
fatal (NILF, _("can't rename single-colon `%s' to double-colon `%s'"), |
|---|
| 302 |
from_file->name, to_hname); |
|---|
| 303 |
if (!to_file->double_colon && from_file->double_colon) |
|---|
| 304 |
{ |
|---|
| 305 |
if (to_file->is_target) |
|---|
| 306 |
fatal (NILF, _("can't rename double-colon `%s' to single-colon `%s'"), |
|---|
| 307 |
from_file->name, to_hname); |
|---|
| 308 |
else |
|---|
| 309 |
to_file->double_colon = from_file->double_colon; |
|---|
| 310 |
} |
|---|
| 311 |
|
|---|
| 312 |
if (from_file->last_mtime > to_file->last_mtime) |
|---|
| 313 |
|
|---|
| 314 |
to_file->last_mtime = from_file->last_mtime; |
|---|
| 315 |
|
|---|
| 316 |
to_file->mtime_before_update = from_file->mtime_before_update; |
|---|
| 317 |
|
|---|
| 318 |
#define MERGE(field) to_file->field |= from_file->field |
|---|
| 319 |
MERGE (precious); |
|---|
| 320 |
MERGE (tried_implicit); |
|---|
| 321 |
MERGE (updating); |
|---|
| 322 |
MERGE (updated); |
|---|
| 323 |
MERGE (is_target); |
|---|
| 324 |
MERGE (cmd_target); |
|---|
| 325 |
MERGE (phony); |
|---|
| 326 |
MERGE (ignore_vpath); |
|---|
| 327 |
#undef MERGE |
|---|
| 328 |
|
|---|
| 329 |
from_file->renamed = to_file; |
|---|
| 330 |
} |
|---|
| 331 |
} |
|---|
| 332 |
|
|---|
| 333 |
|
|---|
| 334 |
|
|---|
| 335 |
|
|---|
| 336 |
|
|---|
| 337 |
|
|---|
| 338 |
void |
|---|
| 339 |
remove_intermediates (int sig) |
|---|
| 340 |
{ |
|---|
| 341 |
register struct file **file_slot; |
|---|
| 342 |
register struct file **file_end; |
|---|
| 343 |
int doneany = 0; |
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 |
if (question_flag || touch_flag || all_secondary) |
|---|
| 347 |
return; |
|---|
| 348 |
|
|---|
| 349 |
if (sig && just_print_flag) |
|---|
| 350 |
return; |
|---|
| 351 |
|
|---|
| 352 |
file_slot = (struct file **) files.ht_vec; |
|---|
| 353 |
file_end = file_slot + files.ht_size; |
|---|
| 354 |
for ( ; file_slot < file_end; file_slot++) |
|---|
| 355 |
if (! HASH_VACANT (*file_slot)) |
|---|
| 356 |
{ |
|---|
| 357 |
register struct file *f = *file_slot; |
|---|
| 358 |
|
|---|
| 359 |
|
|---|
| 360 |
|
|---|
| 361 |
|
|---|
| 362 |
if (f->intermediate && (f->dontcare || !f->precious) |
|---|
| 363 |
&& !f->secondary && !f->cmd_target) |
|---|
| 364 |
{ |
|---|
| 365 |
int status; |
|---|
| 366 |
if (f->update_status == -1) |
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 |
continue; |
|---|
| 370 |
if (just_print_flag) |
|---|
| 371 |
status = 0; |
|---|
| 372 |
else |
|---|
| 373 |
{ |
|---|
| 374 |
status = unlink (f->name); |
|---|
| 375 |
if (status < 0 && errno == ENOENT) |
|---|
| 376 |
continue; |
|---|
| 377 |
} |
|---|
| 378 |
if (!f->dontcare) |
|---|
| 379 |
{ |
|---|
| 380 |
if (sig) |
|---|
| 381 |
error (NILF, _("*** Deleting intermediate file `%s'"), f->name); |
|---|
| 382 |
else |
|---|
| 383 |
{ |
|---|
| 384 |
if (! doneany) |
|---|
| 385 |
DB (DB_BASIC, (_("Removing intermediate files...\n"))); |
|---|
| 386 |
if (!silent_flag) |
|---|
| 387 |
{ |
|---|
| 388 |
if (! doneany) |
|---|
| 389 |
{ |
|---|
| 390 |
fputs ("rm ", stdout); |
|---|
| 391 |
doneany = 1; |
|---|
| 392 |
} |
|---|
| 393 |
else |
|---|
| 394 |
putchar (' '); |
|---|
| 395 |
fputs (f->name, stdout); |
|---|
| 396 |
fflush (stdout); |
|---|
| 397 |
} |
|---|
| 398 |
} |
|---|
| 399 |
if (status < 0) |
|---|
| 400 |
perror_with_name ("unlink: ", f->name); |
|---|
| 401 |
} |
|---|
| 402 |
} |
|---|
| 403 |
} |
|---|
| 404 |
|
|---|
| 405 |
if (doneany && !sig) |
|---|
| 406 |
{ |
|---|
| 407 |
putchar ('\n'); |
|---|
| 408 |
fflush (stdout); |
|---|
| 409 |
} |
|---|
| 410 |
} |
|---|
| 411 |
|
|---|
| 412 |
struct dep * |
|---|
| 413 |
parse_prereqs (char *p) |
|---|
| 414 |
{ |
|---|
| 415 |
struct dep *new = (struct dep *) |
|---|
| 416 |
multi_glob (parse_file_seq (&p, '|', sizeof (struct dep), 1), |
|---|
| 417 |
sizeof (struct dep)); |
|---|
| 418 |
|
|---|
| 419 |
if (*p) |
|---|
| 420 |
{ |
|---|
| 421 |
|
|---|
| 422 |
|
|---|
| 423 |
struct dep *ood; |
|---|
| 424 |
|
|---|
| 425 |
++p; |
|---|
| 426 |
ood = (struct dep *) |
|---|
| 427 |
multi_glob (parse_file_seq (&p, '\0', sizeof (struct dep), 1), |
|---|
| 428 |
sizeof (struct dep)); |
|---|
| 429 |
|
|---|
| 430 |
if (! new) |
|---|
| 431 |
new = ood; |
|---|
| 432 |
else |
|---|
| 433 |
{ |
|---|
| 434 |
struct dep *dp; |
|---|
| 435 |
for (dp = new; dp->next != NULL; dp = dp->next) |
|---|
| 436 |
; |
|---|
| 437 |
dp->next = ood; |
|---|
| 438 |
} |
|---|
| 439 |
|
|---|
| 440 |
for (; ood != NULL; ood = ood->next) |
|---|
| 441 |
ood->ignore_mtime = 1; |
|---|
| 442 |
} |
|---|
| 443 |
|
|---|
| 444 |
return new; |
|---|
| 445 |
} |
|---|
| 446 |
|
|---|
| 447 |
|
|---|
| 448 |
|
|---|
| 449 |
|
|---|
| 450 |
static void |
|---|
| 451 |
set_intermediate (const void *item) |
|---|
| 452 |
{ |
|---|
| 453 |
struct file *f = (struct file *) item; |
|---|
| 454 |
f->intermediate = 1; |
|---|
| 455 |
} |
|---|
| 456 |
|
|---|
| 457 |
|
|---|
| 458 |
static void |
|---|
| 459 |
expand_deps (struct file *f) |
|---|
| 460 |
{ |
|---|
| 461 |
struct dep *d; |
|---|
| 462 |
struct dep *old = f->deps; |
|---|
| 463 |
char *file_stem = f->stem; |
|---|
| 464 |
unsigned int last_dep_has_cmds = f->updating; |
|---|
| 465 |
int initialized = 0; |
|---|
| 466 |
|
|---|
| 467 |
f->updating = 0; |
|---|
| 468 |
f->deps = 0; |
|---|
| 469 |
|
|---|
| 470 |
for (d = old; d != 0; d = d->next) |
|---|
| 471 |
{ |
|---|
| 472 |
struct dep *new, *d1; |
|---|
| 473 |
char *p; |
|---|
| 474 |
|
|---|
| 475 |
if (! d->name) |
|---|
| 476 |
continue; |
|---|
| 477 |
|
|---|
| 478 |
|
|---|
| 479 |
|
|---|
| 480 |
if (! d->need_2nd_expansion) |
|---|
| 481 |
p = d->name; |
|---|
| 482 |
else |
|---|
| 483 |
{ |
|---|
| 484 |
|
|---|
| 485 |
|
|---|
| 486 |
if (d->staticpattern) |
|---|
| 487 |
{ |
|---|
| 488 |
char *o; |
|---|
| 489 |
char *buffer = variable_expand (""); |
|---|
| 490 |
|
|---|
| 491 |
o = subst_expand (buffer, d->name, "%", "$*", 1, 2, 0); |
|---|
| 492 |
|
|---|
| 493 |
free (d->name); |
|---|
| 494 |
d->name = savestring (buffer, o - buffer); |
|---|
| 495 |
d->staticpattern = 0; |
|---|
| 496 |
|
|---|
| 497 |
} |
|---|
| 498 |
|
|---|
| 499 |
|
|---|
| 500 |
|
|---|
| 501 |
|
|---|
| 502 |
|
|---|
| 503 |
if (!initialized) |
|---|
| 504 |
{ |
|---|
| 505 |
initialize_file_variables (f, 0); |
|---|
| 506 |
initialized = 1; |
|---|
| 507 |
} |
|---|
| 508 |
|
|---|
| 509 |
if (d->stem != 0) |
|---|
| 510 |
f->stem = d->stem; |
|---|
| 511 |
|
|---|
| 512 |
set_file_variables (f); |
|---|
| 513 |
|
|---|
| 514 |
p = variable_expand_for_file (d->name, f); |
|---|
| 515 |
|
|---|
| 516 |
if (d->stem != 0) |
|---|
| 517 |
f->stem = file_stem; |
|---|
| 518 |
} |
|---|
| 519 |
|
|---|
| 520 |
|
|---|
| 521 |
new = parse_prereqs (p); |
|---|
| 522 |
|
|---|
| 523 |
|
|---|
| 524 |
|
|---|
| 525 |
|
|---|
| 526 |
if (new && d->staticpattern) |
|---|
| 527 |
{ |
|---|
| 528 |
char *pattern = "%"; |
|---|
| 529 |
char *buffer = variable_expand (""); |
|---|
| 530 |
struct dep *dp = new, *dl = 0; |
|---|
| 531 |
|
|---|
| 532 |
while (dp != 0) |
|---|
| 533 |
{ |
|---|
| 534 |
char *percent = find_percent (dp->name); |
|---|
| 535 |
if (percent) |
|---|
| 536 |
{ |
|---|
| 537 |
|
|---|
| 538 |
|
|---|
| 539 |
|
|---|
| 540 |
if (d->stem[0] == '\0') |
|---|
| 541 |
|
|---|
| 542 |
bcopy (percent+1, percent, strlen (percent)); |
|---|
| 543 |
else |
|---|
| 544 |
{ |
|---|
| 545 |
char *o = patsubst_expand (buffer, d->stem, pattern, |
|---|
| 546 |
dp->name, pattern+1, |
|---|
| 547 |
percent+1); |
|---|
| 548 |
if (o == buffer) |
|---|
| 549 |
dp->name[0] = '\0'; |
|---|
| 550 |
else |
|---|
| 551 |
{ |
|---|
| 552 |
free (dp->name); |
|---|
| 553 |
dp->name = savestring (buffer, o - buffer); |
|---|
| 554 |
} |
|---|
| 555 |
} |
|---|
| 556 |
|
|---|
| 557 |
|
|---|
| 558 |
if (dp->name[0] == '\0') |
|---|
| 559 |
{ |
|---|
| 560 |
struct dep *df = dp; |
|---|
| 561 |
if (dp == new) |
|---|
| 562 |
dp = new = new->next; |
|---|
| 563 |
else |
|---|
| 564 |
dp = dl->next = dp->next; |
|---|
| 565 |
|
|---|
| 566 |
df->name = 0; |
|---|
| 567 |
free_dep (df); |
|---|
| 568 |
continue; |
|---|
| 569 |
} |
|---|
| 570 |
} |
|---|
| 571 |
dl = dp; |
|---|
| 572 |
dp = dp->next; |
|---|
| 573 |
} |
|---|
| 574 |
} |
|---|
| 575 |
|
|---|
| 576 |
|
|---|
| 577 |
for (d1 = new; d1 != 0; d1 = d1->next) |
|---|
| 578 |
{ |
|---|
| 579 |
d1->file = lookup_file (d1->name); |
|---|
| 580 |
if (d1->file == 0) |
|---|
| 581 |
d1->file = enter_file (d1->name); |
|---|
| 582 |
else |
|---|
| 583 |
free (d1->name); |
|---|
| 584 |
d1->name = 0; |
|---|
| 585 |
d1->staticpattern = 0; |
|---|
| 586 |
d1->need_2nd_expansion = 0; |
|---|
| 587 |
} |
|---|
| 588 |
|
|---|
| 589 |
|
|---|
| 590 |
|
|---|
| 591 |
|
|---|
| 592 |
|
|---|
| 593 |
|
|---|
| 594 |
|
|---|
| 595 |
|
|---|
| 596 |
|
|---|
| 597 |
if (new != 0) |
|---|
| 598 |
{ |
|---|
| 599 |
if (d->next == 0 && last_dep_has_cmds) |
|---|
| 600 |
{ |
|---|
| 601 |
struct dep **d_ptr; |
|---|
| 602 |
for (d_ptr = &new; *d_ptr; d_ptr = &(*d_ptr)->next) |
|---|
| 603 |
; |
|---|
| 604 |
|
|---|
| 605 |
*d_ptr = f->deps; |
|---|
| 606 |
f->deps = new; |
|---|
| 607 |
} |
|---|
| 608 |
else |
|---|
| 609 |
{ |
|---|
| 610 |
struct dep **d_ptr; |
|---|
| 611 |
for (d_ptr = &f->deps; *d_ptr; d_ptr = &(*d_ptr)->next) |
|---|
| 612 |
; |
|---|
| 613 |
|
|---|
| 614 |
*d_ptr = new; |
|---|
| 615 |
} |
|---|
| 616 |
} |
|---|
| 617 |
} |
|---|
| 618 |
|
|---|
| 619 |
free_dep_chain (old); |
|---|
| 620 |
} |
|---|
| 621 |
|
|---|
| 622 |
|
|---|
| 623 |
|
|---|
| 624 |
|
|---|
| 625 |
|
|---|
| 626 |
|
|---|
| 627 |
|
|---|
| 628 |
void |
|---|
| 629 |
snap_deps (void) |
|---|
| 630 |
{ |
|---|
| 631 |
struct file *f; |
|---|
| 632 |
struct file *f2; |
|---|
| 633 |
struct dep *d; |
|---|
| 634 |
struct file **file_slot_0; |
|---|
| 635 |
struct file **file_slot; |
|---|
| 636 |
struct file **file_end; |
|---|
| 637 |
|
|---|
| 638 |
|
|---|
| 639 |
|
|---|
| 640 |
|
|---|
| 641 |
|
|---|
| 642 |
|
|---|
| 643 |
for (f = lookup_file (".SUFFIXES"); f != 0; f = f->prev) |
|---|
| 644 |
expand_deps (f); |
|---|
| 645 |
|
|---|
| 646 |
|
|---|
| 647 |
|
|---|
| 648 |
|
|---|
| 649 |
file_slot_0 = (struct file **) hash_dump (&files, 0, 0); |
|---|
| 650 |
file_end = file_slot_0 + files.ht_fill; |
|---|
| 651 |
for (file_slot = file_slot_0; file_slot < file_end; file_slot++) |
|---|
| 652 |
for (f = *file_slot; f != 0; f = f->prev) |
|---|
| 653 |
{ |
|---|
| 654 |
if (strcmp (f->name, ".SUFFIXES") != 0) |
|---|
| 655 |
expand_deps (f); |
|---|
| 656 |
} |
|---|
| 657 |
free (file_slot_0); |
|---|
| 658 |
|
|---|
| 659 |
for (f = lookup_file (".PRECIOUS"); f != 0; f = f->prev) |
|---|
| 660 |
for (d = f->deps; d != 0; d = d->next) |
|---|
| 661 |
for (f2 = d->file; f2 != 0; f2 = f2->prev) |
|---|
| 662 |
f2->precious = 1; |
|---|
| 663 |
|
|---|
| 664 |
for (f = lookup_file (".LOW_RESOLUTION_TIME"); f != 0; f = f->prev) |
|---|
| 665 |
for (d = f->deps; d != 0; d = d->next) |
|---|
| 666 |
for (f2 = d->file; f2 != 0; f2 = f2->prev) |
|---|
| 667 |
f2->low_resolution_time = 1; |
|---|
| 668 |
|
|---|
| 669 |
for (f = lookup_file (".PHONY"); f != 0; f = f->prev) |
|---|
| 670 |
for (d = f->deps; d != 0; d = d->next) |
|---|
| 671 |
for (f2 = d->file; f2 != 0; f2 = f2->prev) |
|---|
| 672 |
{ |
|---|
| 673 |
|
|---|
| 674 |
f2->phony = 1; |
|---|
| 675 |
f2->is_target = 1; |
|---|
| 676 |
f2->last_mtime = NONEXISTENT_MTIME; |
|---|
| 677 |
f2->mtime_before_update = NONEXISTENT_MTIME; |
|---|
| 678 |
} |
|---|
| 679 |
|
|---|
| 680 |
for (f = lookup_file (".INTERMEDIATE"); f != 0; f = f->prev) |
|---|
| 681 |
{ |
|---|
| 682 |
|
|---|
| 683 |
|
|---|
| 684 |
for (d = f->deps; d != 0; d = d->next) |
|---|
| 685 |
for (f2 = d->file; f2 != 0; f2 = f2->prev) |
|---|
| 686 |
f2->intermediate = 1; |
|---|
| 687 |
|
|---|
| 688 |
|
|---|
| 689 |
|
|---|
| 690 |
} |
|---|
| 691 |
|
|---|
| 692 |
for (f = lookup_file (".SECONDARY"); f != 0; f = f->prev) |
|---|
| 693 |
{ |
|---|
| 694 |
|
|---|
| 695 |
|
|---|
| 696 |
|
|---|
| 697 |
|
|---|
| 698 |
|
|---|
| 699 |
if (f->deps) |
|---|
| 700 |
for (d = f->deps; d != 0; d = d->next) |
|---|
| 701 |
for (f2 = d->file; f2 != 0; f2 = f2->prev) |
|---|
| 702 |
f2->intermediate = f2->secondary = 1; |
|---|
| 703 |
|
|---|
| 704 |
else |
|---|
| 705 |
{ |
|---|
| 706 |
all_secondary = 1; |
|---|
| 707 |
hash_map (&files, set_intermediate); |
|---|
| 708 |
} |
|---|
| 709 |
} |
|---|
| 710 |
|
|---|
| 711 |
f = lookup_file (".EXPORT_ALL_VARIABLES"); |
|---|
| 712 |
if (f != 0 && f->is_target) |
|---|
| 713 |
export_all_variables = 1; |
|---|
| 714 |
|
|---|
| 715 |
f = lookup_file (".IGNORE"); |
|---|
| 716 |
if (f != 0 && f->is_target) |
|---|
| 717 |
{ |
|---|
| 718 |
if (f->deps == 0) |
|---|
| 719 |
ignore_errors_flag = 1; |
|---|
| 720 |
else |
|---|
| 721 |
for (d = f->deps; d != 0; d = d->next) |
|---|
| 722 |
for (f2 = d->file; f2 != 0; f2 = f2->prev) |
|---|
| 723 |
f2->command_flags |= COMMANDS_NOERROR; |
|---|
| 724 |
} |
|---|
| 725 |
|
|---|
| 726 |
f = lookup_file (".SILENT"); |
|---|
| 727 |
if (f != 0 && f->is_target) |
|---|
| 728 |
{ |
|---|
| 729 |
if (f->deps == 0) |
|---|
| 730 |
silent_flag = 1; |
|---|
| 731 |
else |
|---|
| 732 |
for (d = f->deps; d != 0; d = d->next) |
|---|
| 733 |
for (f2 = d->file; f2 != 0; f2 = f2->prev) |
|---|
| 734 |
f2->command_flags |= COMMANDS_SILENT; |
|---|
| 735 |
} |
|---|
| 736 |
|
|---|
| 737 |
f = lookup_file (".NOTPARALLEL"); |
|---|
| 738 |
if (f != 0 && f->is_target) |
|---|
| 739 |
not_parallel = 1; |
|---|
| 740 |
|
|---|
| 741 |
#ifndef NO_MINUS_C_MINUS_O |
|---|
| 742 |
|
|---|
| 743 |
|
|---|
| 744 |
|
|---|
| 745 |
|
|---|
| 746 |
|
|---|
| 747 |
#endif |
|---|
| 748 |
|
|---|
| 749 |
|
|---|
| 750 |
snapped_deps = 1; |
|---|
| 751 |
} |
|---|
| 752 |
|
|---|
| 753 |
|
|---|
| 754 |
|
|---|
| 755 |
void |
|---|
| 756 |
set_command_state (struct file *file, enum cmd_state state) |
|---|
| 757 |
{ |
|---|
| 758 |
struct dep *d; |
|---|
| 759 |
|
|---|
| 760 |
file->command_state = state; |
|---|
| 761 |
|
|---|
| 762 |
for (d = file->also_make; d != 0; d = d->next) |
|---|
| 763 |
d->file->command_state = state; |
|---|
| 764 |
} |
|---|
| 765 |
|
|---|
| 766 |
|
|---|
| 767 |
|
|---|
| 768 |
FILE_TIMESTAMP |
|---|
| 769 |
file_timestamp_cons (const char *fname, time_t s, int ns) |
|---|
| 770 |
{ |
|---|
| 771 |
int offset = ORDINARY_MTIME_MIN + (FILE_TIMESTAMP_HI_RES ? ns : 0); |
|---|
| 772 |
FILE_TIMESTAMP product = (FILE_TIMESTAMP) s << FILE_TIMESTAMP_LO_BITS; |
|---|
| 773 |
FILE_TIMESTAMP ts = product + offset; |
|---|
| 774 |
|
|---|
| 775 |
if (! (s <= FILE_TIMESTAMP_S (ORDINARY_MTIME_MAX) |
|---|
| 776 |
&& product <= ts && ts <= ORDINARY_MTIME_MAX)) |
|---|
| 777 |
{ |
|---|
| 778 |
char buf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1]; |
|---|
| 779 |
ts = s <= OLD_MTIME ? ORDINARY_MTIME_MIN : ORDINARY_MTIME_MAX; |
|---|
| 780 |
file_timestamp_sprintf (buf, ts); |
|---|
| 781 |
error (NILF, _("%s: Timestamp out of range; substituting %s"), |
|---|
| 782 |
fname ? fname : _("Current time"), buf); |
|---|
| 783 |
} |
|---|
| 784 |
|
|---|
| 785 |
return ts; |
|---|
| 786 |
} |
|---|
| 787 |
|
|---|
| 788 |
|
|---|
| 789 |
|
|---|
| 790 |
FILE_TIMESTAMP |
|---|
| 791 |
file_timestamp_now (int *resolution) |
|---|
| 792 |
{ |
|---|
| 793 |
int r; |
|---|
| 794 |
time_t s; |
|---|
| 795 |
int ns; |
|---|
| 796 |
|
|---|
| 797 |
|
|---|
| 798 |
|
|---|
| 799 |
|
|---|
| 800 |
#if FILE_TIMESTAMP_HI_RES |
|---|
| 801 |
# if HAVE_CLOCK_GETTIME && defined CLOCK_REALTIME |
|---|
| 802 |
{ |
|---|
| 803 |
struct timespec timespec; |
|---|
| 804 |
if (clock_gettime (CLOCK_REALTIME, ×pec) == 0) |
|---|
| 805 |
{ |
|---|
| 806 |
r = 1; |
|---|
| 807 |
s = timespec.tv_sec; |
|---|
| 808 |
ns = timespec.tv_nsec; |
|---|
| 809 |
goto got_time; |
|---|
| 810 |
} |
|---|
| 811 |
} |
|---|
| 812 |
# endif |
|---|
| 813 |
# if HAVE_GETTIMEOFDAY |
|---|
| 814 |
{ |
|---|
| 815 |
struct timeval timeval; |
|---|
| 816 |
if (gettimeofday (&timeval, 0) == 0) |
|---|
| 817 |
{ |
|---|
| 818 |
r = 1000; |
|---|
| 819 |
s = timeval.tv_sec; |
|---|
| 820 |
ns = timeval.tv_usec * 1000; |
|---|
| 821 |
goto got_time; |
|---|
| 822 |
} |
|---|
| 823 |
} |
|---|
| 824 |
# endif |
|---|
| 825 |
#endif |
|---|
| 826 |
|
|---|
| 827 |
r = 1000000000; |
|---|
| 828 |
s = time ((time_t *) 0); |
|---|
| 829 |
ns = 0; |
|---|
| 830 |
|
|---|
| 831 |
#if FILE_TIMESTAMP_HI_RES |
|---|
| 832 |
got_time: |
|---|
| 833 |
#endif |
|---|
| 834 |
*resolution = r; |
|---|
| 835 |
return file_timestamp_cons (0, s, ns); |
|---|
| 836 |
} |
|---|
| 837 |
|
|---|
| 838 |
|
|---|
| 839 |
|
|---|
| 840 |
void |
|---|
| 841 |
file_timestamp_sprintf (char *p, FILE_TIMESTAMP ts) |
|---|
| 842 |
{ |
|---|
| 843 |
time_t t = FILE_TIMESTAMP_S (ts); |
|---|
| 844 |
struct tm *tm = localtime (&t); |
|---|
| 845 |
|
|---|
| 846 |
if (tm) |
|---|
| 847 |
sprintf (p, "%04ld-%02d-%02d %02d:%02d:%02d", |
|---|
| 848 |
(long)(tm->tm_year + 1900), tm->tm_mon + 1, tm->tm_mday, |
|---|
| 849 |
tm->tm_hour, tm->tm_min, tm->tm_sec); |
|---|
| 850 |
else if (t < 0) |
|---|
| 851 |
sprintf (p, "%ld", (long) t); |
|---|
| 852 |
else |
|---|
| 853 |
sprintf (p, "%lu", (unsigned long) t); |
|---|
| 854 |
p += strlen (p); |
|---|
| 855 |
|
|---|
| 856 |
|
|---|
| 857 |
|
|---|
| 858 |
|
|---|
| 859 |
|
|---|
| 860 |
|
|---|
| 861 |
sprintf (p, ".%09d", FILE_TIMESTAMP_NS (ts)); |
|---|
| 862 |
p += strlen (p) - 1; |
|---|
| 863 |
while (*p == '0') |
|---|
| 864 |
p--; |
|---|
| 865 |
p += *p != '.'; |
|---|
| 866 |
|
|---|
| 867 |
*p = '\0'; |
|---|
| 868 |
} |
|---|
| 869 |
|
|---|
| 870 |
|
|---|
| 871 |
|
|---|
| 872 |
static void |
|---|
| 873 |
print_file (const void *item) |
|---|
| 874 |
{ |
|---|
| 875 |
struct file *f = (struct file *) item; |
|---|
| 876 |
struct dep *d; |
|---|
| 877 |
struct dep *ood = 0; |
|---|
| 878 |
|
|---|
| 879 |
putchar ('\n'); |
|---|
| 880 |
if (!f->is_target) |
|---|
| 881 |
puts (_("# Not a target:")); |
|---|
| 882 |
printf ("%s:%s", f->name, f->double_colon ? ":" : ""); |
|---|
| 883 |
|
|---|
| 884 |
|
|---|
| 885 |
for (d = f->deps; d != 0; d = d->next) |
|---|
| 886 |
if (! d->ignore_mtime) |
|---|
| 887 |
printf (" %s", dep_name (d)); |
|---|
| 888 |
else if (! ood) |
|---|
| 889 |
ood = d; |
|---|
| 890 |
|
|---|
| 891 |
|
|---|
| 892 |
if (ood) |
|---|
| 893 |
{ |
|---|
| 894 |
printf (" | %s", dep_name (ood)); |
|---|
| 895 |
for (d = ood->next; d != 0; d = d->next) |
|---|
| 896 |
if (d->ignore_mtime) |
|---|
| 897 |
printf (" %s", dep_name (d)); |
|---|
| 898 |
} |
|---|
| 899 |
|
|---|
| 900 |
putchar ('\n'); |
|---|
| 901 |
|
|---|
| 902 |
if (f->precious) |
|---|
| 903 |
puts (_("# Precious file (prerequisite of .PRECIOUS).")); |
|---|
| 904 |
if (f->phony) |
|---|
| 905 |
puts (_("# Phony target (prerequisite of .PHONY).")); |
|---|
| 906 |
if (f->cmd_target) |
|---|
| 907 |
puts (_("# Command-line target.")); |
|---|
| 908 |
if (f->dontcare) |
|---|
| 909 |
puts (_("# A default, MAKEFILES, or -include/sinclude makefile.")); |
|---|
| 910 |
puts (f->tried_implicit |
|---|
| 911 |
? _("# Implicit rule search has been done.") |
|---|
| 912 |
: _("# Implicit rule search has not been done.")); |
|---|
| 913 |
if (f->stem != 0) |
|---|
| 914 |
printf (_("# Implicit/static pattern stem: `%s'\n"), f->stem); |
|---|
| 915 |
if (f->intermediate) |
|---|
| 916 |
puts (_("# File is an intermediate prerequisite.")); |
|---|
| 917 |
if (f->also_make != 0) |
|---|
| 918 |
{ |
|---|
| 919 |
fputs (_("# Also makes:"), stdout); |
|---|
| 920 |
for (d = f->also_make; d != 0; d = d->next) |
|---|
| 921 |
printf (" %s", dep_name (d)); |
|---|
| 922 |
putchar ('\n'); |
|---|
| 923 |
} |
|---|
| 924 |
if (f->last_mtime == UNKNOWN_MTIME) |
|---|
| 925 |
puts (_("# Modification time never checked.")); |
|---|
| 926 |
else if (f->last_mtime == NONEXISTENT_MTIME) |
|---|
| 927 |
puts (_("# File does not exist.")); |
|---|
| 928 |
else if (f->last_mtime == OLD_MTIME) |
|---|
| 929 |
puts (_("# File is very old.")); |
|---|
| 930 |
else |
|---|
| 931 |
{ |
|---|
| 932 |
char buf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1]; |
|---|
| 933 |
file_timestamp_sprintf (buf, f->last_mtime); |
|---|
| 934 |
printf (_("# Last modified %s\n"), buf); |
|---|
| 935 |
} |
|---|
| 936 |
puts (f->updated |
|---|
| 937 |
? _("# File has been updated.") : _("# File has not been updated.")); |
|---|
| 938 |
switch (f->command_state) |
|---|
| 939 |
{ |
|---|
| 940 |
case cs_running: |
|---|
| 941 |
puts (_("# Commands currently running (THIS IS A BUG).")); |
|---|
| 942 |
break; |
|---|
| 943 |
case cs_deps_running: |
|---|
| 944 |
puts (_("# Dependencies commands running (THIS IS A BUG).")); |
|---|
| 945 |
break; |
|---|
| 946 |
case cs_not_started: |
|---|
| 947 |
case cs_finished: |
|---|
| 948 |
switch (f->update_status) |
|---|
| 949 |
{ |
|---|
| 950 |
case -1: |
|---|
| 951 |
break; |
|---|
| 952 |
case 0: |
|---|
| 953 |
puts (_("# Successfully updated.")); |
|---|
| 954 |
break; |
|---|
| 955 |
case 1: |
|---|
| 956 |
assert (question_flag); |
|---|
| 957 |
puts (_("# Needs to be updated (-q is set).")); |
|---|
| 958 |
break; |
|---|
| 959 |
case 2: |
|---|
| 960 |
puts (_("# Failed to be updated.")); |
|---|
| 961 |
break; |
|---|
| 962 |
default: |
|---|
| 963 |
puts (_("# Invalid value in `update_status' member!")); |
|---|
| 964 |
fflush (stdout); |
|---|
| 965 |
fflush (stderr); |
|---|
| 966 |
abort (); |
|---|
| 967 |
} |
|---|
| 968 |
break; |
|---|
| 969 |
default: |
|---|
| 970 |
puts (_("# Invalid value in `command_state' member!")); |
|---|
| 971 |
fflush (stdout); |
|---|
| 972 |
fflush (stderr); |
|---|
| 973 |
abort (); |
|---|
| 974 |
} |
|---|
| 975 |
|
|---|
| 976 |
if (f->variables != 0) |
|---|
| 977 |
print_file_variables (f); |
|---|
| 978 |
|
|---|
| 979 |
if (f->cmds != 0) |
|---|
| 980 |
print_commands (f->cmds); |
|---|
| 981 |
|
|---|
| 982 |
if (f->prev) |
|---|
| 983 |
print_file ((const void *) f->prev); |
|---|
| 984 |
} |
|---|
| 985 |
|
|---|
| 986 |
void |
|---|
| 987 |
print_file_data_base (void) |
|---|
| 988 |
{ |
|---|
| 989 |
puts (_("\n# Files")); |
|---|
| 990 |
|
|---|
| 991 |
hash_map (&files, print_file); |
|---|
| 992 |
|
|---|
| 993 |
fputs (_("\n# files hash-table stats:\n# "), stdout); |
|---|
| 994 |
hash_print_stats (&files, stdout); |
|---|
| 995 |
} |
|---|
| 996 |
|
|---|
| 997 |
#define EXPANSION_INCREMENT(_l) ((((_l) / 500) + 1) * 500) |
|---|
| 998 |
|
|---|
| 999 |
char * |
|---|
| 1000 |
build_target_list (char *value) |
|---|
| 1001 |
{ |
|---|
| 1002 |
static unsigned long last_targ_count = 0; |
|---|
| 1003 |
|
|---|
| 1004 |
if (files.ht_fill != last_targ_count) |
|---|
| 1005 |
{ |
|---|
| 1006 |
unsigned long max = EXPANSION_INCREMENT (strlen (value)); |
|---|
| 1007 |
unsigned long len; |
|---|
| 1008 |
char *p; |
|---|
| 1009 |
struct file **fp = (struct file **) files.ht_vec; |
|---|
| 1010 |
struct file **end = &fp[files.ht_size]; |
|---|
| 1011 |
|
|---|
| 1012 |
|
|---|
| 1013 |
value = xrealloc (value, max); |
|---|
| 1014 |
|
|---|
| 1015 |
p = value; |
|---|
| 1016 |
len = 0; |
|---|
| 1017 |
for (; fp < end; ++fp) |
|---|
| 1018 |
if (!HASH_VACANT (*fp) && (*fp)->is_target) |
|---|
| 1019 |
{ |
|---|
| 1020 |
struct file *f = *fp; |
|---|
| 1021 |
int l = strlen (f->name); |
|---|
| 1022 |
|
|---|
| 1023 |
len += l + 1; |
|---|
| 1024 |
if (len > max) |
|---|
| 1025 |
{ |
|---|
| 1026 |
unsigned long off = p - value; |
|---|
| 1027 |
|
|---|
| 1028 |
max += EXPANSION_INCREMENT (l + 1); |
|---|
| 1029 |
value = xrealloc (value, max); |
|---|
| 1030 |
p = &value[off]; |
|---|
| 1031 |
} |
|---|
| 1032 |
|
|---|
| 1033 |
bcopy (f->name, p, l); |
|---|
| 1034 |
p += l; |
|---|
| 1035 |
*(p++) = ' '; |
|---|
| 1036 |
} |
|---|
| 1037 |
*(p-1) = '\0'; |
|---|
| 1038 |
|
|---|
| 1039 |
last_targ_count = files.ht_fill; |
|---|
| 1040 |
} |
|---|
| 1041 |
|
|---|
| 1042 |
return value; |
|---|
| 1043 |
} |
|---|
| 1044 |
|
|---|
| 1045 |
void |
|---|
| 1046 |
init_hash_files (void) |
|---|
| 1047 |
{ |
|---|
| 1048 |
hash_init (&files, 1000, file_hash_1, file_hash_2, file_hash_cmp); |
|---|
| 1049 |
} |
|---|
| 1050 |
|
|---|
| 1051 |
|
|---|