зеркало из https://github.com/mozilla/pjs.git
Rebuild .xpt files when included .idl files change r=bsmedberg sr=shaver
This commit is contained in:
Родитель
c253576018
Коммит
6291f9a642
|
@ -254,8 +254,12 @@ LIBOBJS := $(addsuffix \", $(LIBOBJS))
|
|||
endif
|
||||
|
||||
ifndef MOZ_AUTO_DEPS
|
||||
ifneq (,$(OBJS)$(SIMPLE_PROGRAMS))
|
||||
ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
|
||||
MDDEPFILES = $(addprefix $(MDDEPDIR)/,$(OBJS:.$(OBJ_SUFFIX)=.pp))
|
||||
ifndef NO_GEN_XPT
|
||||
MDDEPFILES += $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.xpt)) \
|
||||
$(addprefix $(MDDEPDIR)/,$(SDK_XPIDLSRCS:.idl=.xpt))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -359,7 +363,7 @@ HOST_PROGOBJS = $(HOST_OBJS)
|
|||
endif
|
||||
|
||||
# MAKE_DIRS: List of directories to build while looping over directories.
|
||||
ifneq (,$(OBJS)$(SIMPLE_PROGRAMS))
|
||||
ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
|
||||
MAKE_DIRS += $(MDDEPDIR)
|
||||
GARBAGE_DIRS += $(MDDEPDIR)
|
||||
endif
|
||||
|
@ -1318,7 +1322,7 @@ ifndef NO_GEN_XPT
|
|||
# into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
|
||||
$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
|
||||
$(REPORT_BUILD)
|
||||
$(ELOG) $(XPIDL_COMPILE) -m typelib -w -I $(IDL_DIR) -I$(srcdir) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
|
||||
$(ELOG) $(XPIDL_COMPILE) -m typelib -w -I $(IDL_DIR) -I$(srcdir) -e $@ -d $(MDDEPDIR)/$*.pp $(_VPATH_SRCS)
|
||||
|
||||
# no need to link together if XPIDLSRCS contains only XPIDL_MODULE
|
||||
ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))
|
||||
|
@ -1652,7 +1656,7 @@ $(MDDEPDIR)/%.pp: %.s
|
|||
$(REPORT_BUILD)
|
||||
@$(MAKE_DEPS_NOAUTO)
|
||||
|
||||
ifneq (,$(OBJS)$(SIMPLE_PROGRAMS))
|
||||
ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
|
||||
depend:: $(SUBMAKEFILES) $(MAKE_DIRS) $(MDDEPFILES)
|
||||
else
|
||||
depend:: $(SUBMAKEFILES)
|
||||
|
@ -1679,7 +1683,7 @@ endif # COMPILER_DEPEND
|
|||
$(MDDEPDIR):
|
||||
@if test ! -d $@; then echo Creating $@; rm -rf $@; mkdir $@; else true; fi
|
||||
|
||||
ifneq (,$(OBJS)$(SIMPLE_PROGRAMS))
|
||||
ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
|
||||
MDDEPEND_FILES := $(strip $(wildcard $(MDDEPDIR)/*.pp))
|
||||
|
||||
ifneq (,$(MDDEPEND_FILES))
|
||||
|
|
|
@ -65,13 +65,14 @@ gboolean enable_warnings = FALSE;
|
|||
gboolean verbose_mode = FALSE;
|
||||
gboolean emit_typelib_annotations = FALSE;
|
||||
gboolean explicit_output_filename = FALSE;
|
||||
FILE *deps = NULL;
|
||||
|
||||
/* The following globals are explained in xpt_struct.h */
|
||||
PRUint8 major_version = XPT_MAJOR_VERSION;
|
||||
PRUint8 minor_version = XPT_MINOR_VERSION;
|
||||
|
||||
static char xpidl_usage_str[] =
|
||||
"Usage: %s -m mode [-w] [-v] [-t version number]\n"
|
||||
"Usage: %s -m mode [-w] [-v] [-t version number] [-d filename.pp]\n"
|
||||
" [-I path] [-o basename | -e filename.ext] filename.idl\n"
|
||||
" -a emit annotations to typelib\n"
|
||||
" -w turn on warnings (recommended)\n"
|
||||
|
@ -80,6 +81,7 @@ static char xpidl_usage_str[] =
|
|||
" -I add entry to start of include path for ``#include \"nsIThing.idl\"''\n"
|
||||
" -o use basename (e.g. ``/tmp/nsIThing'') for output\n"
|
||||
" -e use explicit output filename\n"
|
||||
" -d write dependencies (requires -e)\n"
|
||||
" -m specify output mode:\n";
|
||||
|
||||
static void
|
||||
|
@ -227,6 +229,21 @@ int main(int argc, char *argv[])
|
|||
file_basename = argv[++i];
|
||||
explicit_output_filename = TRUE;
|
||||
break;
|
||||
case 'd':
|
||||
if (!explicit_output_filename) {
|
||||
fprintf(stderr, "ERROR: -d requires -e\n");
|
||||
xpidl_usage(argc, argv);
|
||||
return 1;
|
||||
}
|
||||
if (i == argc) {
|
||||
fprintf(stderr, "ERROR: missing filename after -d\n");
|
||||
xpidl_usage(argc, argv);
|
||||
return 1;
|
||||
}
|
||||
deps = fopen(argv[++i], "w");
|
||||
if (deps)
|
||||
fprintf(deps, "%s:", file_basename);
|
||||
break;
|
||||
case 'm':
|
||||
if (i + 1 == argc) {
|
||||
fprintf(stderr, "ERROR: missing modename after -m\n");
|
||||
|
@ -268,8 +285,12 @@ int main(int argc, char *argv[])
|
|||
* Don't try to process multiple files, given that we don't handle -o
|
||||
* multiply.
|
||||
*/
|
||||
if (xpidl_process_idl(argv[i], inc_head, file_basename, mode))
|
||||
return 0;
|
||||
i = xpidl_process_idl(argv[i], inc_head, file_basename, mode);
|
||||
|
||||
return 1;
|
||||
if (deps) {
|
||||
fprintf(deps, "\n");
|
||||
fclose(deps);
|
||||
}
|
||||
|
||||
return !i;
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ extern gboolean enable_warnings;
|
|||
extern gboolean verbose_mode;
|
||||
extern gboolean emit_typelib_annotations;
|
||||
extern gboolean explicit_output_filename;
|
||||
extern FILE *deps;
|
||||
|
||||
extern PRUint8 major_version;
|
||||
extern PRUint8 minor_version;
|
||||
|
|
|
@ -125,29 +125,33 @@ typedef struct input_callback_state {
|
|||
} input_callback_state;
|
||||
|
||||
static FILE *
|
||||
fopen_from_includes(const char *filename, const char *mode,
|
||||
fopen_from_includes(char **filename, const char *mode,
|
||||
IncludePathEntry *include_path)
|
||||
{
|
||||
IncludePathEntry *current_path = include_path;
|
||||
char *pathname;
|
||||
FILE *inputfile;
|
||||
if (!strcmp(filename, "-"))
|
||||
if (!strcmp(*filename, "-"))
|
||||
return stdin;
|
||||
|
||||
if (filename[0] != '/') {
|
||||
if ((*filename)[0] != '/') {
|
||||
while (current_path) {
|
||||
pathname = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s",
|
||||
current_path->directory, filename);
|
||||
current_path->directory, *filename);
|
||||
if (!pathname)
|
||||
return NULL;
|
||||
inputfile = fopen(pathname, mode);
|
||||
g_free(pathname);
|
||||
if (inputfile)
|
||||
if (inputfile) {
|
||||
free(*filename);
|
||||
*filename = xpidl_strdup(pathname);
|
||||
g_free(pathname);
|
||||
return inputfile;
|
||||
}
|
||||
g_free(pathname);
|
||||
current_path = current_path->next;
|
||||
}
|
||||
} else {
|
||||
inputfile = fopen(filename, mode);
|
||||
inputfile = fopen(*filename, mode);
|
||||
if (inputfile)
|
||||
return inputfile;
|
||||
}
|
||||
|
@ -159,7 +163,7 @@ extern FILE* mac_fopen(const char* filename, const char *mode);
|
|||
#endif
|
||||
|
||||
static input_data *
|
||||
new_input_data(const char *filename, IncludePathEntry *include_path)
|
||||
new_input_data(char **filename, IncludePathEntry *include_path)
|
||||
{
|
||||
input_data *new_data;
|
||||
FILE *inputfile;
|
||||
|
@ -172,14 +176,14 @@ new_input_data(const char *filename, IncludePathEntry *include_path)
|
|||
|
||||
#if defined(XP_MAC) && defined(XPIDL_PLUGIN)
|
||||
/* on Mac, fopen knows how to find files. */
|
||||
inputfile = fopen(filename, "r");
|
||||
inputfile = fopen(*filename, "r");
|
||||
#elif defined(XP_OS2) || defined(XP_WIN32)
|
||||
/*
|
||||
* if filename is fully qualified (starts with driver letter), then
|
||||
* just call fopen(); else, go with fopen_from_includes()
|
||||
*/
|
||||
if( filename[1] == ':' )
|
||||
inputfile = fopen(filename, "r");
|
||||
inputfile = fopen(*filename, "r");
|
||||
else
|
||||
inputfile = fopen_from_includes(filename, "r", include_path);
|
||||
#else
|
||||
|
@ -243,11 +247,14 @@ new_input_data(const char *filename, IncludePathEntry *include_path)
|
|||
new_data->point = new_data->buf = buffer;
|
||||
new_data->max = buffer + offset;
|
||||
*new_data->max = '\0';
|
||||
new_data->filename = xpidl_strdup(filename);
|
||||
new_data->filename = *filename;
|
||||
/* libIDL expects the line number to be that of the *next* line */
|
||||
new_data->lineno = 2;
|
||||
new_data->next = NULL;
|
||||
|
||||
if (deps)
|
||||
fprintf(deps, " \\\n\t%s", *filename);
|
||||
|
||||
return new_data;
|
||||
}
|
||||
|
||||
|
@ -412,7 +419,8 @@ NextIsInclude(input_callback_state *callback_state, char **startp,
|
|||
filename = xpidl_strdup(filename);
|
||||
g_hash_table_insert(callback_state->already_included,
|
||||
filename, (void *)TRUE);
|
||||
new_data = new_input_data(filename, callback_state->include_path);
|
||||
filename = xpidl_strdup(filename);
|
||||
new_data = new_input_data(&filename, callback_state->include_path);
|
||||
if (!new_data) {
|
||||
char *error_message;
|
||||
IDL_file_get(&scratch, (int *)&data->lineno);
|
||||
|
@ -422,6 +430,7 @@ NextIsInclude(input_callback_state *callback_state, char **startp,
|
|||
msg_callback(IDL_ERROR, 0,
|
||||
data->lineno, scratch, error_message);
|
||||
g_free(error_message);
|
||||
free(filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -484,10 +493,11 @@ input_callback(IDL_input_reason reason, union IDL_input_data *cb_data,
|
|||
input_data *new_data = NULL;
|
||||
unsigned int len, copy;
|
||||
int rv;
|
||||
char *start;
|
||||
char *start, *filename;
|
||||
|
||||
switch(reason) {
|
||||
case IDL_INPUT_REASON_INIT:
|
||||
filename = xpidl_strdup(cb_data->init.filename);
|
||||
if (data == NULL || data->next == NULL) {
|
||||
/*
|
||||
* This is the first file being processed. As it's the target
|
||||
|
@ -503,15 +513,15 @@ input_callback(IDL_input_reason reason, union IDL_input_data *cb_data,
|
|||
first_entry.directory = callback_state->include_path->directory;
|
||||
first_entry.next = NULL;
|
||||
|
||||
new_data = new_input_data(cb_data->init.filename,
|
||||
&first_entry);
|
||||
new_data = new_input_data(&filename, &first_entry);
|
||||
} else {
|
||||
new_data = new_input_data(cb_data->init.filename,
|
||||
callback_state->include_path);
|
||||
new_data = new_input_data(&filename, callback_state->include_path);
|
||||
}
|
||||
|
||||
if (!new_data)
|
||||
if (!new_data) {
|
||||
free(filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
IDL_file_set(new_data->filename, (int)new_data->lineno);
|
||||
callback_state->input_stack = new_data;
|
||||
|
|
Загрузка…
Ссылка в новой задаче