Excluding platform specific files for a build

This approach is to:

  • Name files with platform-specific suffixes (e.g., FooWindows.cpp for Windows, FooPosix.cpp for Linux/POSIX).

  • Utilize GNU make's pattern substitution to exclude non-relevant platform files during the build process.

OBJECTS := $(patsubst %Windows.o,,$(OBJECTS)) # Remove object files named *Windows.*

 

Related pages