[llvm-commits] [dragonegg] r96030 - in /dragonegg/trunk: Makefile TODO
Duncan Sands
baldrick at free.fr
Fri Feb 12 14:47:37 PST 2010
Author: baldrick
Date: Fri Feb 12 16:47:36 2010
New Revision: 96030
URL: http://llvm.org/viewvc/llvm-project?rev=96030&view=rev
Log:
Automatically generate dependencies, so modifying a header file will cause
the source files that use it to be rebuilt. Simplify the Makefile somewhat
while there.
Modified:
dragonegg/trunk/Makefile
dragonegg/trunk/TODO
Modified: dragonegg/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/Makefile?rev=96030&r1=96029&r2=96030&view=diff
==============================================================================
--- dragonegg/trunk/Makefile (original)
+++ dragonegg/trunk/Makefile Fri Feb 12 16:47:36 2010
@@ -1,32 +1,41 @@
+# Specify the gcc executable you will use the dragonegg plugin with here.
GCC?=gcc-4.5
-GCCSOURCE_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.
+
+# Specify the copy of LLVM you will build the plugin against by giving its
+# llvm-config here. To use an installed copy of LLVM, specify the installed
+# llvm-config (just 'llvm-config' is enough if llvm-config is in your path).
+# It is not necessary to install LLVM to build dragonegg against it. Instead
+# you can do an LLVM build and point LLVM_CONFIG to the copy of llvm-config
+# that was created during the build.
LLVM_CONFIG?=llvm-config
-# Replace with an informative string when doing a release.
-REVISION:=$(shell svnversion -n .)
-TARGET_TRIPLE:=$(shell $(GCC) -v 2>&1 | grep "^Target:" | sed -e "s/^Target: *//")
PLUGIN=dragonegg.so
-PLUGIN_C=llvm-cache.c
-PLUGIN_CPP=llvm-convert.cpp llvm-backend.cpp llvm-debug.cpp llvm-types.cpp \
- bits_and_bobs.cpp llvm-abi-default.cpp
-PLUGIN_C_OBJECTS=$(PLUGIN_C:.c=.o)
-PLUGIN_CPP_OBJECTS=$(PLUGIN_CPP:.cpp=.o)
-PLUGIN_OBJECTS=$(PLUGIN_C_OBJECTS) $(PLUGIN_CPP_OBJECTS)
+PLUGIN_OBJECTS=llvm-cache.o llvm-convert.o llvm-backend.o llvm-debug.o \
+ llvm-types.o bits_and_bobs.o llvm-abi-default.o
-TARGET_CPP=$(shell $(TARGET_UTIL) -p)/llvm-target.cpp
TARGET_OBJECT=llvm-target.o
+TARGET_SOURCE=$(shell $(TARGET_UTIL) -p)/llvm-target.cpp
+TARGET_UTIL_OBJECTS=target.o
TARGET_UTIL=./target
-TARGET_UTIL_OBJECTS=utils/target.o
+
+ALL_OBJECTS=$(PLUGIN_OBJECTS) $(TARGET_OBJECT) $(TARGET_UTIL_OBJECTS)
+
GENGTYPE_INPUT=$(PWD)/llvm-cache.c
GENGTYPE_OUTPUT=$(PWD)/gt-llvm-cache.h
+
+GCCSOURCE_DIR=$(shell $(GCC) -print-file-name=plugin)
+TARGET_TRIPLE:=$(shell $(GCC) -v 2>&1 | grep "^Target:" | sed -e "s/^Target: *//")
+
+# NOTE: replace with an informative string when doing a release.
+REVISION:=$(shell svnversion -n .)
+
CFLAGS+=-Wall -Werror -fPIC -g -O2
CFLAGS+=-DIN_GCC -DREVISION=\"$(REVISION)\" -DTARGET_NAME=\"$(TARGET_TRIPLE)\"
+CPPFLAGS+=-MD -MP
CXXFLAGS+=$(CFLAGS) $(shell $(LLVM_CONFIG) --cppflags)
LDFLAGS+=$(shell $(LLVM_CONFIG) --libs analysis core ipo scalaropts target) \
@@ -34,35 +43,43 @@
PLUGIN_CFLAGS+=-I$(GCCSOURCE_DIR)/gcc -I$(GCCSOURCE_DIR)/include \
-I$(GCCSOURCE_DIR)/libcpp/include -I$(GCCSOURCE_DIR)/libdecnumber \
- -I$(shell $(TARGET_UTIL) -p) -I$(shell $(TARGET_UTIL) -o)
+ -I$(shell $(TARGET_UTIL) -p) -I$(shell $(TARGET_UTIL) -o)
PLUGIN_CXXFLAGS+=$(PLUGIN_CFLAGS)
+
default: $(PLUGIN)
+$(TARGET_UTIL_OBJECTS): %.o : utils/%.cpp
+ $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $<
+
$(TARGET_UTIL): $(TARGET_UTIL_OBJECTS)
- $(CXX) $^ -o $@ $(CXXFLAGS) $(LDFLAGS)
+ $(CXX) -o $@ $^ $(LDFLAGS)
-$(PLUGIN_C_OBJECTS): %.o : %.c $(TARGET_UTIL)
+%.o : %.c $(TARGET_UTIL)
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PLUGIN_CFLAGS) $<
-$(PLUGIN_CPP_OBJECTS): %.o : %.cpp $(TARGET_UTIL)
+%.o : %.cpp $(TARGET_UTIL)
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(PLUGIN_CXXFLAGS) $<
$(TARGET_OBJECT): $(TARGET_UTIL)
- $(CXX) -c $(TARGET_CPP) -o $@ $(CPPFLAGS) $(CXXFLAGS) $(PLUGIN_CXXFLAGS) -I.
+ $(CXX) -o $@ -c $(CPPFLAGS) $(CXXFLAGS) $(PLUGIN_CXXFLAGS) -I. \
+ $(TARGET_SOURCE)
-$(PLUGIN): $(TARGET_UTIL) $(PLUGIN_OBJECTS) $(TARGET_OBJECT)
+$(PLUGIN): $(PLUGIN_OBJECTS) $(TARGET_OBJECT) $(TARGET_UTIL)
$(CXX) -shared $(PLUGIN_OBJECTS) $(TARGET_OBJECT) -o $@ $(LDFLAGS) \
$(shell $(LLVM_CONFIG) --libs $(shell $(TARGET_UTIL) -p))
-llvm-cache.o: gt-llvm-cache.h
+clean::
+ rm -f *.o *.d $(PLUGIN) $(TARGET_UTIL)
+
+-include $(ALL_OBJECTS:.o=.d)
+
+# The following target exists for the benefit of the dragonegg maintainers, and
+# is not used in a normal build.
gt-llvm-cache.h:
cd $(HOME)/GCC/objects/gcc && ./build/gengtype \
-P $(GENGTYPE_OUTPUT) $(GCCSOURCE_DIR) gtyp-input.list \
$(GENGTYPE_INPUT)
sed -i "s/ggc_cache_tab .*\[\]/ggc_cache_tab gt_ggc_rc__gt_llvm_cache_h[]/" $(GENGTYPE_OUTPUT)
sed -i "s/ggc_root_tab .*\[\]/ggc_root_tab gt_pch_rc__gt_llvm_cache_h[]/" $(GENGTYPE_OUTPUT)
-
-clean::
- rm -f *.o */*.o $(PLUGIN) $(TARGET_UTIL)
Modified: dragonegg/trunk/TODO
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/TODO?rev=96030&r1=96029&r2=96030&view=diff
==============================================================================
--- dragonegg/trunk/TODO (original)
+++ dragonegg/trunk/TODO Fri Feb 12 16:47:36 2010
@@ -19,10 +19,6 @@
llvm-target.h. Maybe LLVM_TARGET_INTRINSIC_PREFIX could go too. An annoyance
is that the target tool returns "x86" while what is needed is "X86".
-Teach the build system that the plugin needs to be rebuilt if any of the bits of
-LLVM/gcc it depends on changes.
-
-
Optimizations
-------------
@@ -43,7 +39,6 @@
Unify the code that determines which LLVM linkage type to use. Need to do
a bunch of experimenting to work out how the mapping should really be done.
-
Code quality
------------
More information about the llvm-commits
mailing list