ado@NCIFCRF.GOV (Arthur David Olson) (02/21/89)
Index: cccp.c
(We're running SunOS 4.0 on a Sun 3/280.)
Description:
Gnu gcc 1.33 and SunOS 4.0 make's .KEEP_STATE feature don't mix.
The problem turns out to be in the preprocessor, which correctly
detects that Sun's make wants dependencies written out but then
writes only the dependencies (and not the results of preprocessing).
Repeat-By:
Script started on Mon Feb 20 16:47:38 1989
elsie$ mkdir xyz
elsie$ cd xyz
elsie$ echo '.KEEP_STATE:' > Makefile
elsie$ echo 'main(){}' > try.c
elsie$ make try CC='/usr/local/bin/gcc -v'
/usr/local/bin/gcc -v -sun3 -o try try.c
gcc version 1.33
/usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 try.c /tmp/cca00666.cpp
GNU CPP version 1.33
/usr/local/lib/gcc-cc1 /tmp/cca00666.cpp -quiet -dumpbase try.c -version -o /tmp/cca00666.s
GNU C version 1.33 (68k, MIT syntax) compiled by GNU C version 1.33.
as -mc68020 /tmp/cca00666.s -o try.o
ld -o try -e start -dc -dp /lib/crt0.o /lib/Mcrt1.o try.o /usr/local/lib/gcc-gnulib -lc
ld: Undefined symbol
_main
*** Error code 1
make: Fatal error: Command failed for target `try'
elsie$ make try.o CC='/usr/local/bin/gcc -v'
/usr/local/bin/gcc -v -sun3 -c try.c
gcc version 1.33
/usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 try.c /tmp/cca00682.cpp
GNU CPP version 1.33
/usr/local/lib/gcc-cc1 /tmp/cca00682.cpp -quiet -dumpbase try.c -version -o /tmp/cca00682.s
GNU C version 1.33 (68k, MIT syntax) compiled by GNU C version 1.33.
as -mc68020 /tmp/cca00682.s -o try.o
elsie$ ls -l try.o
-rw-r--r-- 1 ado 62 Feb 20 16:48 try.o
elsie$ nm try.o
00000000 t gcc_compiled.
elsie$ exit
script done on Mon Feb 20 16:48:27 1989
Fix:
*** 1.2/cccp.c Mon Feb 20 16:50:45 1989
--- 1.3/cccp.c Mon Feb 20 16:50:48 1989
***************
*** 1067,1083 ****
if (dump_macros)
dump_all_macros ();
! else if (print_deps) {
! fputs (deps_buffer, deps_stream);
! putc ('\n', deps_stream);
! if (deps_stream != stdout) {
! fclose (deps_stream);
! if (ferror (deps_stream))
! fatal ("I/O error on output");
}
! } else if (! inhibit_output) {
! if (write (fileno (stdout), outbuf.buf, outbuf.bufp - outbuf.buf) < 0)
! fatal ("I/O error on output");
}
if (ferror (stdout))
--- 1067,1087 ----
if (dump_macros)
dump_all_macros ();
! else {
! if (print_deps) {
! fputs (deps_buffer, deps_stream);
! putc ('\n', deps_stream);
! if (deps_stream == stdout)
! inhibit_output = TRUE;
! else {
! fclose (deps_stream);
! if (ferror (deps_stream))
! fatal ("I/O error on output");
! }
}
! if (! inhibit_output)
! if (write (fileno (stdout), outbuf.buf, outbuf.bufp - outbuf.buf) < 0)
! fatal ("I/O error on output");
}
if (ferror (stdout))
--
Arthur David Olson ado@ncifcrf.gov ADO is a trademark of Ampex.