Files moved to CodeGen/PreOpts.
[oota-llvm.git] / Makefile.rules
index 38a4e66cf6a9c0315a9658a041ee86cf855058fb..41afc1aa1e6ab995633082c3b4dedbd5a3b7f548 100644 (file)
 #    example, ../.. for two levels deep.
 #
 # 2. DIRS - A list of subdirectories to be built.  Fake targets are set up
-#    so that each of the targets "all", "install", and "clean" each build.
-#    the subdirectories before the local target.
+#    so that each of the targets "all", "install", and "clean" each build
+#    the subdirectories before the local target.  DIRS are guaranteed to be
+#    built in order.
 #
-# 3. Source - If specified, this sets the source code filenames.  If this
+# 3. PARALLEL_DIRS - A list of subdirectories to be built, but that may be
+#    built in any order.  All DIRS are built in order before PARALLEL_DIRS are
+#    built, which are then built in any order.
+#
+# 4. Source - If specified, this sets the source code filenames.  If this
 #    is not set, it defaults to be all of the .cpp, .c, .y, and .l files 
 #    in the current directory.  Also, if you want to build files in addition
 #    to the local files, you can use the ExtraSource variable
@@ -116,8 +121,12 @@ endif
 # Compilation options...
 #---------------------------------------------------------
 
-# Special tools used while building
-RunBurg  := $(BURG) $(BURG_OPTS)
+# Special tools used while building the LLVM tree.  Burg is built as part of the
+# utils directory.
+#
+BURG    := $(LEVEL)/utils/Burg/burg
+RunBurg := $(BURG) $(BURG_OPTS)
+
 
 # Enable this for profiling support with 'gprof'
 ifdef ENABLE_PROFILING
@@ -126,6 +135,13 @@ else
 PROFILE =
 endif
 
+# By default, strip symbol information from executable
+ifdef KEEP_SYMBOLS
+STRIP =
+else
+STRIP = -s
+endif
+
 # Allow gnu extensions...
 CPPFLAGS += -D_GNU_SOURCE
 
@@ -144,7 +160,7 @@ Link     := $(PURIFY) $(CXX) $(PROFILE) -static
 else
 Link     := $(CXX) $(PROFILE)
 endif
-LinkG    := $(Link) -g  -L $(LIBDEBUG)
+LinkG    := $(Link) -g  -L $(LIBDEBUG) $(STRIP)
 LinkO    := $(Link) -O3 -L $(LIBRELEASE)
 
 # Create one .o file from a bunch of .o files...
@@ -169,22 +185,30 @@ AR       = ar cq
 Source  := $(ExtraSource) $(wildcard *.cpp *.c *.y *.l)
 
 Objs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(basename $(Source)))))
-ObjectsO = $(addprefix $(BUILD_ROOT)/Release/,$(Objs)))
-ObjectsG = $(addprefix $(BUILD_ROOT)/Debug/,$(Objs))
+ObjectsO := $(addprefix $(BUILD_ROOT)/Release/,$(Objs)))
+ObjectsG := $(addprefix $(BUILD_ROOT)/Debug/,$(Objs))
 
 
 #---------------------------------------------------------
-# Handle the DIRS option
+# Handle the DIRS and PARALLEL_DIRS options
 #---------------------------------------------------------
 
-ifdef DIRS  # Only do this if we're using DIRS!
+ifdef DIRS
+all install clean ::
+       $(VERB) for dir in ${DIRS}; do \
+               (cd $$dir; $(MAKE) $@) || exit 1; \
+       done
+endif
 
-all     :: $(addsuffix /.makeall    , $(DIRS))
-install :: $(addsuffix /.makeinstall, $(DIRS))
-clean   :: $(addsuffix /.makeclean  , $(DIRS))
+# Handle PARALLEL_DIRS
+ifdef PARALLEL_DIRS
+all     :: $(addsuffix /.makeall    , $(PARALLEL_DIRS))
+install :: $(addsuffix /.makeinstall, $(PARALLEL_DIRS))
+clean   :: $(addsuffix /.makeclean  , $(PARALLEL_DIRS))
 
-%/.makeall %/.makeclean %/.makeinstall:
+%/.makeall %/.makeinstall %/.makeclean:
        $(VERB) cd $(@D); $(MAKE) $(subst $(@D)/.make,,$@)
+
 endif
 
 #---------------------------------------------------------
@@ -206,6 +230,9 @@ endif
 
 ifdef LIBRARYNAME
 
+# Make sure there isn't any extranous whitespace on the LIBRARYNAME option
+LIBRARYNAME := $(strip $(LIBRARYNAME))
+
 LIBNAME_O    := $(LIBRELEASE)/lib$(LIBRARYNAME).so
 LIBNAME_G    := $(LIBDEBUG)/lib$(LIBRARYNAME).so
 LIBNAME_AO   := $(LIBRELEASE)/lib$(LIBRARYNAME).a