Makefile with multiple targets

前端 未结 2 1672
我在风中等你
我在风中等你 2020-12-20 21:03

Hopefully this is a very simple question. I have a makefile pattern rule that looks like this:

%.so : %.f %.pyf
    f2py -c -L${LAPACK_DIR} ${GRASPLIBS} -m $         


        
相关标签:
2条回答
  • 2020-12-20 21:52

    The usual trick is to add a 'dummy' target as the first that depends on all targets you want to build when running a plain make:

    all: radgrd_py.so lodiso_py.so
    

    It is a convention to call this target 'all' or 'default'. For extra correctness, let make know that this is not a real file by adding this line to your Makefile:

    .PHONY: all
    
    0 讨论(0)
  • 2020-12-20 21:55

    Best way is to add:

    .PHONY: all
    .DEFAULT: all
    all: radgrd_py.so lodiso_py.so

    Explanations:

    make uses the first target appearing when no .DEFAULT is specified.

    .PHONY informs make that the targets (a coma-separated list, in fact) don't create any file or folder.

    all: as proposed by schot

    0 讨论(0)
提交回复
热议问题