Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Makefile: Run multiple targets

Tags:

linux

makefile

I would like to run two targets using a makefile but don't know how to specify the targets from the command line.

This is my makefile.

.PHONY: all clean test
PYTHON=python
PYTESTS=pytest

all:
    $(PYTHON) setup.py build_ext --inplace

clean:
    find . -name "*.so" -o -name "*.pyc" -o -name "*.md5" -o -name "*.pyd" | xargs rm -f
    find . -name "*.pyx" -exec ./tools/rm_pyx_c_file.sh {} \;

benchmark_coverage:
    $(PYTESTS) benchmarks --cov=skimage

coverage: test_coverage

test_coverage:
    $(PYTESTS) -o python_functions=test_* skimage --cov=skimage

So, I'm mainly interested in coverage, benchmark_coverage and test_coverage.

When I run the command make coverage, it runs
$(PYTESTS) -o python_functions=test_* skimage --cov=skimage.

When I run make bench_coverage, it runs
$(PYTESTS) benchmarks --cov=skimage.

Now, I want to run both of these together, how do I do this?

Someone suggested me make coverage bench_coverage but it only runs the first command.

Please help.

Thanks

like image 809
Abhishek Arya Avatar asked Sep 03 '26 17:09

Abhishek Arya


1 Answers

I tried creating the following Makefile:

a:
   echo a

b:
   echo b

and if I run make a b it runs both, so running multiple targets actually is allowed.

like image 53
Bitwise Avatar answered Sep 06 '26 19:09

Bitwise