Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!adm!smoke!ibd!heilpern From: heilpern@ibd.BRL.MIL (Mark A. Heilpern ) Newsgroups: comp.unix.questions Subject: Re: source versions for multiple machines Message-ID: <261@ibd.BRL.MIL> Date: 5 May 89 17:14:05 GMT References: <8367@chinet.chi.il.us> Reply-To: heilpern@brl.arpa (Mark A. Heilpern (IBD) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 29 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.