Question

Required stripe of the Makefile is as follows

PCS=$(wildcard $(PC)/*.pc)
SRCS=$(PCS:$(PC)/%.pc=$(SRC)/%.cpp)
OBJS=$(SRCS:$(SRC)/%.cpp=$(OBJ)/%.o)

f2db : $(OBJS)
    $(CC) $(INCS) $(LIBS) $(FLAGS) $(OBJS) f2db.cpp -o $@

$(OBJ)/%.o : $(SRC)/%.cpp
    $(CC) $(INCS) $(FLAGS) -c $< -o $@

$(SRC)/%.cpp : $(PC)/%.pc
    $(PROC) $< CODE=CPP CPP_SUFFIX=cpp INCLUDE=inc INCLUDE=/usr/include
    mv $(PC)/*.cpp $(SRC)

On gmake command invoke all is as expected except the remove command at last. The last two lines of the output as follows

gmake: warning:  Clock skew detected.  Your build may be incomplete.
rm src/fileName.cpp

Tool used GNU Make 3.80 in Solaris OS, why is this happening?

Was it helpful?

Solution

The clock skew warning is most likely because the directory you're building in is mounted from a remote system using something like NFS, etc., and the remote filesystem's clock is not synchronized with your local system clock. Anyway, that's not related to the rm command.

The rm command is happening because the src/fileName.cpp is an intermediate file and intermediate files are removed by make after they're built.

If you don't want them to be removed, just declare them as prerequisites of a rule so that they're not intermediate any longer:

f2db : $(OBJS) $(SRCS)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top