Merge pull request #32 from kwwette/depend-phony
Add -MP option for generating phony targets for all dependencies
This commit is contained in:
commit
28c033dd90
2 changed files with 24 additions and 2 deletions
|
|
@ -5,6 +5,12 @@ See the RELEASENOTES file for a summary of changes in each release.
|
||||||
Version 2.0.10 (in progress)
|
Version 2.0.10 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
2013-04-08: kwwette
|
||||||
|
Add -MP option to SWIG for generating phony targets for all dependencies.
|
||||||
|
- Prevents make from complaining if header files have been deleted before
|
||||||
|
the dependency file has been updated.
|
||||||
|
- Modelled on similar option in GCC.
|
||||||
|
|
||||||
2013-04-09: olly
|
2013-04-09: olly
|
||||||
[PHP] Add missing directorin typemap for char* and char[] which
|
[PHP] Add missing directorin typemap for char* and char[] which
|
||||||
fixes director_string testcase failure.
|
fixes director_string testcase failure.
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ static const char *usage2 = (const char *) "\
|
||||||
-MM - List dependencies, but omit files in SWIG library\n\
|
-MM - List dependencies, but omit files in SWIG library\n\
|
||||||
-MMD - Like `-MD', but omit files in SWIG library\n\
|
-MMD - Like `-MD', but omit files in SWIG library\n\
|
||||||
-module <name> - Set module name to <name>\n\
|
-module <name> - Set module name to <name>\n\
|
||||||
|
-MP - Generate phony targets for all dependencies\n\
|
||||||
-MT <target> - Set the target of the rule emitted by dependency generation\n\
|
-MT <target> - Set the target of the rule emitted by dependency generation\n\
|
||||||
-nocontract - Turn off contract checking\n\
|
-nocontract - Turn off contract checking\n\
|
||||||
-nocpperraswarn - Do not treat the preprocessor #error statement as #warning\n\
|
-nocpperraswarn - Do not treat the preprocessor #error statement as #warning\n\
|
||||||
|
|
@ -185,6 +186,7 @@ static int dump_classes = 0;
|
||||||
static int werror = 0;
|
static int werror = 0;
|
||||||
static int depend = 0;
|
static int depend = 0;
|
||||||
static int depend_only = 0;
|
static int depend_only = 0;
|
||||||
|
static int depend_phony = 0;
|
||||||
static int memory_debug = 0;
|
static int memory_debug = 0;
|
||||||
static int allkw = 0;
|
static int allkw = 0;
|
||||||
static DOH *cpps = 0;
|
static DOH *cpps = 0;
|
||||||
|
|
@ -712,6 +714,9 @@ void SWIG_getoptions(int argc, char *argv[]) {
|
||||||
} else if (strcmp(argv[i], "-MMD") == 0) {
|
} else if (strcmp(argv[i], "-MMD") == 0) {
|
||||||
depend = 2;
|
depend = 2;
|
||||||
Swig_mark_arg(i);
|
Swig_mark_arg(i);
|
||||||
|
} else if (strcmp(argv[i], "-MP") == 0) {
|
||||||
|
depend_phony = 1;
|
||||||
|
Swig_mark_arg(i);
|
||||||
} else if (strcmp(argv[i], "-MT") == 0) {
|
} else if (strcmp(argv[i], "-MT") == 0) {
|
||||||
Swig_mark_arg(i);
|
Swig_mark_arg(i);
|
||||||
if (argv[i + 1]) {
|
if (argv[i + 1]) {
|
||||||
|
|
@ -1101,22 +1106,33 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
Printf(f_dependencies_file, "%s: ", outfile);
|
Printf(f_dependencies_file, "%s: ", outfile);
|
||||||
}
|
}
|
||||||
List *files = Preprocessor_depend();
|
List *files = Preprocessor_depend();
|
||||||
|
List *phony_targets = NewList();
|
||||||
for (int i = 0; i < Len(files); i++) {
|
for (int i = 0; i < Len(files); i++) {
|
||||||
int use_file = 1;
|
int use_file = 1;
|
||||||
if (depend == 2) {
|
if (depend == 2) {
|
||||||
if ((Strncmp(Getitem(files, i), SwigLib, Len(SwigLib)) == 0) || (SwigLibWinUnix && (Strncmp(Getitem(files, i), SwigLibWinUnix, Len(SwigLibWinUnix)) == 0)))
|
if ((Strncmp(Getitem(files, i), SwigLib, Len(SwigLib)) == 0) || (SwigLibWinUnix && (Strncmp(Getitem(files, i), SwigLibWinUnix, Len(SwigLibWinUnix)) == 0)))
|
||||||
use_file = 0;
|
use_file = 0;
|
||||||
}
|
}
|
||||||
if (use_file)
|
if (use_file) {
|
||||||
Printf(f_dependencies_file, "\\\n %s ", Getitem(files, i));
|
Printf(f_dependencies_file, "\\\n %s ", Getitem(files, i));
|
||||||
|
if (depend_phony)
|
||||||
|
Append(phony_targets, Getitem(files, i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Printf(f_dependencies_file, "\n");
|
Printf(f_dependencies_file, "\n");
|
||||||
|
if (depend_phony) {
|
||||||
|
for (int i = 0; i < Len(phony_targets); i++) {
|
||||||
|
Printf(f_dependencies_file, "\n%s:\n", Getitem(phony_targets, i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (f_dependencies_file != stdout)
|
if (f_dependencies_file != stdout)
|
||||||
Delete(f_dependencies_file);
|
Delete(f_dependencies_file);
|
||||||
if (depend_only)
|
if (depend_only)
|
||||||
SWIG_exit(EXIT_SUCCESS);
|
SWIG_exit(EXIT_SUCCESS);
|
||||||
Delete(inputfile_filename);
|
Delete(inputfile_filename);
|
||||||
Delete(basename);
|
Delete(basename);
|
||||||
|
Delete(phony_targets);
|
||||||
} else {
|
} else {
|
||||||
Printf(stderr, "Cannot generate dependencies with -nopreprocess\n");
|
Printf(stderr, "Cannot generate dependencies with -nopreprocess\n");
|
||||||
// Actually we could but it would be inefficient when just generating dependencies, as it would be done after Swig_cparse
|
// Actually we could but it would be inefficient when just generating dependencies, as it would be done after Swig_cparse
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue