1 /*-
2  * Copyright (c) 1982, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)remake.c	8.1 (Berkeley) 06/06/93";
10 #endif /* not lint */
11 
12 /*
13  * Remake the object file from the source.
14  */
15 
16 #include "defs.h"
17 #include "command.h"
18 #include "object.h"
19 
20 /*
21  * Invoke "pi" on the dotpfile, then reread the symbol table information.
22  *
23  * We have to save tracing info before, and read it in after, because
24  * it might contain symbol table pointers.
25  *
26  * We also have to restart the process so that px dependent information
27  * is recomputed.
28  */
29 
30 remake()
31 {
32     char *tmpfile;
33 
34     if (call("pi", stdin, stdout, dotpfile, NIL) == 0) {
35 	if (strcmp(objname, "obj") != 0) {
36 	    call("mv", stdin, stdout, "obj", objname, NIL);
37 	}
38 	tmpfile = mktemp(strdup("/tmp/pdxXXXX"));
39 	setout(tmpfile);
40 	status();
41 	unsetout();
42 	bpfree();
43 	objfree();
44 	initstart();
45 	readobj(objname);
46 	setinput(tmpfile);
47 	unlink(tmpfile);
48     } else {
49 	puts("pi unsuccessful");
50     }
51 }
52