1 /*************************************************************************
3 * m a k e : c h e c k . c
5 * debugging stuff: Check structures for make.
6 *========================================================================
10 * --- -------- ---------------------------------------------------- ---
12 * 2 23.08.89 adapted to new name tree structure RAL
13 * 3 30.08.89 indention changed PSH,RAL
14 * 4 06.09.89 prt output redirected to stdout RAL
15 * ------------ Version 2.0 released ------------------------------- RAL
17 *************************************************************************/
23 * Prints out the structures as defined in memory. Good for check
24 * that you make file does what you want (and for debugging make).
28 register struct name
*np
;
29 register struct depend
*dp
;
30 register struct line
*lp
;
31 register struct cmd
*cp
;
32 register struct macro
*mp
;
36 for (mp
= macrohead
; mp
; mp
= mp
->m_next
)
37 printf("%s = %s\n", mp
->m_name
, mp
->m_val
);
41 for (i
= 0; i
<= maxsuffarray
; i
++)
42 for (np
= suffparray
[i
]->n_next
; np
; np
= np
->n_next
)
44 if (np
->n_flag
& N_DOUBLE
)
45 printf("%s::\n", np
->n_name
);
47 printf("%s:\n", np
->n_name
);
49 printf("(MAIN NAME)\n");
50 for (lp
= np
->n_line
; lp
; lp
= lp
->l_next
)
53 for (dp
= lp
->l_dep
; dp
; dp
= dp
->d_next
)
54 printf(" %s", dp
->d_name
->n_name
);
57 for (cp
= lp
->l_cmd
; cp
; cp
= cp
->c_next
)
59 printf("- %s\n", cp
->c_cmd
);
61 printf("-\t%s\n", cp
->c_cmd
);
71 * Recursive routine that does the actual checking.
76 register struct depend
*dp
;
77 register struct line
*lp
;
80 if (np
->n_flag
& N_MARK
)
81 fatal("Circular dependency from %s", np
->n_name
,0);
85 for (lp
= np
->n_line
; lp
; lp
= lp
->l_next
)
86 for (dp
= lp
->l_dep
; dp
; dp
= dp
->d_next
)
89 np
->n_flag
&= ~N_MARK
;
94 * Look for circular dependancies.
102 register struct name
*np
;
106 for (i
= 0; i
<= maxsuffarray
; i
++)
107 for (np
= suffparray
[i
]->n_next
; np
; np
= np
->n_next
)
113 * Check the target .PRECIOUS, and mark its dependentd as precious
117 register struct depend
*dp
;
118 register struct line
*lp
;
119 register struct name
*np
;
122 if (!((np
= newname(".PRECIOUS"))->n_flag
& N_TARG
))
125 for (lp
= np
->n_line
; lp
; lp
= lp
->l_next
)
126 for (dp
= lp
->l_dep
; dp
; dp
= dp
->d_next
)
127 dp
->d_name
->n_flag
|= N_PREC
;