SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

All right, you want to compile AS with a K&R compiler, and I hope you have really thought about it before attemptimg this. Think a second and third time before you really go this way! The procedure is tedious and error-prone. I really regard K&R C as being obsolete, and that is why I did not provide an 'automatic' way to compile AS with a K&R compiler. You will probably face more problems than mentioned here, since K&R systems are mostly old systems that also lack library functions of newer systems. The K&R support is mostly here because I have an old PCS/Cadmus system (the first german company in the 80s that built Unix systems, 68k-equipped and with a very bare System V.3 port) whose compiler is even too stupid to compile GNU-C, so the description will orient along the things I had to do for the Cadmus. This scheme however has also already worked for SunOS/Sparc with the old 'cc' compiler from Sun....

  1. remove the '#error' directives from 'sysdefs.h' - K&R preprocessors do not know them.
  2. construct an appropriate 'Makefile.def' for your system. Since most older systems do not define OS-specific symbols, you might have to define them yourself and correlate them to what you query in 'sysdefs.h' for your system. For a K&R compiler, '-Dsigned= -Dconst=' is a good start to remove ANSI extensions. For the Cadmus, I also had to to add '-Dvoid=int' because the compiler's void datatype was broken.
  3. There is a tool called 'a2k' to convert ANSI sources (headers & c-files) to K&R style. This mainly involves removing the prototypes. Don't think this is a general ANSI-->K&R converter, since it heavily depends on my way of formatting C sources and some additional differences are handled in the sources themselves via __STDC__ queries! To build a2k, a simple 'make a2k' should suffice.
  4. Convert all header files to K&R, like in the following:

for i in *.h; do
cp $i $i.ansi
a2k $i.ansi $i
done

5. Change the Makefile so that a2k is called as a preprocessor to the

compiler. The simplest way is to modify the implicit rule:

.c.o:

        a2k $*.c tmp.c
        $(CC) $(ALLFLAGS) -c tmp.c
        mv tmp.o $*.o
        rm -f tmp.c

6. Type 'make' and pray...

One more thing: older Unix systems do not know symbolic links, so a manual 'cp tests/t_secdrive/wd1003at.inc cp tests/t_secdrive/lowlevel.inc' might be necessary...


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.