Made for situations when you properly split a program into headers and source code, but to test your solution you need to send just a single file to a contest system (in my case, Yandex.Contest)
Run the script in the project directory (may not work for more complex structures, I need more testing material) with
python contatenator.py
Parameters defined in the script:
main
variable contains the name of the file with int main
from which recursive descend starts
united
variable contains the name of the output file
The script is able to:
-
concatenate .cpp, .hpp, .h and .inl files;
-
traverse nested directories;
-
move common defines and stdlib includes to the top;
-
delete header guardians
- Each header must have no more than one corresponding source file! and the corresponding file must have the same name! If I were to write more general algorithm, I would have to parse Makefile, which is too complicated and I'm too lazy
to be continued...