Skip to content

Commit 281d6bc

Browse files
committed
Makefiles: Teach LLVM's recursive makefile descent to update objdir Makefiles if
they are out of date, instead of only testing if they exist. llvm-svn: 105636
1 parent 57c6fd4 commit 281d6bc

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

llvm/Makefile.rules

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,8 @@ SubDirs += $(DIRS)
807807
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
808808
$(RecursiveTargets)::
809809
$(Verb) for dir in $(DIRS); do \
810-
if [ ! -f $$dir/Makefile ]; then \
810+
if ([ ! -f $$dir/Makefile ] || \
811+
[ $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ]); then \
811812
$(MKDIR) $$dir; \
812813
$(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
813814
fi; \
@@ -829,7 +830,8 @@ endif
829830
ifdef EXPERIMENTAL_DIRS
830831
$(RecursiveTargets)::
831832
$(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
832-
if [ ! -f $$dir/Makefile ]; then \
833+
if ([ ! -f $$dir/Makefile ] || \
834+
[ $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ]); then \
833835
$(MKDIR) $$dir; \
834836
$(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
835837
fi; \
@@ -863,7 +865,9 @@ unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS))
863865
ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
864866

865867
$(ParallelTargets) :
866-
$(Verb) if [ ! -f $(@D)/Makefile ]; then \
868+
$(Verb) if ([ ! -f $(@D)/Makefile ] || \
869+
[ $(@D)/Makefile -ot \
870+
$(PROJ_SRC_DIR)/$(@D)/Makefile ]); then \
867871
$(MKDIR) $(@D); \
868872
$(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
869873
fi; \
@@ -882,7 +886,8 @@ ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
882886
$(RecursiveTargets)::
883887
$(Verb) for dir in $(OPTIONAL_DIRS); do \
884888
if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
885-
if [ ! -f $$dir/Makefile ]; then \
889+
if ([ ! -f $$dir/Makefile ] || \
890+
[ $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ]); then \
886891
$(MKDIR) $$dir; \
887892
$(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
888893
fi; \

0 commit comments

Comments
 (0)