Question similar to here, but for my use case, I'd like to place inside the makefile.
#!/bin/bash
# Example:
# make run TEST_CASE="testbench.sv"
# make clean
compile:
vcs $(TEST_CASE) -sverilog;
run: compile
./simv
uvm_compile:
vcs $(TEST_CASE) -sverilog;
clean:
shopt -s extglob;
rm -v !(*.sv|*svh|"makefile");
The problem exist in make clean, and I got the following result:
ycliao@localhost:[~/workspace/i2c_vip/uvm_practice]: make clean
shopt -s extglob;
rm -v !(*.sv|*svh|"makefile");
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `rm -v !(*.sv|*svh|"makefile");'
make: *** [clean] Error 1
extgloboption is set only for the first shell. Other possibilities: use the.ONESHELLGNU make feature or write the recipe on a single line. Note: except for this first line of thecleanrecipe, all other semi-colons are useless.shopt -s extglob;./bin/sh. On some systems/bin/shis actually bash and it will work. On other systems,/bin/shis a simple POSIX shell and it will fail. If you want make to always usebashyou have to set the variableSHELL = /bin/bash.