[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Make rebuilds when it is not necessary
From: |
Rupal Desai |
Subject: |
Make rebuilds when it is not necessary |
Date: |
Mon, 6 Mar 2006 02:05:39 -0800 |
I am writing a
rules.mk file which will have rules for compile for the whole code
base. The problem I am having is that whenever I give the make
command it recompiles everything without checking the timestamp. How can I
only build things that are out of date and not everything all the time. I
am attaching my rules.mk file.
VPATH = $(OBJDIR)
$(MODDIR)
vpath %.cpp $(MODDIR)
vpath %.o $(OBJDIR)
CXXFLAGS
=
ALLAPPLIBS = $(DEFAULT_LIBS) $(addprefix -l, c dl
\
comm
utilcpp)
.PHONY:
all
all: $(OBJDIR)
subdirs $(OBJS) $(STATIC_LIB) $(SHARED_LIB)
$(OBJS):$(OBJDIR)/%.o: %.cpp
$(OBJDIR)
$(CXX) $(INCLUDES)
$(CXXFLAGS) -o $@ -c $<
$(OBJDIR):
if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi
subdirs:
ifneq
($(SUBDIR),)
for d in $(SUBDIR);
do
\
cd "$$d" && $(MAKE) $(MAKECMDGOALS) && cd ..;
done
endif
clean: subdirs
rm -rf
$(OBJDIR)
$(SHARED_LIB): $(OBJS)
$(CXX)
$(LDFLAGS) $(OBJS) $(LIBS) $(DFLDFLAGS) -o $(OBJDIR)/$@
$(STATIC_LIB): $(OBJS)
$(AR)
$(OBJDIR)/$@ $(OBJS)
- Make rebuilds when it is not necessary,
Rupal Desai <=