I am trying to use Powershell to automate building projects using the cli compiler / linker. I want to put the script in the root directory of the project and check recursively and compile all the source files, and the compiler output is listed in the same directory as the source files. I would also like to compile a * .c list as a comma-delimited variable as input to the linker. This is a typical situation:
//projects/build_script.ps //projects/proj_a/ (contains a bunch of source files) //projects/proj_b/ (contains a bunch of source files)
I want to scan all the auxiliary directories and compile the source for each * .c file. This is what I have so far:
$compilerLocation = "C:\Program Files (x86)\HI-TECH Software\PICC-18\PRO\9.63\bin\picc18.exe"; $args = "--runtime=default,+clear,+init,-keep"; $Dir = get-childitem C:\projects -recurse $List = $Dir | where {$_.extension -eq ".c"} $List | $compilerLocation + "-pass" + $_ + $args + "-output=" + $_.current-directory;
I understand that $ _. current-directory is not a real member, and I probably have other syntax issues. I apologize for the vagueness of my question, I am more than ready to explain what may seem obscure.
source share