Parallel makefile requires dependency ordering

后端 未结 5 659
青春惊慌失措
青春惊慌失措 2021-02-03 23:21

I have the following piece of makefile:

CXXFLAGS = -std=c++0x -Wall
SRCS     = test1.cpp test2.cpp
OBJDIR   = object
OBJS     = $(SRCS:%.cpp=$(OBJDIR)/%.o)

all:         


        
5条回答
  •  旧时难觅i
    2021-02-03 23:56

    I'm not exactly sure what versions this feature is supported in, but you can use the order-only feature:

    my_target: dep1 dep2 | must_run_1st must_run_2nd
    

    All dependencies left of the | character are processed as normal. Dependencies to the right of | are run 'order-only'

    This feature is described at:

    https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html

    In your case, the following rules definition would suffice:

    release: | clean test1
    test1: | clean
    

提交回复
热议问题