简体   繁体   English

Makefile:运行多个目标

[英]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. 我想使用一个makefile运行两个目标,但不知道如何从命令行指定目标。

This is my makefile. 这是我的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 . 因此,我主要对coveragebenchmark_coveragetest_coverage

When I run the command make coverage , it runs 当我运行命令make coverage ,它会运行
$(PYTESTS) -o python_functions=test_* skimage --cov=skimage . $(PYTESTS) -o python_functions=test_* skimage --cov=skimage

When I run make bench_coverage , it runs 当我运行make bench_coverage ,它会运行
$(PYTESTS) benchmarks --cov=skimage . $(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. 有人建议我设置make coverage bench_coverage但是它只运行第一个命令。

Please help. 请帮忙。

Thanks 谢谢

I tried creating the following Makefile: 我尝试创建以下Makefile:

a:
   echo a

b:
   echo b

and if I run make ab it runs both, so running multiple targets actually is allowed. 如果我运行make ab它将同时运行,因此实际上允许运行多个目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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