[llvm-commits] CVS: llvm/Makefile.rules

Reid Spencer reid at x10sys.com
Thu Dec 16 09:43:36 PST 2004


On Thu, 2004-12-16 at 09:29, Chris Lattner wrote:
>  #---------------------------------------------------------
>  ifdef SHARED_LIBRARY
>  
> -$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
> +$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
>  	$(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
>  	$(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
>  	then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
>  	else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
>  
> -$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir 
> +$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
>  	$(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
>  	$(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
>  	then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \

Is it really necessary to add $(BUILT_SOURCES) back into these rules?
The "all" target now properly depends on BUILT_SOURCES.
> @@ -950,49 +950,103 @@
>  
>  TDFiles := $(strip $(wildcard $(BUILD_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
>  INCFiles := $(filter %.inc,$(BUILT_SOURCES))
> +INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
> +.PRECIOUS: $(INCTMPFiles) $(INCFiles)

With .PRECIOUS you are asking for the INC and TMP files to NOT be
removed by make if an error occurs while building them. In general that
is a bad idea because the files might be partially constructed leading
to error on the next build.

> -%GenRegisterNames.inc : %.td 
> +
> +$(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \
> +$(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir
>  	$(Echo) "Building $(<F) register names with tblgen"
>  	$(Verb) $(TableGen) -gen-register-enums -o $@ $<
>  

This looks fine to me. 

> -%GenRegisterInfo.h.inc : %.td 
> +$(TARGET:%=%GenRegisterNames.inc): \
> +%GenRegisterNames.inc : $(ObjDir)/%GenRegisterNames.inc.tmp
> +	$(Verb) cmp -s $@ $< || cp $< $@
> +
I'll do the conversion of cmp -> $(CMP) and cp -> $(CP).

Rest looks good.

Reid.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20041216/c7099abd/attachment.sig>


More information about the llvm-commits mailing list