CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
ifeq ($(OS),HP-UX)
- CompileCommonOpts += -D_REENTRANT -D_HPUX_SOURCE
+ CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
endif
LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
# Object Build Rules: Build object files based on sources
###############################################################################
+# FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
+ifeq ($(OS),HP-UX)
+ DISABLE_AUTO_DEPENDENCIES=1
+endif
+
# Provide rule sets for when dependency generation is enabled
ifndef DISABLE_AUTO_DEPENDENCIES
ifdef DEBUG_RUNTIME
$(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(GCCAS)
$(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
- @$(GCCAS) $< -o $@
+ @$(GCCAS) $< -o $@
else
$(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(GCCAS)
$(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
%.c: %.l
%.cpp: %.l
+all:: $(LexFiles:%.l=$(PROJ_SRC_DIR)/%.cpp.cvs)
+
# Note the extra sed filtering here, used to cut down on the warnings emited
# by GCC. The last line is a gross hack to work around flex aparently not
# being able to resize the buffer on a large token input. Currently, for
$(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
$(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
> $(PROJ_SRC_DIR)/$*.cpp
- $(Echo) "*** DON'T FORGET TO CHECK IN $*.cpp (generated file)"
-
-LexObjs := $(patsubst %.l,$(ObjDir)/%.o,$(LexFiles))
-$(LexObjs): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
+
+# IFF the .l file has changed since it was last checked into CVS, copy the .l
+# file to .l.cvs and the generated .cpp file to .cpp.cvs. We use this mechanism
+# so that people without flex can build LLVM by copying the .cvs files to the
+# source location and building them.
+$(LexFiles:%.l=$(PROJ_SRC_DIR)/%.cpp.cvs): \
+$(PROJ_SRC_DIR)/%.cpp.cvs: $(PROJ_SRC_DIR)/%.cpp
+ $(Verb) $(CMP) -s $(PROJ_SRC_DIR)/$*.l $(PROJ_SRC_DIR)/$*.l.cvs || \
+ ($(CP) $< $@; $(CP) $(PROJ_SRC_DIR)/$*.l $(PROJ_SRC_DIR)/$*.l.cvs)
+
+$(LexFiles:%.l=$(ObjDir)/%.o) : \
+$(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
clean-local::
-$(Verb) $(RM) -f $(LexOutput)
.PRECIOUS: $(YaccOutput)
+all:: $(YaccFiles:%.y=$(PROJ_SRC_DIR)/%.cpp.cvs)
+
# Cancel built-in rules for yacc
%.c: %.y
%.cpp: %.y
$(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
$(Verb) $(MV) -f $*.tab.c $(PROJ_SRC_DIR)/$*.cpp
$(Verb) $(MV) -f $*.tab.h $(PROJ_SRC_DIR)/$*.h
- $(Echo) "*** DON'T FORGET TO CHECK IN $*.cpp and $*.h (generated files)"
-YaccObjs := $(patsubst %.y,$(ObjDir)/%.o,$(YaccFiles))
-$(YaccObjs): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
+# IFF the .y file has changed since it was last checked into CVS, copy the .y
+# file to .y.cvs and the generated .cpp/.h file to .cpp.cvs/.h.cvs. We use this
+# mechanism so that people without flex can build LLVM by copying the .cvs files
+# to the source location and building them.
+$(YaccFiles:%.y=$(PROJ_SRC_DIR)/%.cpp.cvs): \
+$(PROJ_SRC_DIR)/%.cpp.cvs: $(PROJ_SRC_DIR)/%.cpp
+ $(Verb) $(CMP) -s $(PROJ_SRC_DIR)/$*.y $(PROJ_SRC_DIR)/$*.y.cvs || \
+ ($(CP) $< $@; \
+ $(CP) $(PROJ_SRC_DIR)/$*.y $(PROJ_SRC_DIR)/$*.y.cvs; \
+ $(CP) $(PROJ_SRC_DIR)/$*.h $(PROJ_SRC_DIR)/$*.h.cvs)
+
+
+$(YaccFiles:%.y=$(ObjDir)/%.o): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
-YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.output)
+YaccOutput := $(YaccFiles:%.y=%.output)
clean-local::
-$(Verb) $(RM) -f $(YaccOutput)
# Get the list of dependency files
DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
-DependFiles := $(patsubst %,$(PROJ_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
+DependFiles := $(DependFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
-include /dev/null $(DependFiles)