[vmkit-commits] [vmkit] r180389 - define the executable rule

Peter Senna Tschudin peter.senna at gmail.com
Thu Apr 25 10:15:03 PDT 2013


Author: peter.senna
Date: Thu Apr 25 12:04:32 2013
New Revision: 180389

URL: http://llvm.org/viewvc/llvm-project?rev=180389&view=rev
Log:
define the executable rule
(cherry picked from commit 8c5621d3acf29731b99fe2cf9d47c7045ab8110d)

Added:
    vmkit/trunk/tools/trainer/
    vmkit/trunk/tools/trainer/HelloWorld.java
      - copied, changed from r180388, vmkit/trunk/tools/precompiler/trainer/HelloWorld.java
    vmkit/trunk/tools/trainer/Makefile
      - copied, changed from r180388, vmkit/trunk/tools/precompiler/trainer/Makefile
Removed:
    vmkit/trunk/tools/precompiler/trainer/HelloWorld.java
    vmkit/trunk/tools/precompiler/trainer/Makefile
Modified:
    vmkit/trunk/Makefile
    vmkit/trunk/Makefile.common.llvm
    vmkit/trunk/Makefile.rules
    vmkit/trunk/tools/precompiler/Makefile

Modified: vmkit/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile?rev=180389&r1=180388&r2=180389&view=diff
==============================================================================
--- vmkit/trunk/Makefile (original)
+++ vmkit/trunk/Makefile Thu Apr 25 12:04:32 2013
@@ -13,7 +13,7 @@ include $(LEVEL)/Makefile.config
 
 # Top-Level vmkit Build Stages:
 #
-DIRS := lib/vmkit/StaticGCPass lib/vmkit/StaticGCPrinter lib tools/vmjc mmtk tools/precompiler tools
+DIRS := lib/vmkit/StaticGCPass lib/vmkit/StaticGCPrinter lib tools/vmjc mmtk tools/precompiler tools/trainer tools
 
 EXTRA_DIST=include
 

Modified: vmkit/trunk/Makefile.common.llvm
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile.common.llvm?rev=180389&r1=180388&r2=180389&view=diff
==============================================================================
--- vmkit/trunk/Makefile.common.llvm (original)
+++ vmkit/trunk/Makefile.common.llvm Thu Apr 25 12:04:32 2013
@@ -1776,160 +1776,6 @@ endif
 # endif LIBRARYNAME
 endif
 
-###############################################################################
-# Tool Build Rules: Build executable tool based on TOOLNAME option
-###############################################################################
-
-ifdef TOOLNAME
-
-#---------------------------------------------------------
-# Set up variables for building a tool.
-#---------------------------------------------------------
-TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
-ifdef EXAMPLE_TOOL
-ToolBuildPath   := $(ExmplDir)/$(TOOLEXENAME)
-else
-ToolBuildPath   := $(ToolDir)/$(TOOLEXENAME)
-endif
-
-# TOOLALIAS is a name to symlink (or copy) the tool to.
-ifdef TOOLALIAS
-ifdef EXAMPLE_TOOL
-ToolAliasBuildPath   := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
-else
-ToolAliasBuildPath   := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
-endif
-endif
-
-#---------------------------------------------------------
-# Prune Exports
-#---------------------------------------------------------
-
-# If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
-# not exporting all of the weak symbols from the binary.  This reduces dyld
-# startup time by 4x on darwin in some cases.
-ifdef TOOL_NO_EXPORTS
-ifeq ($(HOST_OS),Darwin)
-
-# Tiger tools don't support this.
-ifneq ($(DARWIN_MAJVERS),4)
-LD.Flags += -Wl,-exported_symbol,_main
-endif
-endif
-
-ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU))
-ifneq ($(ARCH), Mips)
-  LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
-endif
-endif
-endif
-
-#---------------------------------------------------------
-# Tool Order File Support
-#---------------------------------------------------------
-
-ifeq ($(HOST_OS),Darwin)
-ifdef TOOL_ORDER_FILE
-
-LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
-
-endif
-endif
-
-#---------------------------------------------------------
-# Tool Version Info Support
-#---------------------------------------------------------
-
-ifeq ($(HOST_OS),Darwin)
-ifdef TOOL_INFO_PLIST
-
-LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST)
-
-$(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST)
-
-$(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir
-	$(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..."
-	$(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \
-	           -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \
-	           -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \
-	         -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \
-	           $< > $@
-
-endif
-endif
-
-#---------------------------------------------------------
-# Provide targets for building the tools
-#---------------------------------------------------------
-all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
-
-clean-local::
-ifneq ($(strip $(ToolBuildPath)),)
-	-$(Verb) $(RM) -f $(ToolBuildPath)
-endif
-ifneq ($(strip $(ToolAliasBuildPath)),)
-	-$(Verb) $(RM) -f $(ToolAliasBuildPath)
-endif
-
-ifdef EXAMPLE_TOOL
-$(ToolBuildPath): $(ExmplDir)/.dir
-else
-$(ToolBuildPath): $(ToolDir)/.dir
-endif
-
-ifneq ($(strip $(ToolAliasBuildPath)),)
-$(ToolAliasBuildPath): $(ToolBuildPath)
-	$(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
-	$(Verb) $(RM) -f $(ToolAliasBuildPath)
-	$(Verb) $(AliasTool) $(notdir $(ToolBuildPath)) $(ToolAliasBuildPath)
-	$(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
-          $(StripWarnMsg)
-endif
-
-ifdef NO_INSTALL
-install-local::
-	$(Echo) Install circumvented with NO_INSTALL
-uninstall-local::
-	$(Echo) Uninstall circumvented with NO_INSTALL
-else
-
-ifdef INTERNAL_TOOL
-ToolBinDir = $(DESTDIR)$(PROJ_internal_prefix)/bin
-else
-ToolBinDir = $(DESTDIR)$(PROJ_bindir)
-endif
-DestTool = $(ToolBinDir)/$(program_prefix)$(TOOLEXENAME)
-
-install-local:: $(DestTool)
-
-$(DestTool): $(ToolBuildPath)
-	$(Echo) Installing $(BuildMode) $(DestTool)
-	$(Verb) $(MKDIR) $(ToolBinDir)
-	$(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
-
-uninstall-local::
-	$(Echo) Uninstalling $(BuildMode) $(DestTool)
-	-$(Verb) $(RM) -f $(DestTool)
-
-# TOOLALIAS install.
-ifdef TOOLALIAS
-DestToolAlias = $(ToolBinDir)/$(program_prefix)$(TOOLALIAS)$(EXEEXT)
-
-install-local:: $(DestToolAlias)
-
-$(DestToolAlias): $(DestTool)
-	$(Echo) Installing $(BuildMode) $(DestToolAlias)
-	$(Verb) $(RM) -f $(DestToolAlias)
-	$(Verb) $(AliasTool) $(notdir $(DestTool)) $(DestToolAlias)
-
-uninstall-local::
-	$(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
-	-$(Verb) $(RM) -f $(DestToolAlias)
-endif
-
-endif
-endif
-
 
 ###############################################################################
 # OTHER RULES: Other rules needed

Modified: vmkit/trunk/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile.rules?rev=180389&r1=180388&r2=180389&view=diff
==============================================================================
--- vmkit/trunk/Makefile.rules (original)
+++ vmkit/trunk/Makefile.rules Thu Apr 25 12:04:32 2013
@@ -33,21 +33,6 @@ LIBDIR=$(PROJ_OBJ_ROOT)/$(BUILD_NAME)/li
 INCDIR=$(PROJ_OBJ_ROOT)/$(BUILD_NAME)/include
 BUILD_DIR=$(BUILD_NAME)
 
-%/.dir:
-	mkdir -p $(dir $@) && touch $@
-
-clean::
-	$(Echo) "Cleaning compilation files"
-	$(Verb) rm -Rf $(BUILD_DIR)
-
-distclean::
-	$(Echo) "Cleaning build files"
-	$(Verb) rm -Rf $(BINDIR) $(LIBDIR) $(INCDIR)
-
-ifeq ($(DEBUG),1)
-  COMMON_CFLAGS+=-g
-endif
-
 LLVM_BIN=$(shell $(LLVM_CONFIG) --bindir)
 
 CLANG=$(LLVM_BIN)/clang
@@ -64,12 +49,43 @@ RM=rm
 NM=nm
 LD=ld
 LArchive=$(LLVM_BIN)/llvm-ar rcsf
+MKDIR=mkdir -p
+TOUCH=touch
+
+%/.dir:
+	$(Verb) $(MKDIR) $(dir $@) && $(TOUCH) $@
+
+clean::
+	$(Echo) "Cleaning compilation files"
+	$(Verb) $(RM) -Rf $(BUILD_DIR)
+
+distclean::
+	$(Echo) "Cleaning build files"
+	$(Verb) $(RM) -Rf $(BINDIR) $(LIBDIR) $(INCDIR)
+
+ifeq ($(DEBUG),1)
+  COMMON_CFLAGS+=-g
+endif
 
 ###############################################################################
-#   Linking options
+#   Autodependencies
+###############################################################################
+#SELF=$(PROJ_SRC_ROOT)/Makefile.rules Makefile $(PROJ_SRC_ROOT)/Makefile.common
+
+###############################################################################
+#   Linking
 ###############################################################################
 USEDLIBS:=$(patsubst %,$(LibDir)/lib%,$(USEDLIBS))
 
+ifdef TOOLNAME
+all:: $(BINDIR)/$(TOOLNAME)$(EXEEXT)
+
+$(BINDIR)/$(TOOLNAME)$(EXEEXT): $(ObjectsO) $(USEDLIBS) $(SELF) $(BINDIR)/.dir
+	$(Echo) '**[30] Linking executable $(TOOLNAME)'
+	$(Verb) $(CLANGXX) -o $@ $(ObjectsO) $(USEDLIBS) $(MY_LIBS) $(MY_LDFLAGS) 
+
+endif
+
 #
 #
 # OLD BUILD SYSTEM

Modified: vmkit/trunk/tools/precompiler/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/precompiler/Makefile?rev=180389&r1=180388&r2=180389&view=diff
==============================================================================
--- vmkit/trunk/tools/precompiler/Makefile (original)
+++ vmkit/trunk/tools/precompiler/Makefile Thu Apr 25 12:04:32 2013
@@ -10,7 +10,6 @@ LEVEL = ../..
 
 include $(LEVEL)/Makefile.config
 
-DIRS = trainer
 TOOLNAME = precompiler
 USEDLIBS = Classpath.a J3.a J3Compiler.a Vmkit.a VmkitCompiler.a CommonThread.a FinalMMTk.a Classpath.a J3.a J3Compiler.a Vmkit.a VmkitCompiler.a CommonThread.a FinalMMTk.a
 BUILD_FRAMETABLE = 1

Removed: vmkit/trunk/tools/precompiler/trainer/HelloWorld.java
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/precompiler/trainer/HelloWorld.java?rev=180388&view=auto
==============================================================================
--- vmkit/trunk/tools/precompiler/trainer/HelloWorld.java (original)
+++ vmkit/trunk/tools/precompiler/trainer/HelloWorld.java (removed)
@@ -1,8 +0,0 @@
-class HelloWorld {
-
-  public static final String str = "Hello World";
-
-  public static void main(String[] args) {
-    System.out.println(str);
-  }
-}

Removed: vmkit/trunk/tools/precompiler/trainer/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/precompiler/trainer/Makefile?rev=180388&view=auto
==============================================================================
--- vmkit/trunk/tools/precompiler/trainer/Makefile (original)
+++ vmkit/trunk/tools/precompiler/trainer/Makefile (removed)
@@ -1,56 +0,0 @@
-##===- tools/precompiler/trainer/Makefile ------------------*- Makefile -*-===##
-# 
-#                     The VMKit project
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-# 
-##===----------------------------------------------------------------------===##
-LEVEL = ../../..
-
-EXTRA_DIST = HelloWorld.java
-
-include $(LEVEL)/Makefile.config
-
-BUILT_SOURCES = Precompiled.bc BootstrapClasses.bc
-
-include $(LEVEL)/Makefile.common
-
-PRECOMPILER := $(ToolDir)/precompiler$(EXEEXT)
-
-ifndef VERBOSE
-  J3.Flags := > /dev/null
-endif
-
-HelloWorld.class: HelloWorld.java
-	$(Echo) "Compiling trainer"
-	$(Verb) javac -source $(JAVAC_TARGET) -target $(JAVAC_TARGET) $< -d .
-
-generated.bc: $(PRECOMPILER) HelloWorld.class
-	$(Echo) "Pre-compiling bootstrap code"
-	$(Verb) $(PRECOMPILER) -cp $$PWD HelloWorld $(J3.Flags)
-
-Precompiled.bc: HelloWorld.class $(LibDir)/StaticGCPass$(SHLIBEXT) $(LibDir)/StaticGCPrinter$(SHLIBEXT) generated.bc
-	$(Echo) "Building precompiled bootstrap code"
-	$(Verb) $(MKDIR) $(ObjDir)
-	$(Verb) $(LLC) -disable-branch-fold -disable-cfi -disable-debug-info-print -disable-fp-elim $(PRECOMPILER_FLAGS) -load=$(LibDir)/StaticGCPrinter$(SHLIBEXT) generated.bc -o $(ObjDir)/Precompiled.s
-	$(Verb) $(CC) -c $(ObjDir)/Precompiled.s -o $(ObjDir)/Precompiled.o
-	$(Verb) $(Archive) $(LibDir)/libPrecompiled.a $(ObjDir)/Precompiled.o
-	$(Verb) $(Ranlib) $(LibDir)/libPrecompiled.a
-	$(Verb) $(CP) generated.bc Precompiled.bc
-
-classes.bc: $(PRECOMPILER)
-	$(Echo) "Pre-compiling classes"
-	$(Verb) $(PRECOMPILER) -emit-class-bytes $(J3.Flags)
-
-BootstrapClasses.bc: classes.bc
-	$(Echo) "Building precompiled classes"
-	$(Verb) $(MKDIR) $(ObjDir)
-	$(Verb) $(LLC) classes.bc -o $(ObjDir)/BootstrapClasses.s
-	$(Verb) $(CC) -c $(ObjDir)/BootstrapClasses.s -o $(ObjDir)/BootstrapClasses.o
-	$(Verb) $(Archive) $(LibDir)/libBootstrapClasses.a $(ObjDir)/BootstrapClasses.o
-	$(Verb) $(Ranlib) $(LibDir)/libBootstrapClasses.a
-	$(Verb) $(CP) classes.bc BootstrapClasses.bc
-
-clean-local::
-	$(Verb) $(RM) -f HelloWorld.class generated.bc classes.bc Precompiled.bc BootstrapClasses.bc

Copied: vmkit/trunk/tools/trainer/HelloWorld.java (from r180388, vmkit/trunk/tools/precompiler/trainer/HelloWorld.java)
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/trainer/HelloWorld.java?p2=vmkit/trunk/tools/trainer/HelloWorld.java&p1=vmkit/trunk/tools/precompiler/trainer/HelloWorld.java&r1=180388&r2=180389&rev=180389&view=diff
==============================================================================
    (empty)

Copied: vmkit/trunk/tools/trainer/Makefile (from r180388, vmkit/trunk/tools/precompiler/trainer/Makefile)
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/trainer/Makefile?p2=vmkit/trunk/tools/trainer/Makefile&p1=vmkit/trunk/tools/precompiler/trainer/Makefile&r1=180388&r2=180389&rev=180389&view=diff
==============================================================================
--- vmkit/trunk/tools/precompiler/trainer/Makefile (original)
+++ vmkit/trunk/tools/trainer/Makefile Thu Apr 25 12:04:32 2013
@@ -6,7 +6,7 @@
 # License. See LICENSE.TXT for details.
 # 
 ##===----------------------------------------------------------------------===##
-LEVEL = ../../..
+LEVEL = ../..
 
 EXTRA_DIST = HelloWorld.java
 





More information about the vmkit-commits mailing list