cancel
Showing results for 
Search instead for 
Did you mean: 

Post build command

Parmin Nayani
Associate III

Hello all,

First of all, thank you all for helping and educating me on various topics whenever I needed help. This post is on how to rename an output file based on a define in my code. I understand this can be done by bash command(s) post-build, but all my trials went in always getting one error the other from build process :smiling_face_with_smiling_eyes:.  My project name "test_pb". In my code I have a define (I believe preprocessor defines can be passed to post build command).

#define CODE_FR  TYPE1.  I have three types TYPE1, TYPE2 and TYPE3. The output filename is going to be "test_pb.hex" after build. Based on CODE_TYPE, I would like to rename the output file to something like "type1_pb.hex" if the CODE_FR is defined as TYPE1, "type2_pb.hex", if CODE_FR is defined as TYPE2 etc. I tried different types of commands (some are given below) but for most I am getting "unexpected end of file (expecting "then")". 

if [ $CODE_FR == "TYPE1" ]; then mv "$(ProjName)".elf my_tp1.elf; fi

if [ ${CODE_FR} == "TYPE1" ]; then mv "$(ProjName)".elf my_tp1.elf; fi

if [ ${CODE_FR} == 'TYPE1' ]; then mv "$(ProjName)".elf my_tp1.elf; fi

if [ "CODE_FR" == "TYPE1" ]; then mv "$(ProjName)".elf my_tp1.elf; fi  // tried direct compare of strings too.

Awaiting help in resolving this issue. Thank you for your time. 

0 REPLIES 0