Parallel makefile requires dependency ordering

后端 未结 5 647
青春惊慌失措
青春惊慌失措 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条回答
  •  独厮守ぢ
    2021-02-03 23:49

    In the release case, you need to ensure that clean completes before any compiling. Thus you (just) add it as a dependency to the compile rule (and not to the phony target). Several ways of doing this, like target-specific variables, or:

    $(OBJDIR)/%.o: %.cpp $(if $(filter release,${MAKECMDGOALS}),clean)
        ...
    

提交回复
热议问题