Factor platform specific makefile directives out into their own makefile
[oota-llvm.git] / Makefile.common
index 8e298946adbee101761dc4b03aaced26a5c941cb..38a4e66cf6a9c0315a9658a041ee86cf855058fb 100644 (file)
@@ -46,6 +46,14 @@ include $(LEVEL)/Makefile.config
 #
 #ENABLE_OPTIMIZED = 1
 
+
+# Figure out how to do platform specific stuff on this platform.  This is really
+# gross and should be autoconfiscated (automake actually), but should hopefully
+# work on Linux and solaris (SunOS).
+#
+UNAME := $(shell uname)
+include $(LEVEL)/Makefile.$(UNAME)
+
 ifdef SHARED_LIBRARY
 # if SHARED_LIBRARY is specified, the default is to build the dynamic lib
 dynamic ::
@@ -118,6 +126,9 @@ else
 PROFILE =
 endif
 
+# Allow gnu extensions...
+CPPFLAGS += -D_GNU_SOURCE
+
 # -Wno-unused-parameter
 CompileCommonOpts := $(PROFILE) -Wall -W  -Wwrite-strings -Wno-unused -I$(LEVEL)/include
 
@@ -136,14 +147,13 @@ endif
 LinkG    := $(Link) -g  -L $(LIBDEBUG)
 LinkO    := $(Link) -O3 -L $(LIBRELEASE)
 
-# Create a .so file from a .o files...
-#MakeSO   := $(CXX) -shared $(PROFILE)
-MakeSO   := $(CXX) -G $(PROFILE)
-MakeSOO  := $(MakeSO) -O3
-
 # Create one .o file from a bunch of .o files...
 Relink = ld -r
 
+# MakeSO - Create a .so file from a .o files...
+MakeSO   := $(CXX) $(MakeSharedObjectOption) $(PROFILE)
+MakeSOO  := $(MakeSO) -O3
+
 # Create dependancy file from CPP file, send to stdout.
 Depend   := $(CXX) -MM -I$(LEVEL)/include $(CPPFLAGS) 
 
@@ -304,9 +314,11 @@ clean::
        $(VERB) rm -f $(TOOLEXENAMES)
 
 $(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(BUILD_ROOT_TOP)/tools/Debug/.dir
+       @echo ======= Linking $(TOOLNAME) debug executable =======
        $(VERB) $(LinkG) -o $@ $(ObjectsG) $(USED_LIBS_OPTIONS_G) $(TOOLLINKOPTS)
 
 $(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(BUILD_ROOT_TOP)/tools/Release/.dir
+       @echo ======= Linking $(TOOLNAME) release executable =======
        $(VERB) $(LinkO) -o $@ $(ObjectsG) $(USED_LIBS_OPTIONS_O) $(TOOLLINKOPTS)
 
 endif