I have a makefile. I want to ask for the name of the file that will be compiled in specific targets.
When I wrote make
to the bash and press the tab it suggests the targets in makefile. However, it doesn't suggest when I uncomment the line that commented below.
temp_file_path = ./TestCode/temporary_files/
c_code_file := ./TestCode/$(name)
temp_file := $(temp_file_path)$(name)
#it doesn't autocomplete when I uncomment the line below.
#name := $(shell bash -c 'read -p "Type the c file that you want to compile (without extension): " pwd; echo $$pwd')
executable:
@echo temp_file as $(temp_file) › will be used
@echo c_code_file as $(c_code_file) › will be used > temp.log
temp.log:
touch temp.log
Could you explain why it happens and the solution? I want both to solve and to understand the make syntax (and rules).
The answer here suggests to away -c
as I understand. (I used it in my makefile.) However, I couldn't understand if it is really the reason and how to solve it.