Is there any type of if/else statement compatible with GNU make and Berkley make (freeBSD)?
GNU MAKE:
ifeq ($(BUILD_TYPE), debug)
berkley make:
.ifdef (BUILD_TYPE)
No. The best you can do is use include files with constructed names, like:
include $(BUILD_TYPE).mk
where BUILD_TYPE will be "debug" or whatever. This is certainly not as powerful as if/else but it can do a limited set of things well, in a portable manner.
In general it's almost impossible to write a portable makefile that uses any feature more sophisticated than the basics provided by POSIX. The makefile syntax is so loose and free-form, and yet the features provided by traditional make and the POSIX standard are so anemic, that most make vendors have created a large number of non-compatible extensions.
Generally when people wonder about this I recommend that they either use automake, which takes care of the tedious work of writing portable makefiles for you, or else they commit to one make or the other and simply require people to build it if they don't have it. GNU make, for sure, will run across a huge variety of platforms... even non-POSIX platforms.