[llvm-commits] [gcc-plugin] r82451 - in /gcc-plugin/trunk: Makefile get_arch_dir i386/ x86/ x86/llvm-target.cpp x86/llvm-target.h

Duncan Sands baldrick at free.fr
Mon Sep 21 05:29:28 CDT 2009


Author: baldrick
Date: Mon Sep 21 05:29:27 2009
New Revision: 82451

URL: http://llvm.org/viewvc/llvm-project?rev=82451&view=rev
Log:
Rename the i386 directory to x86.  GCC uses i386, but LLVM uses x86.
Don't get the target directory using GCC's config.gcc, use the new
target util instead.

Added:
    gcc-plugin/trunk/x86/
      - copied from r81761, gcc-plugin/trunk/i386/
    gcc-plugin/trunk/x86/llvm-target.cpp
      - copied unchanged from r82316, gcc-plugin/trunk/i386/llvm-target.cpp
    gcc-plugin/trunk/x86/llvm-target.h
      - copied unchanged from r82316, gcc-plugin/trunk/i386/llvm-target.h
Removed:
    gcc-plugin/trunk/get_arch_dir
    gcc-plugin/trunk/i386/
Modified:
    gcc-plugin/trunk/Makefile

Modified: gcc-plugin/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/Makefile?rev=82451&r1=82450&r2=82451&view=diff

==============================================================================
--- gcc-plugin/trunk/Makefile (original)
+++ gcc-plugin/trunk/Makefile Mon Sep 21 05:29:27 2009
@@ -1,34 +1,60 @@
 GCCSOURCE_DIR=$(HOME)/GCC/src/
 GCCOBJECT_DIR=$(HOME)/GCC/objects/
-#GCCPLUGIN_DIR:=$(shell $(GCC) -print-file-name=plugin)
+# Point LLVM_CONFIG to the just built llvm-config to use an LLVM build rather
+# than the installed version of LLVM.
+LLVM_CONFIG=llvm-config
 
 # Replace with an informative string when doing a release.
 REVISION:=$(shell svnversion -n .)
-
 TARGET_TRIPLE:=$(shell $(GCCOBJECT_DIR)/gcc/xgcc -v 2>&1 | grep "^Target:" | sed -e "s/^Target: *//")
-ARCH_DIR:=$(shell TARGET_TRIPLE=$(TARGET_TRIPLE) GCCSOURCE_DIR=$(GCCSOURCE_DIR) $(SHELL) ./get_arch_dir)
 
-C_SOURCE_FILES=llvm-cache.c
-CPP_SOURCE_FILES=llvm-convert.cpp llvm-backend.cpp llvm-debug.cpp \
-		 $(ARCH_DIR)/llvm-target.cpp llvm-types.cpp bits_and_bobs.cpp
-PLUGIN_OBJECT_FILES=$(C_SOURCE_FILES:.c=.o) $(CPP_SOURCE_FILES:.cpp=.o)
+PLUGIN=llvm.so
+PLUGIN_C=llvm-cache.c
+PLUGIN_CPP=llvm-convert.cpp llvm-backend.cpp llvm-debug.cpp llvm-types.cpp \
+	   bits_and_bobs.cpp
+PLUGIN_C_OBJECTS=$(PLUGIN_C:.c=.o)
+PLUGIN_CPP_OBJECTS=$(PLUGIN_CPP:.cpp=.o)
+PLUGIN_OBJECTS=$(PLUGIN_C_OBJECTS) $(PLUGIN_CPP_OBJECTS)
+
+TARGET_CPP=$(shell $(TARGET_UTIL) -p)/llvm-target.cpp
+TARGET_OBJECT=llvm-target.o
+
+TARGET_UTIL=./target
+TARGET_UTIL_OBJECTS=utils/target.o
 
 GENGTYPE_INPUT=$(PWD)/llvm-cache.c
 GENGTYPE_OUTPUT=$(PWD)/gt-llvm-cache.h
 
 CFLAGS+=-Wall -Werror -fPIC -g -O2
-CFLAGS+=-DIN_GCC -DREVISION=\"$(REVISION)\" \
-	-DTARGET_NAME=\"$(TARGET_TRIPLE)\" -I$(ARCH_DIR)
-CFLAGS+=-I$(GCCOBJECT_DIR)/gcc -I$(GCCOBJECT_DIR)/gcc/include \
-	-I$(GCCSOURCE_DIR)/gcc -I$(GCCSOURCE_DIR)/include \
-	-I$(GCCSOURCE_DIR)/libcpp/include -I$(GCCSOURCE_DIR)/libdecnumber \
-	-I$(GCCOBJECT_DIR)/libdecnumber -I.
-CXXFLAGS+=$(CFLAGS) $(shell llvm-config --cppflags)
+CFLAGS+=-DIN_GCC -DREVISION=\"$(REVISION)\" -DTARGET_NAME=\"$(TARGET_TRIPLE)\"
+CXXFLAGS+=$(CFLAGS) $(shell $(LLVM_CONFIG) --cppflags)
+
+LDFLAGS+=$(shell $(LLVM_CONFIG) --libs analysis core ipo scalaropts target) \
+	 $(shell $(LLVM_CONFIG) --ldflags)
+
+PLUGIN_CFLAGS+=-I$(GCCOBJECT_DIR)/gcc -I$(GCCOBJECT_DIR)/gcc/include \
+	       -I$(GCCSOURCE_DIR)/gcc -I$(GCCSOURCE_DIR)/include \
+	       -I$(GCCSOURCE_DIR)/libcpp/include -I$(GCCSOURCE_DIR)/libdecnumber \
+	       -I$(GCCOBJECT_DIR)/libdecnumber -I$(shell $(TARGET_UTIL) -p)
+PLUGIN_CXXFLAGS+=$(PLUGIN_CFLAGS)
+
+default: $(PLUGIN)
+
+$(TARGET_UTIL): $(TARGET_UTIL_OBJECTS)
+	$(CXX) $^ -o $@ $(CXXFLAGS) $(LDFLAGS)
+
+$(PLUGIN_C_OBJECTS): %.o : %.c
+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PLUGIN_CFLAGS) $<
+
+$(PLUGIN_CPP_OBJECTS): %.o : %.cpp
+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(PLUGIN_CXXFLAGS) $<
 
-LDFLAGS+=$(shell llvm-config --ldflags) $(shell llvm-config --libs analysis core ipo scalaropts target x86)
+$(TARGET_OBJECT):
+	$(CXX) -c $(TARGET_CPP) -o $@ $(CPPFLAGS) $(CXXFLAGS) $(PLUGIN_CXXFLAGS) -I.
 
-llvm.so: $(PLUGIN_OBJECT_FILES)
-	$(CXX) -shared $^ -o $@ $(LDFLAGS)
+$(PLUGIN): $(TARGET_UTIL) $(PLUGIN_OBJECTS) $(TARGET_OBJECT)
+	$(CXX) -shared $(PLUGIN_OBJECTS) $(TARGET_OBJECT) -o $@ $(LDFLAGS) \
+	$(shell $(LLVM_CONFIG) --libs $(shell $(TARGET_UTIL) -p))
 
 llvm-cache.o: gt-llvm-cache.h
 
@@ -40,4 +66,4 @@
 	sed -i "s/ggc_root_tab .*\[\]/ggc_root_tab gt_pch_rc__gt_llvm_cache_h[]/" $(GENGTYPE_OUTPUT)
 
 clean::
-	rm -f *.o *.so $(ARCH_DIR)/*.o
+	rm -f *.o */*.o $(PLUGIN) $(TARGET_UTIL)

Removed: gcc-plugin/trunk/get_arch_dir
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/get_arch_dir?rev=82450&view=auto

==============================================================================
--- gcc-plugin/trunk/get_arch_dir (original)
+++ gcc-plugin/trunk/get_arch_dir (removed)
@@ -1,3 +0,0 @@
-export target=$TARGET_TRIPLE
-. $GCCSOURCE_DIR/gcc/config.gcc
-echo $cpu_type





More information about the llvm-commits mailing list