/* dependency file generation
Copyright 2005 Craig Franklin
*/
#include "stdhdr.h"
#include "libgputils.h"
#include "gpasm.h"
/*------------------------------------------------------------------------------------------------*/
void
deps_init(void)
{
const char *tail;
char output_file[BUFSIZ];
if (state.dep_file != OUT_NAMED) {
snprintf(state.dep_file_name, sizeof(state.dep_file_name), "%s.d", state.base_file_name);
}
if (state.dep_file == OUT_SUPPRESS) {
state.dep.enabled = false;
return;
}
state.dep.f = fopen(state.dep_file_name, "w");
if (state.dep.f == NULL) {
perror(state.dep_file_name);
exit(1);
}
state.dep.enabled = true;
/* Output file names may not be setup, so make one. */
tail = (state.mode == MODE_RELOCATABLE) ? "o" : "hex";
snprintf(output_file, sizeof(output_file), "%s.%s", state.base_file_name, tail);
fprintf(state.dep.f, "%s : ", output_file);
}
/*------------------------------------------------------------------------------------------------*/
void
deps_add(const char *File_name)
{
if (state.dep.enabled) {
fprintf(state.dep.f, " \\\n %s", File_name);
}
}
/*------------------------------------------------------------------------------------------------*/
void
deps_close(void)
{
if (state.dep.enabled) {
fprintf(state.dep.f, "\n");
fclose(state.dep.f);
}
}
Vorgefundene Kodierung: UTF-8 | 0
|