les@chinet.chi.il.us (Leslie Mikesell) (05/05/89)
Are there any simple methods to maintain sources to keep versions on several machines up to date? I will do most editing on an 80386 machine with RFS links to 3B2's and the ability to access the same files from DOS under VP/ix or over the network from a different PC, so up to 3 binaries may be produced from the same physical copy of the sources. I also will need to transport copies to a 3B1 and possibly other machines via uucp or floppies. Is there a reasonable solution to keeping everything syncronized and maintaining current archive copies of everything? Les Mikesell
heilpern@ibd.BRL.MIL (Mark A. Heilpern ) (05/06/89)
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.