Sample Header Ad - 728x90

Define a variable based on the result of the execution of a command in make file

0 votes
2 answers
2306 views
I'm trying to use a makefile to bundle a combination of commands that should be run one after the other. Part of the make file looks like the following; .PHONY: dispersion all: dispersion -include make.in dispersion: phonopy --qe -d --dim='$(nx) $(ny) $(nz)' -c $(material)_primitive.in $(eval VAR=$(shell grep nat supercell.in)) echo $(VAR) basically, the first line creates a file called "supercell.in" and the second creates a variable called VAR that will be used in the subsequent lines. The above doesn't assign a value to the variable and I'm guessing this is due to the priority of the execution of lines. I would appreciate knowing a way around this problem.
Asked by Amir (1 rep)
Jan 19, 2022, 12:45 AM
Last activity: Jul 21, 2025, 07:34 AM