| 1 |
#include "pconf.h" |
| 2 |
|
| 3 |
|
| 4 |
static void PConfLoadPlatformsSanitizeLine(char *s); |
| 5 |
void PConfFreePlatform(platform_struct *platform_ptr); |
| 6 |
void PConfFreePlatforms( |
| 7 |
platform_struct ***list, int *total |
| 8 |
); |
| 9 |
int PConfLoadPlatformsFromFile( |
| 10 |
pconf_core_struct *core_ptr, const char *filename |
| 11 |
); |
| 12 |
int PConfLoadThisPlatformFromFile( |
| 13 |
pconf_core_struct *core_ptr, const char *filename |
| 14 |
); |
| 15 |
|
| 16 |
void PConfGenerateOutputMakefile( |
| 17 |
pconf_core_struct *core_ptr, platform_struct *platform_ptr |
| 18 |
); |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
static void PConfLoadPlatformsSanitizeLine(char *s) |
| 25 |
{ |
| 26 |
char *sp; |
| 27 |
|
| 28 |
|
| 29 |
if(s == NULL) |
| 30 |
return; |
| 31 |
|
| 32 |
|
| 33 |
STRSTRIP(s); |
| 34 |
|
| 35 |
|
| 36 |
sp = s; |
| 37 |
|
| 38 |
while((*sp) != '\0') |
| 39 |
{ |
| 40 |
|
| 41 |
if(ISCR(*sp)) |
| 42 |
{ |
| 43 |
char *sp2 = sp; |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
while((*sp2) != '\0') |
| 49 |
{ |
| 50 |
(*sp2) = *(sp2 + 1); |
| 51 |
sp2++; |
| 52 |
} |
| 53 |
|
| 54 |
} |
| 55 |
else |
| 56 |
{ |
| 57 |
sp++; |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
return; |
| 62 |
} |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
void PConfFreePlatform(platform_struct *platform_ptr) |
| 70 |
{ |
| 71 |
int n, j; |
| 72 |
feature_struct *feature_ptr; |
| 73 |
depend_struct *depend_ptr; |
| 74 |
|
| 75 |
|
| 76 |
if(platform_ptr == NULL) |
| 77 |
return; |
| 78 |
|
| 79 |
|
| 80 |
for(n = 0; n < platform_ptr->total_features; n++) |
| 81 |
{ |
| 82 |
feature_ptr = platform_ptr->feature[n]; |
| 83 |
if(feature_ptr == NULL) |
| 84 |
continue; |
| 85 |
|
| 86 |
|
| 87 |
for(j = 0; j < feature_ptr->total_depends; j++) |
| 88 |
{ |
| 89 |
depend_ptr = feature_ptr->depend[j]; |
| 90 |
if(depend_ptr == NULL) |
| 91 |
continue; |
| 92 |
|
| 93 |
FREE(depend_ptr->name); |
| 94 |
FREE(depend_ptr->description); |
| 95 |
STRFREEARRAY( |
| 96 |
depend_ptr->path, |
| 97 |
depend_ptr->total_paths |
| 98 |
); |
| 99 |
STRFREEARRAY( |
| 100 |
depend_ptr->grep_string, |
| 101 |
depend_ptr->total_grep_strings |
| 102 |
); |
| 103 |
|
| 104 |
FREE(depend_ptr->os_name); |
| 105 |
FREE(depend_ptr->machine_name); |
| 106 |
|
| 107 |
FREE(depend_ptr); |
| 108 |
} |
| 109 |
FREE(feature_ptr->depend); |
| 110 |
feature_ptr->depend = NULL; |
| 111 |
feature_ptr->total_depends = 0; |
| 112 |
|
| 113 |
|
| 114 |
FREE(feature_ptr->name); |
| 115 |
FREE(feature_ptr->description); |
| 116 |
FREE(feature_ptr->url_homepage); |
| 117 |
FREE(feature_ptr->url_download); |
| 118 |
FREE(feature_ptr->cflags); |
| 119 |
FREE(feature_ptr->inc_dirs); |
| 120 |
FREE(feature_ptr->libs); |
| 121 |
FREE(feature_ptr->lib_dirs); |
| 122 |
|
| 123 |
FREE(feature_ptr); |
| 124 |
} |
| 125 |
FREE(platform_ptr->feature); |
| 126 |
platform_ptr->feature = NULL; |
| 127 |
platform_ptr->total_features = 0; |
| 128 |
|
| 129 |
FREE(platform_ptr->name); |
| 130 |
FREE(platform_ptr->description); |
| 131 |
|
| 132 |
STRFREEARRAY( |
| 133 |
platform_ptr->path_header, |
| 134 |
platform_ptr->total_path_headers |
| 135 |
); |
| 136 |
STRFREEARRAY( |
| 137 |
platform_ptr->path_library, |
| 138 |
platform_ptr->total_path_libraries |
| 139 |
); |
| 140 |
STRFREEARRAY( |
| 141 |
platform_ptr->path_config, |
| 142 |
platform_ptr->total_path_configs |
| 143 |
); |
| 144 |
STRFREEARRAY( |
| 145 |
platform_ptr->path_program, |
| 146 |
platform_ptr->total_path_programs |
| 147 |
); |
| 148 |
STRFREEARRAY( |
| 149 |
platform_ptr->path_data, |
| 150 |
platform_ptr->total_path_datas |
| 151 |
); |
| 152 |
|
| 153 |
FREE(platform_ptr->prefix); |
| 154 |
FREE(platform_ptr->cflags); |
| 155 |
FREE(platform_ptr->inc_dirs); |
| 156 |
FREE(platform_ptr->libs); |
| 157 |
FREE(platform_ptr->lib_dirs); |
| 158 |
FREE(platform_ptr->cc); |
| 159 |
FREE(platform_ptr->cpp); |
| 160 |
|
| 161 |
FREE(platform_ptr); |
| 162 |
|
| 163 |
return; |
| 164 |
} |
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
void PConfFreePlatforms( |
| 171 |
platform_struct ***list, int *total |
| 172 |
) |
| 173 |
{ |
| 174 |
int i; |
| 175 |
|
| 176 |
|
| 177 |
if((list == NULL) || (total == NULL)) |
| 178 |
return; |
| 179 |
|
| 180 |
|
| 181 |
for(i = 0; i < (*total); i++) |
| 182 |
{ |
| 183 |
PConfFreePlatform((*list)[i]); |
| 184 |
(*list)[i] = NULL; |
| 185 |
} |
| 186 |
|
| 187 |
if((*list) != NULL) |
| 188 |
{ |
| 189 |
FREE(*list); |
| 190 |
(*list) = NULL; |
| 191 |
} |
| 192 |
(*total) = 0; |
| 193 |
|
| 194 |
return; |
| 195 |
} |
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
int PConfLoadPlatformsFromFile( |
| 205 |
pconf_core_struct *core_ptr, const char *filename |
| 206 |
) |
| 207 |
{ |
| 208 |
int platform_num, feature_num, depend_num; |
| 209 |
FILE *fp; |
| 210 |
char *buf; |
| 211 |
const char *parm; |
| 212 |
platform_struct *platform_ptr; |
| 213 |
feature_struct *feature_ptr; |
| 214 |
depend_struct *depend_ptr; |
| 215 |
|
| 216 |
#define DO_RESET_CONTEXT_PTRS \ |
| 217 |
{ \ |
| 218 |
platform_num = -1; \ |
| 219 |
platform_ptr = NULL; \ |
| 220 |
feature_num = -1; \ |
| 221 |
feature_ptr = NULL; \ |
| 222 |
depend_num = -1; \ |
| 223 |
depend_ptr = NULL; \ |
| 224 |
} |
| 225 |
|
| 226 |
if((core_ptr == NULL) || (filename == NULL)) |
| 227 |
return(-1); |
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
fp = FOPEN(filename, "rb"); |
| 233 |
if(fp == NULL) |
| 234 |
{ |
| 235 |
fprintf(stderr, "%s: Cannot open.\n", filename); |
| 236 |
return(-1); |
| 237 |
} |
| 238 |
|
| 239 |
|
| 240 |
buf = NULL; |
| 241 |
DO_RESET_CONTEXT_PTRS |
| 242 |
do |
| 243 |
{ |
| 244 |
buf = FSEEKNEXTPARAMETER( |
| 245 |
fp, buf, PCONF_CFG_COMMENT_CHAR, PCONF_CFG_DELIM_CHAR |
| 246 |
); |
| 247 |
if(buf == NULL) |
| 248 |
break; |
| 249 |
|
| 250 |
|
| 251 |
parm = (const char *)buf; |
| 252 |
|
| 253 |
|
| 254 |
if(!STRCASECMP(parm, "Version")) |
| 255 |
{ |
| 256 |
FSEEKNEXTLINE(fp); |
| 257 |
} |
| 258 |
|
| 259 |
else if(!STRCASECMP(parm, "Author")) |
| 260 |
{ |
| 261 |
FSEEKNEXTLINE(fp); |
| 262 |
} |
| 263 |
|
| 264 |
else if(!STRCASECMP(parm, "ProgramName")) |
| 265 |
{ |
| 266 |
FSEEKNEXTLINE(fp); |
| 267 |
} |
| 268 |
|
| 269 |
|
| 270 |
else if(!STRCASECMP(parm, "Platform")) |
| 271 |
{ |
| 272 |
char *val = FGETLINE(fp); |
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
if(platform_ptr != NULL) |
| 278 |
{ |
| 279 |
|
| 280 |
} |
| 281 |
|
| 282 |
|
| 283 |
PConfLoadPlatformsSanitizeLine(val); |
| 284 |
DO_RESET_CONTEXT_PTRS |
| 285 |
|
| 286 |
|
| 287 |
platform_num = core_ptr->total_platforms; |
| 288 |
core_ptr->total_platforms = platform_num + 1; |
| 289 |
core_ptr->platform = (platform_struct **)realloc( |
| 290 |
core_ptr->platform, |
| 291 |
core_ptr->total_platforms * sizeof(platform_struct *) |
| 292 |
); |
| 293 |
if(core_ptr->platform == NULL) |
| 294 |
{ |
| 295 |
core_ptr->total_platforms = 0; |
| 296 |
platform_num = -1; |
| 297 |
} |
| 298 |
else |
| 299 |
{ |
| 300 |
core_ptr->platform[platform_num] = platform_ptr = |
| 301 |
(platform_struct *)calloc( |
| 302 |
1, sizeof(platform_struct) |
| 303 |
); |
| 304 |
} |
| 305 |
|
| 306 |
|
| 307 |
if(platform_ptr != NULL) |
| 308 |
platform_ptr->name = val; |
| 309 |
else |
| 310 |
FREE(val); |
| 311 |
} |
| 312 |
|
| 313 |
else if(!STRCASECMP(parm, "PlatformFeature")) |
| 314 |
{ |
| 315 |
char *val = FGETLINE(fp); |
| 316 |
|
| 317 |
PConfLoadPlatformsSanitizeLine(val); |
| 318 |
|
| 319 |
depend_num = -1; |
| 320 |
depend_ptr = NULL; |
| 321 |
|
| 322 |
|
| 323 |
if(platform_ptr == NULL) |
| 324 |
{ |
| 325 |
fprintf( |
| 326 |
stderr, |
| 327 |
"%s: Cannot specify parameter %s without a Platform in context.\n", |
| 328 |
filename, parm |
| 329 |
); |
| 330 |
} |
| 331 |
else |
| 332 |
{ |
| 333 |
|
| 334 |
feature_num = platform_ptr->total_features; |
| 335 |
platform_ptr->total_features = feature_num + 1; |
| 336 |
platform_ptr->feature = (feature_struct **)realloc( |
| 337 |
platform_ptr->feature, |
| 338 |
platform_ptr->total_features * sizeof(feature_struct *) |
| 339 |
); |
| 340 |
if(platform_ptr->feature == NULL) |
| 341 |
{ |
| 342 |
platform_ptr->total_features = 0; |
| 343 |
feature_num = -1; |
| 344 |
feature_ptr = NULL; |
| 345 |
} |
| 346 |
else |
| 347 |
{ |
| 348 |
platform_ptr->feature[feature_num] = feature_ptr = |
| 349 |
(feature_struct *)calloc( |
| 350 |
1, sizeof(feature_struct) |
| 351 |
); |
| 352 |
} |
| 353 |
|
| 354 |
|
| 355 |
if(feature_ptr != NULL) |
| 356 |
{ |
| 357 |
feature_ptr->name = STRDUP(val); |
| 358 |
} |
| 359 |
} |
| 360 |
|
| 361 |
FREE(val); |
| 362 |
} |
| 363 |
|
| 364 |
else if(!STRCASECMP(parm, "FeatureDependency") || |
| 365 |
!STRCASECMP(parm, "FeatureDependent") || |
| 366 |
!STRCASECMP(parm, "FeatureDepend") |
| 367 |
) |
| 368 |
{ |
| 369 |
char *val = FGETLINE(fp); |
| 370 |
|
| 371 |
PConfLoadPlatformsSanitizeLine(val); |
| 372 |
|
| 373 |
|
| 374 |
if(feature_ptr == NULL) |
| 375 |
{ |
| 376 |
fprintf( |
| 377 |
stderr, |
| 378 |
"%s: Cannot specify parameter %s without a PlatformFeature in context.\n", |
| 379 |
filename, parm |
| 380 |
); |
| 381 |
} |
| 382 |
else |
| 383 |
{ |
| 384 |
|
| 385 |
depend_num = feature_ptr->total_depends; |
| 386 |
feature_ptr->total_depends = depend_num + 1; |
| 387 |
feature_ptr->depend = (depend_struct **)realloc( |
| 388 |
feature_ptr->depend, |
| 389 |
feature_ptr->total_depends * sizeof(depend_struct *) |
| 390 |
); |
| 391 |
if(feature_ptr->depend == NULL) |
| 392 |
{ |
| 393 |
feature_ptr->total_depends = 0; |
| 394 |
depend_num = -1; |
| 395 |
depend_ptr = NULL; |
| 396 |
} |
| 397 |
else |
| 398 |
{ |
| 399 |
feature_ptr->depend[depend_num] = depend_ptr = |
| 400 |
(depend_struct *)calloc( |
| 401 |
1, sizeof(depend_struct) |
| 402 |
); |
| 403 |
} |
| 404 |
|
| 405 |
|
| 406 |
if(depend_ptr != NULL) |
| 407 |
{ |
| 408 |
depend_ptr->name = STRDUP(val); |
| 409 |
} |
| 410 |
} |
| 411 |
|
| 412 |
FREE(val); |
| 413 |
} |
| 414 |
|
| 415 |
|
| 416 |
else if(!STRCASECMP(parm, "Description")) |
| 417 |
{ |
| 418 |
char *val = FGETLINE(fp); |
| 419 |
|
| 420 |
PConfLoadPlatformsSanitizeLine(val); |
| 421 |
|
| 422 |
|
| 423 |
if(depend_ptr != NULL) |
| 424 |
{ |
| 425 |
FREE(depend_ptr->description); |
| 426 |
depend_ptr->description = STRDUP(val); |
| 427 |
} |
| 428 |
else if(feature_ptr != NULL) |
| 429 |
{ |
| 430 |
FREE(feature_ptr->description); |
| 431 |
feature_ptr->description = STRDUP(val); |
| 432 |
} |
| 433 |
else if(platform_ptr != NULL) |
| 434 |
{ |
| 435 |
FREE(platform_ptr->description); |
| 436 |
platform_ptr->description = STRDUP(val); |
| 437 |
} |
| 438 |
else if(core_ptr->warnings) |
| 439 |
{ |
| 440 |
fprintf( |
| 441 |
stderr, |
| 442 |
"%s: Nothing in context for parameter `%s'.\n", |
| 443 |
filename, parm |
| 444 |
); |
| 445 |
} |
| 446 |
FREE(val); |
| 447 |
} |
| 448 |
|
| 449 |
else if(!STRCASECMP(parm, "FeatureURLHomePage") || |
| 450 |
!STRCASECMP(parm, "URLHomePage") |
| 451 |
) |
| 452 |
{ |
| 453 |
char *val = FGETLINE(fp); |
| 454 |
|
| 455 |
PConfLoadPlatformsSanitizeLine(val); |
| 456 |
|
| 457 |
|
| 458 |
if(feature_ptr != NULL) |
| 459 |
{ |
| 460 |
FREE(feature_ptr->url_homepage); |
| 461 |
feature_ptr->url_homepage = STRDUP(val); |
| 462 |
} |
| 463 |
else if(core_ptr->warnings) |
| 464 |
{ |
| 465 |
fprintf( |
| 466 |
stderr, |
| 467 |
"%s: Nothing in context for parameter `%s'.\n", |
| 468 |
filename, parm |
| 469 |
); |
| 470 |
} |
| 471 |
FREE(val); |
| 472 |
} |
| 473 |
|
| 474 |
else if(!STRCASECMP(parm, "FeatureURLDownload") || |
| 475 |
!STRCASECMP(parm, "URLDownload") |
| 476 |
) |
| 477 |
{ |
| 478 |
char *val = FGETLINE(fp); |
| 479 |
|
| 480 |
PConfLoadPlatformsSanitizeLine(val); |
| 481 |
|
| 482 |
|
| 483 |
if(feature_ptr != NULL) |
| 484 |
{ |
| 485 |
FREE(feature_ptr->url_download); |
| 486 |
feature_ptr->url_download = STRDUP(val); |
| 487 |
} |
| 488 |
else if(core_ptr->warnings) |
| 489 |
{ |
| 490 |
fprintf( |
| 491 |
stderr, |
| 492 |
"%s: Nothing in context for parameter `%s'.\n", |
| 493 |
filename, parm |
| 494 |
); |
| 495 |
} |
| 496 |
FREE(val); |
| 497 |
} |
| 498 |
|
| 499 |
|
| 500 |
else if(!STRCASECMP(parm, "MustExist")) |
| 501 |
{ |
| 502 |
char *val = FGETLINE(fp); |
| 503 |
int must_exist; |
| 504 |
|
| 505 |
PConfLoadPlatformsSanitizeLine(val); |
| 506 |
|
| 507 |
|
| 508 |
if((toupper(*val) == 'Y') || |
| 509 |
(toupper(*val) == 'T') |
| 510 |
) |
| 511 |
must_exist = PCONF_MUST_EXIST_YES; |
| 512 |
else if((toupper(*val) == 'P')) |
| 513 |
must_exist = PCONF_MUST_EXIST_PREFERRED; |
| 514 |
else |
| 515 |
must_exist = PCONF_MUST_EXIST_NO; |
| 516 |
|
| 517 |
|
| 518 |
if(depend_ptr != NULL) |
| 519 |
{ |
| 520 |
depend_ptr->must_exist = must_exist; |
| 521 |
} |
| 522 |
else if(feature_ptr != NULL) |
| 523 |
{ |
| 524 |
feature_ptr->must_exist = must_exist; |
| 525 |
} |
| 526 |
else if(core_ptr->warnings) |
| 527 |
{ |
| 528 |
fprintf( |
| 529 |
stderr, |
| 530 |
"%s: Nothing in context for parameter `%s'.\n", |
| 531 |
filename, parm |
| 532 |
); |
| 533 |
} |
| 534 |
FREE(val); |
| 535 |
} |
| 536 |
|
| 537 |
|
| 538 |
else if(!STRCASECMP(parm, "DependentType") || |
| 539 |
!STRCASECMP(parm, "DependType") |
| 540 |
) |
| 541 |
{ |
| 542 |
char *val = FGETLINE(fp); |
| 543 |
|
| 544 |
PConfLoadPlatformsSanitizeLine(val); |
| 545 |
|
| 546 |
|
| 547 |
if(depend_ptr != NULL) |
| 548 |
{ |
| 549 |
if(!STRCASECMP(val, "program")) |
| 550 |
depend_ptr->type = PCONF_DEP_TYPE_PROGRAM; |
| 551 |
else if(!STRCASECMP(val, "header")) |
| 552 |
depend_ptr->type = PCONF_DEP_TYPE_HEADER; |
| 553 |
else if(!STRCASECMP(val, "library")) |
| 554 |
depend_ptr->type = PCONF_DEP_TYPE_LIBRARY; |
| 555 |
else if(!STRCASECMP(val, "config")) |
| 556 |
depend_ptr->type = PCONF_DEP_TYPE_CONFIG; |
| 557 |
else if(!STRCASECMP(val, "data")) |
| 558 |
depend_ptr->type = PCONF_DEP_TYPE_DATA; |
| 559 |
else if(!STRCASECMP(val, "os")) |
| 560 |
depend_ptr->type = PCONF_DEP_TYPE_OS; |
| 561 |
else if(!STRCASECMP(val, "machine")) |
| 562 |
depend_ptr->type = PCONF_DEP_TYPE_MACHINE; |
| 563 |
else |
| 564 |
depend_ptr->type = PCONF_DEP_TYPE_OTHER; |
| 565 |
} |
| 566 |
FREE(val); |
| 567 |
} |
| 568 |
|
| 569 |
else if(!STRCASECMP(parm, "DependentPath") || |
| 570 |
!STRCASECMP(parm, "DependPath") |
| 571 |
) |
| 572 |
{ |
| 573 |
char *val = FGETLINE(fp); |
| 574 |
|
| 575 |
PConfLoadPlatformsSanitizeLine(val); |
| 576 |
|
| 577 |
|
| 578 |
if(depend_ptr != NULL) |
| 579 |
{ |
| 580 |
STRLISTAPPEND( |
| 581 |
&depend_ptr->path, |
| 582 |
&depend_ptr->total_paths, |
| 583 |
val |
| 584 |
); |
| 585 |
} |
| 586 |
FREE(val); |
| 587 |
} |
| 588 |
|
| 589 |
else if(!STRCASECMP(parm, "DependentGrepString") || |
| 590 |
!STRCASECMP(parm, "DependGrepString") |
| 591 |
) |
| 592 |
{ |
| 593 |
char *val = FGETLINE(fp); |
| 594 |
|
| 595 |
PConfLoadPlatformsSanitizeLine(val); |
| 596 |
|
| 597 |
|
| 598 |
if(depend_ptr != NULL) |
| 599 |
{ |
| 600 |
STRLISTAPPEND( |
| 601 |
&depend_ptr->grep_string, |
| 602 |
&depend_ptr->total_grep_strings, |
| 603 |
val |
| 604 |
); |
| 605 |
} |
| 606 |
FREE(val); |
| 607 |
} |
| 608 |
|
| 609 |
else if(!STRCASECMP(parm, "DependentOS") || |
| 610 |
!STRCASECMP(parm, "DependOS") |
| 611 |
) |
| 612 |
{ |
| 613 |
char *val = FGETLINE(fp); |
| 614 |
|
| 615 |
PConfLoadPlatformsSanitizeLine(val); |
| 616 |
|
| 617 |
|
| 618 |
if(depend_ptr != NULL) |
| 619 |
{ |
| 620 |
FREE(depend_ptr->os_name); |
| 621 |
depend_ptr->os_name = STRDUP(val); |
| 622 |
|
| 623 |
if(depend_ptr->type != PCONF_DEP_TYPE_OS) |
| 624 |
fprintf( |
| 625 |
stderr, |
| 626 |
"%s: Warning: Value defined but type of dependency is not a OS.\n", |
| 627 |
parm |
| 628 |
); |
| 629 |
} |
| 630 |
FREE(val); |
| 631 |
} |
| 632 |
|
| 633 |
else if(!STRCASECMP(parm, "DependentMachine") || |
| 634 |
!STRCASECMP(parm, "DependMachine") |
| 635 |
) |
| 636 |
{ |
| 637 |
char *val = FGETLINE(fp); |
| 638 |
|
| 639 |
PConfLoadPlatformsSanitizeLine(val); |
| 640 |
|
| 641 |
|
| 642 |
if(depend_ptr != NULL) |
| 643 |
{ |
| 644 |
FREE(depend_ptr->machine_name); |
| 645 |
depend_ptr->machine_name = STRDUP(val); |
| 646 |
|
| 647 |
if(depend_ptr->type != PCONF_DEP_TYPE_MACHINE) |
| 648 |
fprintf( |
| 649 |
stderr, |
| 650 |
"%s: Warning: Value defined but type of dependency is not a machine.\n", |
| 651 |
parm |
| 652 |
); |
| 653 |
} |
| 654 |
FREE(val); |
| 655 |
} |
| 656 |
|
| 657 |
|
| 658 |
else if(!STRCASECMP(parm, "FeatureCFLAGS") || |
| 659 |
!STRCASECMP(parm, "FeatureCFLAG") |
| 660 |
) |
| 661 |
{ |
| 662 |
char *val = FGETLINE(fp); |
| 663 |
|
| 664 |
PConfLoadPlatformsSanitizeLine(val); |
| 665 |
|
| 666 |
|
| 667 |
if(feature_ptr != NULL) |
| 668 |
{ |
| 669 |
FREE(feature_ptr->cflags); |
| 670 |
feature_ptr->cflags = STRDUP(val); |
| 671 |
} |
| 672 |
FREE(val); |
| 673 |
} |
| 674 |
|
| 675 |
else if(!STRCASECMP(parm, "FeatureINC_DIRS") || |
| 676 |
!STRCASECMP(parm, "FeatureINCDIRS") || |
| 677 |
!STRCASECMP(parm, "FeatureINC_DIR") || |
| 678 |
!STRCASECMP(parm, "FeatureINCDIR") |
| 679 |
) |
| 680 |
{ |
| 681 |
char *val = FGETLINE(fp); |
| 682 |
|
| 683 |
PConfLoadPlatformsSanitizeLine(val); |
| 684 |
|
| 685 |
|
| 686 |
if(feature_ptr != NULL) |
| 687 |
{ |
| 688 |
FREE(feature_ptr->inc_dirs); |
| 689 |
feature_ptr->inc_dirs = STRDUP(val); |
| 690 |
} |
| 691 |
FREE(val); |
| 692 |
} |
| 693 |
|
| 694 |
else if(!STRCASECMP(parm, "FeatureLIBS") || |
| 695 |
!STRCASECMP(parm, "FeatureLIB") |
| 696 |
) |
| 697 |
{ |
| 698 |
char *val = FGETLINE(fp); |
| 699 |
|
| 700 |
PConfLoadPlatformsSanitizeLine(val); |
| 701 |
|
| 702 |
|
| 703 |
if(feature_ptr != NULL) |
| 704 |
{ |
| 705 |
FREE(feature_ptr->libs); |
| 706 |
feature_ptr->libs = STRDUP(val); |
| 707 |
} |
| 708 |
FREE(val); |
| 709 |
} |
| 710 |
|
| 711 |
else if(!STRCASECMP(parm, "FeatureLIB_DIRS") || |
| 712 |
!STRCASECMP(parm, "FeatureLIBDIRS") || |
| 713 |
!STRCASECMP(parm, "FeatureLIB_DIR") || |
| 714 |
!STRCASECMP(parm, "FeatureLIBDIR") |
| 715 |
) |
| 716 |
{ |
| 717 |
char *val = FGETLINE(fp); |
| 718 |
|
| 719 |
PConfLoadPlatformsSanitizeLine(val); |
| 720 |
|
| 721 |
|
| 722 |
if(feature_ptr != NULL) |
| 723 |
{ |
| 724 |
FREE(feature_ptr->lib_dirs); |
| 725 |
feature_ptr->lib_dirs = STRDUP(val); |
| 726 |
} |
| 727 |
FREE(val); |
| 728 |
} |
| 729 |
|
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
else if(!STRCASECMP(parm, "PlatformSearchPathHeader") || |
| 734 |
!STRCASECMP(parm, "PlatformSearchPathInclude") || |
| 735 |
!STRCASECMP(parm, "PlatformSearchPathInc") |
| 736 |
) |
| 737 |
{ |
| 738 |
char *val = FGETLINE(fp); |
| 739 |
|
| 740 |
PConfLoadPlatformsSanitizeLine(val); |
| 741 |
|
| 742 |
|
| 743 |
if(platform_ptr != NULL) |
| 744 |
{ |
| 745 |
STRLISTAPPEND( |
| 746 |
&platform_ptr->path_header, |
| 747 |
&platform_ptr->total_path_headers, |
| 748 |
val |
| 749 |
); |
| 750 |
} |
| 751 |
FREE(val); |
| 752 |
} |
| 753 |
|
| 754 |
else if(!STRCASECMP(parm, "PlatformSearchPathLibrary") || |
| 755 |
!STRCASECMP(parm, "PlatformSearchPathLib") |
| 756 |
) |
| 757 |
{ |
| 758 |
char *val = FGETLINE(fp); |
| 759 |
|
| 760 |
PConfLoadPlatformsSanitizeLine(val); |
| 761 |
|
| 762 |
|
| 763 |
if(platform_ptr != NULL) |
| 764 |
{ |
| 765 |
STRLISTAPPEND( |
| 766 |
&platform_ptr->path_library, |
| 767 |
&platform_ptr->total_path_libraries, |
| 768 |
val |
| 769 |
); |
| 770 |
} |
| 771 |
FREE(val); |
| 772 |
} |
| 773 |
|
| 774 |
else if(!STRCASECMP(parm, "PlatformSearchPathConfiguration") || |
| 775 |
!STRCASECMP(parm, "PlatformSearchPathConfig") || |
| 776 |
!STRCASECMP(parm, "PlatformSearchPathEtc") |
| 777 |
) |
| 778 |
{ |
| 779 |
char *val = FGETLINE(fp); |
| 780 |
|
| 781 |
PConfLoadPlatformsSanitizeLine(val); |
| 782 |
|
| 783 |
|
| 784 |
if(platform_ptr != NULL) |
| 785 |
{ |
| 786 |
STRLISTAPPEND( |
| 787 |
&platform_ptr->path_config, |
| 788 |
&platform_ptr->total_path_configs, |
| 789 |
val |
| 790 |
); |
| 791 |
} |
| 792 |
FREE(val); |
| 793 |
} |
| 794 |
|
| 795 |
else if(!STRCASECMP(parm, "PlatformSearchPathProgram") || |
| 796 |
!STRCASECMP(parm, "PlatformSearchPathProg") || |
| 797 |
!STRCASECMP(parm, "PlatformSearchPathBin") |
| 798 |
) |
| 799 |
{ |
| 800 |
char *val = FGETLINE(fp); |
| 801 |
|
| 802 |
PConfLoadPlatformsSanitizeLine(val); |
| 803 |
|
| 804 |
|
| 805 |
if(platform_ptr != NULL) |
| 806 |
{ |
| 807 |
STRLISTAPPEND( |
| 808 |
&platform_ptr->path_program, |
| 809 |
&platform_ptr->total_path_programs, |
| 810 |
val |
| 811 |
); |
| 812 |
} |
| 813 |
FREE(val); |
| 814 |
} |
| 815 |
|
| 816 |
else if(!STRCASECMP(parm, "PlatformSearchPathData") || |
| 817 |
!STRCASECMP(parm, "PlatformSearchPathOther") |
| 818 |
) |
| 819 |
{ |
| 820 |
char *val = FGETLINE(fp); |
| 821 |
|
| 822 |
PConfLoadPlatformsSanitizeLine(val); |
| 823 |
|
| 824 |
|
| 825 |
if(platform_ptr != NULL) |
| 826 |
{ |
| 827 |
STRLISTAPPEND( |
| 828 |
&platform_ptr->path_data, |
| 829 |
&platform_ptr->total_path_datas, |
| 830 |
val |
| 831 |
); |
| 832 |
} |
| 833 |
FREE(val); |
| 834 |
} |
| 835 |
|
| 836 |
|
| 837 |
else if(!STRCASECMP(parm, "PlatformPREFIX") || |
| 838 |
!STRCASECMP(parm, "PREFIX") |
| 839 |
) |
| 840 |
{ |
| 841 |
char *val = FGETLINE(fp); |
| 842 |
|
| 843 |
PConfLoadPlatformsSanitizeLine(val); |
| 844 |
|
| 845 |
|
| 846 |
if(platform_ptr != NULL) |
| 847 |
{ |
| 848 |
FREE(platform_ptr->prefix); |
| 849 |
platform_ptr->prefix = STRDUP(val); |
| 850 |
} |
| 851 |
FREE(val); |
| 852 |
} |
| 853 |
|
| 854 |
else if(!STRCASECMP(parm, "PlatformCFLAGS") || |
| 855 |
!STRCASECMP(parm, "CFLAGS") |
| 856 |
) |
| 857 |
{ |
| 858 |
char *val = FGETLINE(fp); |
| 859 |
|
| 860 |
PConfLoadPlatformsSanitizeLine(val); |
| 861 |
|
| 862 |
|
| 863 |
if(platform_ptr != NULL) |
| 864 |
{ |
| 865 |
FREE(platform_ptr->cflags); |
| 866 |
platform_ptr->cflags = STRDUP(val); |
| 867 |
} |
| 868 |
FREE(val); |
| 869 |
} |
| 870 |
|
| 871 |
else if(!STRCASECMP(parm, "PlatformINC_DIRS") || |
| 872 |
!STRCASECMP(parm, "INC_DIRS") || |
| 873 |
!STRCASECMP(parm, "PlatformINC_DIR") || |
| 874 |
!STRCASECMP(parm, "INC_DIR") |
| 875 |
) |
| 876 |
{ |
| 877 |
char *val = FGETLINE(fp); |
| 878 |
|
| 879 |
PConfLoadPlatformsSanitizeLine(val); |
| 880 |
|
| 881 |
|
| 882 |
if(platform_ptr != NULL) |
| 883 |
{ |
| 884 |
FREE(platform_ptr->inc_dirs); |
| 885 |
platform_ptr->inc_dirs = STRDUP(val); |
| 886 |
} |
| 887 |
FREE(val); |
| 888 |
} |
| 889 |
|
| 890 |
else if(!STRCASECMP(parm, "PlatformLIBS") || |
| 891 |
!STRCASECMP(parm, "LIBS") |
| 892 |
) |
| 893 |
{ |
| 894 |
char *val = FGETLINE(fp); |
| 895 |
|
| 896 |
PConfLoadPlatformsSanitizeLine(val); |
| 897 |
|
| 898 |
|
| 899 |
if(platform_ptr != NULL) |
| 900 |
{ |
| 901 |
FREE(platform_ptr->libs); |
| 902 |
platform_ptr->libs = STRDUP(val); |
| 903 |
} |
| 904 |
FREE(val); |
| 905 |
} |
| 906 |
|
| 907 |
else if(!STRCASECMP(parm, "PlatformLIB_DIRS") || |
| 908 |
!STRCASECMP(parm, "LIB_DIRS") || |
| 909 |
!STRCASECMP(parm, "PlatformLIB_DIR") || |
| 910 |
!STRCASECMP(parm, "LIB_DIR") |
| 911 |
) |
| 912 |
{ |
| 913 |
char *val = FGETLINE(fp); |
| 914 |
|
| 915 |
PConfLoadPlatformsSanitizeLine(val); |
| 916 |
|
| 917 |
|
| 918 |
if(platform_ptr != NULL) |
| 919 |
{ |
| 920 |
FREE(platform_ptr->lib_dirs); |
| 921 |
platform_ptr->lib_dirs = STRDUP(val); |
| 922 |
} |
| 923 |
FREE(val); |
| 924 |
} |
| 925 |
|
| 926 |
else if(!STRCASECMP(parm, "PlatformCC") || |
| 927 |
!STRCASECMP(parm, "CC") |
| 928 |
) |
| 929 |
{ |
| 930 |
char *val = FGETLINE(fp); |
| 931 |
|
| 932 |
PConfLoadPlatformsSanitizeLine(val); |
| 933 |
|
| 934 |
|
| 935 |
if(platform_ptr != NULL) |
| 936 |
{ |
| 937 |
FREE(platform_ptr->cc); |
| 938 |
platform_ptr->cc = STRDUP(val); |
| 939 |
} |
| 940 |
FREE(val); |
| 941 |
} |
| 942 |
|
| 943 |
else if(!STRCASECMP(parm, "PlatformCPP") || |
| 944 |
!STRCASECMP(parm, "CPP") |
| 945 |
) |
| 946 |
{ |
| 947 |
char *val = FGETLINE(fp); |
| 948 |
|
| 949 |
PConfLoadPlatformsSanitizeLine(val); |
| 950 |
|
| 951 |
|
| 952 |
if(platform_ptr != NULL) |
| 953 |
{ |
| 954 |
FREE(platform_ptr->cpp); |
| 955 |
platform_ptr->cpp = STRDUP(val); |
| 956 |
} |
| 957 |
FREE(val); |
| 958 |
} |
| 959 |
|
| 960 |
|
| 961 |
else if(!STRCASECMP(parm, "MakefileOutput") || |
| 962 |
!STRCASECMP(parm, "MakefileOut") |
| 963 |
) |
| 964 |
{ |
| 965 |
char *val = FGETLINE(fp); |
| 966 |
|
| 967 |
PConfLoadPlatformsSanitizeLine(val); |
| 968 |
|
| 969 |
FREE(core_ptr->makefile_output); |
| 970 |
core_ptr->makefile_output = STRDUP(val); |
| 971 |
|
| 972 |
FREE(val); |
| 973 |
} |
| 974 |
|
| 975 |
else if(!STRCASECMP(parm, "MakefileInputPrepend") || |
| 976 |
!STRCASECMP(parm, "MakefileInputPre") || |
| 977 |
!STRCASECMP(parm, "MakefileInPrepend") || |
| 978 |
!STRCASECMP(parm, "MakefileInPre") |
| 979 |
) |
| 980 |
{ |
| 981 |
char *val = FGETLINE(fp); |
| 982 |
|
| 983 |
PConfLoadPlatformsSanitizeLine(val); |
| 984 |
|
| 985 |
FREE(core_ptr->makefile_input_prepend); |
| 986 |
core_ptr->makefile_input_prepend = STRDUP(val); |
| 987 |
|
| 988 |
FREE(val); |
| 989 |
} |
| 990 |
|
| 991 |
else if(!STRCASECMP(parm, "MakefileInputAppend") || |
| 992 |
!STRCASECMP(parm, "MakefileInAppend") |
| 993 |
) |
| 994 |
{ |
| 995 |
char *val = FGETLINE(fp); |
| 996 |
|
| 997 |
PConfLoadPlatformsSanitizeLine(val); |
| 998 |
|
| 999 |
FREE(core_ptr->makefile_input_append); |
| 1000 |
core_ptr->makefile_input_append = STRDUP(val); |
| 1001 |
|
| 1002 |
FREE(val); |
| 1003 |
} |
| 1004 |
|
| 1005 |
else if(!STRCASECMP(parm, "ThisPlatformInfo")) |
| 1006 |
{ |
| 1007 |
char *val = FGETLINE(fp); |
| 1008 |
|
| 1009 |
PConfLoadPlatformsSanitizeLine(val); |
| 1010 |
|
| 1011 |
if(PConfLoadThisPlatformFromFile(core_ptr, val)) |
| 1012 |
{ |
| 1013 |
fprintf(stderr, |
| 1014 |
"%s: Could not read this site platform information file.\n", |
| 1015 |
val |
| 1016 |
); |
| 1017 |
} |
| 1018 |
|
| 1019 |
FREE(val); |
| 1020 |
} |
| 1021 |
|
| 1022 |
|
| 1023 |
else if(!STRCASECMP(parm, "MessageConfigurationStartup") || |
| 1024 |
!STRCASECMP(parm, "MessageConfiguringStartup") || |
| 1025 |
!STRCASECMP(parm, "MessageConfigStartup") |
| 1026 |
) |
| 1027 |
{ |
| 1028 |
char *val = FGETLINE(fp); |
| 1029 |
|
| 1030 |
PConfLoadPlatformsSanitizeLine(val); |
| 1031 |
|
| 1032 |
FREE(core_ptr->message_configure_startup); |
| 1033 |
core_ptr->message_configure_startup = STRDUP(val); |
| 1034 |
|
| 1035 |
FREE(val); |
| 1036 |
} |
| 1037 |
|
| 1038 |
else if(!STRCASECMP(parm, "MessagePlatformUnsupported")) |
| 1039 |
{ |
| 1040 |
char *val = FGETLINE(fp); |
| 1041 |
|
| 1042 |
PConfLoadPlatformsSanitizeLine(val); |
| 1043 |
|
| 1044 |
FREE(core_ptr->message_platform_unsupported); |
| 1045 |
core_ptr->message_platform_unsupported = STRDUP(val); |
| 1046 |
|
| 1047 |
FREE(val); |
| 1048 |
} |
| 1049 |
|
| 1050 |
else if(!STRCASECMP(parm, "MessageDependencyFailed") || |
| 1051 |
!STRCASECMP(parm, "MessageDependentFailed") || |
| 1052 |
!STRCASECMP(parm, "MessageDependFailed") |
| 1053 |
) |
| 1054 |
{ |
| 1055 |
char *val = FGETLINE(fp); |
| 1056 |
|
| 1057 |
PConfLoadPlatformsSanitizeLine(val); |
| 1058 |
|
| 1059 |
FREE(core_ptr->message_depend_failed); |
| 1060 |
core_ptr->message_depend_failed = STRDUP(val); |
| 1061 |
|
| 1062 |
FREE(val); |
| 1063 |
} |
| 1064 |
|
| 1065 |
else if(!STRCASECMP(parm, "MessageSuccess") || |
| 1066 |
!STRCASECMP(parm, "MessageSucc") |
| 1067 |
) |
| 1068 |
{ |
| 1069 |
char *val = FGETLINE(fp); |
| 1070 |
|
| 1071 |
PConfLoadPlatformsSanitizeLine(val); |
| 1072 |
|
| 1073 |
FREE(core_ptr->message_success); |
| 1074 |
core_ptr->message_success = STRDUP(val); |
| 1075 |
|
| 1076 |
FREE(val); |
| 1077 |
} |
| 1078 |
|
| 1079 |
|
| 1080 |
|
| 1081 |
else |
| 1082 |
{ |
| 1083 |
if(core_ptr->warnings) |
| 1084 |
fprintf( |
| 1085 |
stderr, |
| 1086 |
"%s: Unsupported parameter `%s'.\n", |
| 1087 |
filename, parm |
| 1088 |
); |
| 1089 |
FSEEKNEXTLINE(fp); |
| 1090 |
} |
| 1091 |
|
| 1092 |
} while(1); |
| 1093 |
|
| 1094 |
|
| 1095 |
FCLOSE(fp); |
| 1096 |
fp = NULL; |
| 1097 |
|
| 1098 |
DO_RESET_CONTEXT_PTRS |
| 1099 |
|
| 1100 |
#undef DO_RESET_CONTEXT_PTRS |
| 1101 |
|
| 1102 |
return(0); |
| 1103 |
} |
| 1104 |
|
| 1105 |
|
| 1106 |
|
| 1107 |
|
| 1108 |
|
| 1109 |
|
| 1110 |
|
| 1111 |
|
| 1112 |
int PConfLoadThisPlatformFromFile( |
| 1113 |
pconf_core_struct *core_ptr, const char *filename |
| 1114 |
) |
| 1115 |
{ |
| 1116 |
FILE *fp; |
| 1117 |
char *buf; |
| 1118 |
|
| 1119 |
|
| 1120 |
if((core_ptr == NULL) || (filename == NULL)) |
| 1121 |
return(-1); |
| 1122 |
|
| 1123 |
fp = FOPEN(filename, "rb"); |
| 1124 |
if(fp == NULL) |
| 1125 |
return(-1); |
| 1126 |
|
| 1127 |
|
| 1128 |
|
| 1129 |
|
| 1130 |
|
| 1131 |
buf = FGETLINE(fp); |
| 1132 |
if(buf != NULL) |
| 1133 |
{ |
| 1134 |
FREE(core_ptr->os_name); |
| 1135 |
core_ptr->os_name = STRDUP(buf); |
| 1136 |
} |
| 1137 |
FREE(buf); |
| 1138 |
|
| 1139 |
|
| 1140 |
buf = FGETLINE(fp); |
| 1141 |
if(buf != NULL) |
| 1142 |
{ |
| 1143 |
|
| 1144 |
} |
| 1145 |
FREE(buf); |
| 1146 |
|
| 1147 |
|
| 1148 |
buf = FGETLINE(fp); |
| 1149 |
if(buf != NULL) |
| 1150 |
{ |
| 1151 |
FREE(core_ptr->machine_name); |
| 1152 |
core_ptr->machine_name = STRDUP(buf); |
| 1153 |
} |
| 1154 |
FREE(buf); |
| 1155 |
|
| 1156 |
|
| 1157 |
|
| 1158 |
|
| 1159 |
|
| 1160 |
FCLOSE(fp); |
| 1161 |
fp = NULL; |
| 1162 |
|
| 1163 |
return(0); |
| 1164 |
} |
| 1165 |
|
| 1166 |
|
| 1167 |
|
| 1168 |
|
| 1169 |
|
| 1170 |
|
| 1171 |
void PConfGenerateOutputMakefile( |
| 1172 |
pconf_core_struct *core_ptr, platform_struct *platform_ptr |
| 1173 |
) |
| 1174 |
{ |
| 1175 |
int i; |
| 1176 |
FILE *fp_in, *fp_out; |
| 1177 |
const char *makefile_output, |
| 1178 |
*makefile_input_prepend, |
| 1179 |
*makefile_input_append; |
| 1180 |
feature_struct *feature_ptr; |
| 1181 |
|
| 1182 |
|
| 1183 |
if((core_ptr == NULL) || (platform_ptr == NULL)) |
| 1184 |
return; |
| 1185 |
|
| 1186 |
makefile_output = (const char *)core_ptr->makefile_output; |
| 1187 |
makefile_input_prepend = (const char *)core_ptr->makefile_input_prepend; |
| 1188 |
makefile_input_append = (const char *)core_ptr->makefile_input_append; |
| 1189 |
|
| 1190 |
|
| 1191 |
if(makefile_output == NULL) |
| 1192 |
makefile_output = "Makefile"; |
| 1193 |
|
| 1194 |
|
| 1195 |
fp_out = FOPEN(makefile_output, "w"); |
| 1196 |
if(fp_out == NULL) |
| 1197 |
{ |
| 1198 |
|
| 1199 |
fprintf( |
| 1200 |
stderr, |
| 1201 |
"%s: Cannot create.\n", |
| 1202 |
makefile_output |
| 1203 |
); |
| 1204 |
return; |
| 1205 |
} |
| 1206 |
|
| 1207 |
|
| 1208 |
printf("Generating output Makefile `%s'...\n", |
| 1209 |
makefile_output |
| 1210 |
); |
| 1211 |
|
| 1212 |
|
| 1213 |
|
| 1214 |
fp_in = FOPEN(makefile_input_prepend, "rb"); |
| 1215 |
if(fp_in != NULL) |
| 1216 |
{ |
| 1217 |
int c; |
| 1218 |
|
| 1219 |
do |
| 1220 |
{ |
| 1221 |
c = FGETC(fp_in); |
| 1222 |
if(c == EOF) |
| 1223 |
break; |
| 1224 |
|
| 1225 |
FPUTC(c, fp_out); |
| 1226 |
|
| 1227 |
} while(1); |
| 1228 |
|
| 1229 |
FCLOSE(fp_in); |
| 1230 |
fp_in = NULL; |
| 1231 |
} |
| 1232 |
|
| 1233 |
|
| 1234 |
|
| 1235 |
|
| 1236 |
|
| 1237 |
|
| 1238 |
if(platform_ptr->prefix != NULL) |
| 1239 |
{ |
| 1240 |
fprintf(fp_out, |
| 1241 |
"PREFIX = %s", |
| 1242 |
platform_ptr->prefix |
| 1243 |
); |
| 1244 |
FPUTC('\n', fp_out); |
| 1245 |
FPUTC('\n', fp_out); |
| 1246 |
} |
| 1247 |
|
| 1248 |
|
| 1249 |
fprintf(fp_out, |
| 1250 |
"CFLAGS =" |
| 1251 |
); |
| 1252 |
if(platform_ptr->cflags != NULL) |
| 1253 |
fprintf(fp_out, |
| 1254 |
" %s", |
| 1255 |
platform_ptr->cflags |
| 1256 |
); |
| 1257 |
for(i = 0; i < platform_ptr->total_features; i++) |
| 1258 |
{ |
| 1259 |
feature_ptr = platform_ptr->feature[i]; |
| 1260 |
if(feature_ptr == NULL) |
| 1261 |
continue; |
| 1262 |
|
| 1263 |
if(feature_ptr->must_exist != PCONF_MUST_EXIST_YES) |
| 1264 |
continue; |
| 1265 |
|
| 1266 |
if(feature_ptr->cflags != NULL) |
| 1267 |
fprintf(fp_out, |
| 1268 |
" %s", |
| 1269 |
feature_ptr->cflags |
| 1270 |
); |
| 1271 |
} |
| 1272 |
FPUTC('\n', fp_out); |
| 1273 |
FPUTC('\n', fp_out); |
| 1274 |
|
| 1275 |
|
| 1276 |
fprintf(fp_out, |
| 1277 |
"INC_DIRS =" |
| 1278 |
); |
| 1279 |
if(platform_ptr->inc_dirs != NULL) |
| 1280 |
fprintf(fp_out, |
| 1281 |
" %s", |
| 1282 |
platform_ptr->inc_dirs |
| 1283 |
); |
| 1284 |
for(i = 0; i < platform_ptr->total_features; i++) |
| 1285 |
{ |
| 1286 |
feature_ptr = platform_ptr->feature[i]; |
| 1287 |
if(feature_ptr == NULL) |
| 1288 |
continue; |
| 1289 |
|
| 1290 |
if(feature_ptr->must_exist != PCONF_MUST_EXIST_YES) |
| 1291 |
continue; |
| 1292 |
|
| 1293 |
if(feature_ptr->inc_dirs != NULL) |
| 1294 |
fprintf(fp_out, |
| 1295 |
" %s", |
| 1296 |
feature_ptr->inc_dirs |
| 1297 |
); |
| 1298 |
} |
| 1299 |
FPUTC('\n', fp_out); |
| 1300 |
FPUTC('\n', fp_out); |
| 1301 |
|
| 1302 |
|
| 1303 |
|
| 1304 |
fprintf(fp_out, |
| 1305 |
"LIBS =" |
| 1306 |
); |
| 1307 |
if(platform_ptr->libs != NULL) |
| 1308 |
fprintf(fp_out, |
| 1309 |
" %s", |
| 1310 |
platform_ptr->libs |
| 1311 |
); |
| 1312 |
for(i = 0; i < platform_ptr->total_features; i++) |
| 1313 |
{ |
| 1314 |
feature_ptr = platform_ptr->feature[i]; |
| 1315 |
if(feature_ptr == NULL) |
| 1316 |
continue; |
| 1317 |
|
| 1318 |
if(feature_ptr->must_exist != PCONF_MUST_EXIST_YES) |
| 1319 |
continue; |
| 1320 |
|
| 1321 |
if(feature_ptr->libs != NULL) |
| 1322 |
fprintf(fp_out, |
| 1323 |
" %s", |
| 1324 |
feature_ptr->libs |
| 1325 |
); |
| 1326 |
} |
| 1327 |
FPUTC('\n', fp_out); |
| 1328 |
FPUTC('\n', fp_out); |
| 1329 |
|
| 1330 |
|
| 1331 |
|
| 1332 |
fprintf(fp_out, |
| 1333 |
"LIB_DIRS =" |
| 1334 |
); |
| 1335 |
if(platform_ptr->lib_dirs != NULL) |
| 1336 |
fprintf(fp_out, |
| 1337 |
" %s", |
| 1338 |
platform_ptr->lib_dirs |
| 1339 |
); |
| 1340 |
for(i = 0; i < platform_ptr->total_features; i++) |
| 1341 |
{ |
| 1342 |
feature_ptr = platform_ptr->feature[i]; |
| 1343 |
if(feature_ptr == NULL) |
| 1344 |
continue; |
| 1345 |
|
| 1346 |
if(feature_ptr->must_exist != PCONF_MUST_EXIST_YES) |
| 1347 |
continue; |
| 1348 |
|
| 1349 |
if(feature_ptr->lib_dirs != NULL) |
| 1350 |
fprintf(fp_out, |
| 1351 |
" %s", |
| 1352 |
feature_ptr->lib_dirs |
| 1353 |
); |
| 1354 |
} |
| 1355 |
FPUTC('\n', fp_out); |
| 1356 |
FPUTC('\n', fp_out); |
| 1357 |
|
| 1358 |
|
| 1359 |
if(platform_ptr->cc != NULL) |
| 1360 |
{ |
| 1361 |
fprintf(fp_out, |
| 1362 |
"CC = %s", |
| 1363 |
platform_ptr->cc |
| 1364 |
); |
| 1365 |
FPUTC('\n', fp_out); |
| 1366 |
FPUTC('\n', fp_out); |
| 1367 |
} |
| 1368 |
|
| 1369 |
if(platform_ptr->cpp != NULL) |
| 1370 |
{ |
| 1371 |
fprintf(fp_out, |
| 1372 |
"CPP = %s", |
| 1373 |
platform_ptr->cpp |
| 1374 |
); |
| 1375 |
FPUTC('\n', fp_out); |
| 1376 |
FPUTC('\n', fp_out); |
| 1377 |
} |
| 1378 |
|
| 1379 |
|
| 1380 |
|
| 1381 |
|
| 1382 |
fp_in = FOPEN(makefile_input_append, "rb"); |
| 1383 |
if(fp_in != NULL) |
| 1384 |
{ |
| 1385 |
int c; |
| 1386 |
|
| 1387 |
do |
| 1388 |
{ |
| 1389 |
c = FGETC(fp_in); |
| 1390 |
if(c == EOF) |
| 1391 |
break; |
| 1392 |
|
| 1393 |
FPUTC(c, fp_out); |
| 1394 |
|
| 1395 |
} while(1); |
| 1396 |
|
| 1397 |
FCLOSE(fp_in); |
| 1398 |
fp_in = NULL; |
| 1399 |
} |
| 1400 |
|
| 1401 |
|
| 1402 |
|
| 1403 |
FCLOSE(fp_out); |
| 1404 |
fp_out = NULL; |
| 1405 |
|
| 1406 |
return; |
| 1407 |
} |