parallel build
[platform/upstream/make.git] / output.h
1 /* Output to stdout / stderr for GNU make
2 Copyright (C) 2013 Free Software Foundation, Inc.
3 This file is part of GNU Make.
4
5 GNU Make is free software; you can redistribute it and/or modify it under the
6 terms of the GNU General Public License as published by the Free Software
7 Foundation; either version 3 of the License, or (at your option) any later
8 version.
9
10 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along with
15 this program.  If not, see <http://www.gnu.org/licenses/>.  */
16
17 struct output
18   {
19     int out;
20     int err;
21     unsigned int syncout:1;     /* True if we want to synchronize output.  */
22  };
23
24 extern struct output *output_context;
25 extern unsigned int stdio_traced;
26
27 #define OUTPUT_SET(_new)    do{ output_context = (_new)->syncout ? (_new) : NULL; }while(0)
28 #define OUTPUT_UNSET()      do{ output_context = NULL; }while(0)
29
30 #define OUTPUT_TRACED()     do{ stdio_traced = 1; }while(0)
31 #define OUTPUT_IS_TRACED()  (!!stdio_traced)
32
33 FILE *output_tmpfile (char **, const char *);
34
35 /* Initialize and close a child output structure: if NULL do this program's
36    output (this should only be done once).  */
37 void output_init (struct output *out);
38 void output_close (struct output *out);
39
40 /* In situations where output may be about to be displayed but we're not
41    sure if we've set it up yet, call this.  */
42 void output_start (void);
43
44 /* Show a message on stdout or stderr.  Will start the output if needed.  */
45 void outputs (int is_err, const char *msg);
46
47 #ifndef NO_OUTPUT_SYNC
48 int output_tmpfd (void);
49 /* Dump any child output content to stdout, and reset it.  */
50 void output_dump (struct output *out);
51 #endif