Home > Back-end > Consult under Windows GCC batch compiler under multiple folders. C file
Consult under Windows GCC batch compiler under multiple folders. C file
Time:10-06
Consult everybody The situation is to have thousands of folders, each folder have 1-2. C file Has been installed in a Windows environment GCC and makefile environment
Could you tell me how to batch compiler under multiple folders. C files? Generated exe
It is better to meet the following requirements: 1, to be able to configure different optimization option (without optimization, - O1, O2, O3, etc.) generated exe 2, the generated exe folder with the source file 3, different optimizations exe can have different naming (preferably. The file name of c + O1, etc.)
Thank you for your bosses to guide Now imitate some makefile but can only be generated in the same folder. O file
CodePudding user response:
Write a script file, it suggested that Linux can write a shell, DOS can write a bat 2 script to list your thousands of folders, and respectively into each folder called GCC compiler into o, o links into exe can again 1 optimize parameter can use variables in a script, or by the parameters of the script to set the 3 file name can also be through script variables to set You first try to write a script, mainly used for loop, set set the environment variable, called GCC commands and command of makefile
Or is there a way is that you use a script in each folder to generate a makefile, finally it is ok to call respectively each makefile