You can interpret your question in two ways:
- How can I make sure that I backup at least enough files so I can build the project
- How can I make sure that I backup not too many files so I can still build the project
The first is to make sure you can build the system at all, the second to allow you to clean up unused files.
For both, a version control system including a separate build system is the way to go.
You then - for each new set of changes - can use these steps to assure that both conditions hold:
- On your daily development system, check in the new revision of your source code into your version control system.
- On your separate build system, get the latest version of your source control system.
- Build the project on the build system; if this fails, go to Step 1, and add the missing files to your version control system from your development system
- Start removing (one-by-one) files from the project that you suspect are not needed, then rebuild until it fails.
- When the build fails, restore that particular file from the version control system, then continue step 3 with the next candidate
- When the build succeed you have the minimum set of files.
- Now make a difference overview of the files in your version control system, and the build machine.
- Mark the files that are in your version control system but not on your build machine as deprecated or deleted.
Most version control systems have good ways of generating a difference between the files on your development or build system against the files in the version control system (usually fine grained for each historic point in time you added/removed/updated files in your version control system).
The reason you want a separate build system (or two separate development systems) is that you want them to be independent: you use one for developing, and the other for checking if the build is still OK.
This is the first step that in the future you might want to extend this into a continuous integration system (that runs unit tests, automatically creates product setups and much more).
--jeroen