41 Name name; /* Name of variable */
42 struct _Depvar *next; /* Linked list */
43 Boolean cmdline; /* Macro defined on the cmdline? */
44 };
45
46 typedef struct _Depvar *Depvar;
47
48 static Depvar depvar_list;
49 static Depvar *bpatch = &depvar_list;
50 static Boolean variant_deps;
51
52 /*
53 * Add a name to the list.
54 */
55
56 void
57 depvar_add_to_list(Name name, Boolean cmdline)
58 {
59 Depvar dv;
60
61 #ifdef SUNOS4_AND_AFTER
62 dv = ALLOC(Depvar);
63 #else
64 dv = (Depvar) Malloc(sizeof(struct _Depvar));
65 #endif
66 dv->name = name;
67 dv->next = NULL;
68 dv->cmdline = cmdline;
69 *bpatch = dv;
70 bpatch = &dv->next;
71 }
72
73 /*
74 * The macro `name' has been used in either the left-hand or
75 * right-hand side of a dependency. See if it is in the
76 * list. Two things are looked for. Names given as args
77 * to the -V list are checked so as to set the same/differ
78 * output for the -P option. Names given as macro=value
79 * command-line args are checked and, if found, an NSE
80 * warning is produced.
81 */
82 void
83 depvar_dep_macro_used(Name name)
84 {
85 Depvar dv;
86
87 for (dv = depvar_list; dv != NULL; dv = dv->next) {
88 if (name == dv->name) {
89 #ifdef NSE
90 #ifdef SUNOS4_AND_AFTER
91 if (dv->cmdline) {
92 #else
93 if (is_true(dv->cmdline)) {
94 #endif
95 nse_dep_cmdmacro(dv->name->string);
96 }
97 #endif
98 variant_deps = true;
99 break;
100 }
101 }
102 }
103
104 #ifdef NSE
105 /*
106 * The macro `name' has been used in either the argument
107 * to a cd before a recursive make. See if it was
108 * defined on the command-line and, if so, complain.
109 */
110 void
111 depvar_rule_macro_used(Name name)
112 {
113 Depvar dv;
114
115 for (dv = depvar_list; dv != NULL; dv = dv->next) {
116 if (name == dv->name) {
117 #ifdef SUNOS4_AND_AFTER
118 if (dv->cmdline) {
119 #else
120 if (is_true(dv->cmdline)) {
121 #endif
122 nse_rule_cmdmacro(dv->name->string);
123 }
124 break;
125 }
126 }
127 }
128 #endif
129
130 /*
131 * Print the results. If any of the Dependency Variables
132 * affected the dependencies then the dependencies potentially
133 * differ because of these variables.
134 */
135 void
136 depvar_print_results(void)
137 {
138 if (variant_deps) {
139 printf(catgets(catd, 1, 234, "differ\n"));
140 } else {
141 printf(catgets(catd, 1, 235, "same\n"));
|
41 Name name; /* Name of variable */
42 struct _Depvar *next; /* Linked list */
43 Boolean cmdline; /* Macro defined on the cmdline? */
44 };
45
46 typedef struct _Depvar *Depvar;
47
48 static Depvar depvar_list;
49 static Depvar *bpatch = &depvar_list;
50 static Boolean variant_deps;
51
52 /*
53 * Add a name to the list.
54 */
55
56 void
57 depvar_add_to_list(Name name, Boolean cmdline)
58 {
59 Depvar dv;
60
61 dv = ALLOC(Depvar);
62 dv->name = name;
63 dv->next = NULL;
64 dv->cmdline = cmdline;
65 *bpatch = dv;
66 bpatch = &dv->next;
67 }
68
69 /*
70 * The macro `name' has been used in either the left-hand or
71 * right-hand side of a dependency. See if it is in the
72 * list. Two things are looked for. Names given as args
73 * to the -V list are checked so as to set the same/differ
74 * output for the -P option. Names given as macro=value
75 * command-line args are checked and, if found, an NSE
76 * warning is produced.
77 */
78 void
79 depvar_dep_macro_used(Name name)
80 {
81 Depvar dv;
82
83 for (dv = depvar_list; dv != NULL; dv = dv->next) {
84 if (name == dv->name) {
85 #ifdef NSE
86 if (dv->cmdline) {
87 nse_dep_cmdmacro(dv->name->string);
88 }
89 #endif
90 variant_deps = true;
91 break;
92 }
93 }
94 }
95
96 #ifdef NSE
97 /*
98 * The macro `name' has been used in either the argument
99 * to a cd before a recursive make. See if it was
100 * defined on the command-line and, if so, complain.
101 */
102 void
103 depvar_rule_macro_used(Name name)
104 {
105 Depvar dv;
106
107 for (dv = depvar_list; dv != NULL; dv = dv->next) {
108 if (name == dv->name) {
109 if (dv->cmdline) {
110 nse_rule_cmdmacro(dv->name->string);
111 }
112 break;
113 }
114 }
115 }
116 #endif
117
118 /*
119 * Print the results. If any of the Dependency Variables
120 * affected the dependencies then the dependencies potentially
121 * differ because of these variables.
122 */
123 void
124 depvar_print_results(void)
125 {
126 if (variant_deps) {
127 printf(catgets(catd, 1, 234, "differ\n"));
128 } else {
129 printf(catgets(catd, 1, 235, "same\n"));
|