Home > OS >  Why do I change a CPP, will compile all the CPP again?
Why do I change a CPP, will compile all the CPP again?

Time:12-02


If a CPP don't change, make will not compile, but as long as change a CPP, would have to recompile all the source files, the makefile is as follows:

TARGET=../../bin/target

SRC_FOLDER=./driver

CPPFILE=$(wildcard *. CPP) $(wildcard $(SRC_FOLDER)/*. CPP)
CFILE=$(wildcard *. C)

CPPOBJS=$(CPPFILE: CPP=o)
COBJS=$(CFILE: c=o)

DEP_FILES=$(CPPFILE) $(CFILE) $(CPPOBJS) $(COBJS)

SILENT:

$(warinning $(CLEAR_VAR))

All: $(TARGET)
$(TARGET) : $(CFILE) $(CPPFILE)
# $$(CC) - c (CFILE) $(CFLAGS)
$(CXX) - c $(CPPFILE) $(CPPFLAGS)
$(CXX) - -fpic -o $@ *. O $(LDFLAGS)

Clean:
$(RM) $(CPPOBJS) $(COBJS) $(TARGET)
  • Related