source versions for multiple machines
Mark A. Heilpern
heilpern at ibd.BRL.MIL
Sat May 6 03:14:05 AEST 1989
Maintaining one source code for several machines is not very difficult
at all (if you know what differences you'll have to compensate for.)
All you need do is have sections of code within '#ifdef' and '#ifndef'
sections, and compile with the proper machine name '#define'd.
Ex:
--------
#define machineA
main()
{
#ifdef machineA
printf("machine A\n");
#endif
#ifdef machineB
printf("machine B\n");
#endif
}
--------
Just change the #define line from on computer to another. Or, an easier
way is to neglect the #define, and place the define in your compile
command, as follows for the above example.
$ cc -o file file.c -DmachineA
have fun...
--M.
More information about the Comp.unix.questions
mailing list