简体   繁体   中英

Makefile: Run multiple targets

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

I tried creating the following Makefile:

a:
   echo a

b:
   echo b

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM