Hi there! In a few weeks, I might have to derive a product from another products. The hardware is the same, but the software is slightly different. I think, it would be a drag to copy the sources to another directory and and take care of two code versions. So it would be nice to know, which project it is while compilation time, so that I could use some #ifdef statement to get conditional compilation. Other than that, I just had the idea to have a "higher source level files that define a compiler constant and then include the low level source files. Like:
"highlevel.c" #define OEM #include "lowlevel.c" "lowlevel.c" #ifdef OEM #include ... #else #include ... #endif // some common source #ifdef OEM // OEM source only #else // non OEM source #endif // some common source
Ahhh. I think I understand. Are you creating complete different programs? If that's the case, then you should create a separate project for each program. If you are creating the same program (just for different chips or configurations) then uVision2 targets and groups works beautifully. To further explain... I have a project with about 25 targets. Each target generates a program for a different 8051 derivative. Each target creates the same program--just for a different chip. I have targets for Philips MX, Dallas 390, Infineon C167, Standard 8051, and so on. Most of the files in my project are common between all targets. However, I do have some special files (device drivers, mainly) that are only included for each target. So, I have a file group for Philips MX, Dallas 390, Infineon C167, and Standard 8051. The Philips MX group is set as "Do Not Include" for all targets bu the Philips MX. The same goes for the Dallas 390, Infineon C167, and Standard 8051. When I start a project that I know I will use on multiple targets, I create a group for each target (so I can put target-specific files there). Then, in my first target, I set these as "Do Not Include". When I create new targets, I copy the settings of the original target. Then, all I must do is enable the required groups for the new target. But, hey. That's just my solution. Jon