This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to generate from CCS makefile, objects.mk, sources.mk, subdir.mk that are not hard coded with path for tools, include directory etc.

To All,

I want to generate makefile, objects.mk, sources.mk, subdir.mk etc in CCS that are not code with hardcoded path. I would like to use the environment variable in CCS and path to find build tools, source directory, include directory etc. I read and article Portable Projects,  it help some. I used some of the technique described over here, but still I see makefile, objects.mk, sources.mk, subdir.mk has hard coded path. Any help in this area will be greately appereciated.

For example "makefile " has following line.

# Tool invocations
Alpha.out: $(GEN_CMDS) $(CMD_SRCS) $(OBJS)
 @echo 'Building target: $@'
 @echo 'Invoking: null'
 "C:/Program Files/Texas Instruments/ccsv4/tools/compiler/tms470/bin/cl470" -mv7M3 -g -O0 --gcc --define=ccs --define=PART_LM3S9B96 --define=TARGET_IS_TEMPEST_RB1 --define=UART_BUFFERED --define=DEBUG --diag_warning=225 -me --gen_func_subsections --abi=eabi --code_state=16 --ual -z -m"Alpha.map" --stack_size=0x1000 --heap_size=0x1000 --warn_sections -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/tms470/lib" -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/tms470/include" --reread_libs --rom_model -o "Alpha.out" $(ORDERED_OBJS)
 @echo 'Finished building target: $@'
 @echo ' '
I want the following path variable for tools  "C:/Program Files/Texas Instruments/ccsv4/tools/compiler/tms470/bin/" to come from PATH environment varaiable. I want to do this in CCS when it automatically generates the makefile.

The "makefile" includes objects.mk, sources.mk, subdir.mk .

# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk

For example subdir.mk file has following path hard coded.  I want to change them to use environment variable. The makefile, objects.mk, sources.mk, subdir.mk  are automatically build by the CCS. In CCS I want to generate this make file that uses environment variable no hard coded path.

C_SRCS_QUOTED += \
"../alpha.c" \
"../alpha_vectors.c" \
"C:/CCFolderViews/modia_EALARM.P1.0.0/EALARM_SRC/Src/Src/driverlib/epi.c" \
"C:/CCFolderViews/modia_EALARM.P1.0.0/EALARM_SRC/Src/Src/CommonSource/extram.c" \
"C:/CCFolderViews/modia_EALARM.P1.0.0/EALARM_SRC/Src/Src/CommonSource/setup_pins.c" \
"C:/CCFolderViews/modia_EALARM.P1.0.0/EALARM_SRC/Src/Src/CommonSource/ssiflash.c" \
"C:/CCFolderViews/modia_EALARM.P1.0.0/EALARM_SRC/Src/Src/CommonSource/uartstdio.c"

# Each subdirectory must supply rules for building sources it contributes
alpha.obj: ../alpha.c $(GEN_SRCS) $(GEN_OPTS)
 @echo 'Building file: $<'
 @echo 'Invoking: null'
 "C:/Program Files/Texas Instruments/ccsv4/tools/compiler/tms470/bin/cl470" -mv7M3 -g -O0 --gcc --define=ccs --define=PART_LM3S9B96 --define=TARGET_IS_TEMPEST_RB1 --define=UART_BUFFERED --define=DEBUG --include_path="C:/Program Files/Texas Instruments/ccsv4/tools/compiler/tms470/include" --include_path="{PROJECT_ROOT}/../../.." --include_path="C:/CCFolderViews/modia_EALARM.P1.0.0/EALARM_SRC/Src/Src/Alpha/../CommonInclude" --include_path="C:/CCFolderViews/modia_EALARM.P1.0.0/EALARM_SRC/Src/Src/Alpha/../CommonSource" --include_path="C:/CCFolderViews/modia_EALARM.P1.0.0/EALARM_SRC/Src/Src/Alpha/../EAOFlib" --diag_warning=225 -me --gen_func_subsections --abi=eabi --code_state=16 --ual --preproc_with_compile --preproc_dependency="alpha.pp" $(GEN_OPTS_QUOTED) $(subst #,$(wildcard $(subst $(SPACE),\$(SPACE),$<)),"#")
 @echo 'Finished building: $<'
 @echo ' '

Thanks for your assistance in this.

Al Modi


  • Ashok,

    The Eclipse C/C++ Managed build help file mentions that "All macros, except the build process environment macros, always get resolved in the makefile"  - therefore anything apart from the internal build macros like $(GEN_SRCS) or $(GEN_OPTS) that you already see in the makefile are expanded.

    However I searched several resources and could find a way to preserve these macros in a newer Eclipse release (Galileo - check here and here), unfortunately this option is unavailable in CCSv4. You would then have the option to use a post processing step that could parse the makefiles and replace the environment variables or plan to use the next version of Code Composer Studio (v5), since it uses a newer Eclipse.

    Regards,

    Rafael