Fix up the makefiles in the tools repo, and add a top-level makefile

suitable for building as part of the LLVM/Clang build.

llvm-svn: 161538
This commit is contained in:
Chandler Carruth 2012-08-08 23:34:47 +00:00
parent ac4e36d1af
commit 4b9cf6d61a
3 changed files with 59 additions and 27 deletions

View File

@ -0,0 +1,39 @@
##===- tools/extra/Makefile --------------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
CLANG_LEVEL := ../..
DIRS := remove-cstr-calls
include $(CLANG_LEVEL)/../../Makefile.config
include $(CLANG_LEVEL)/Makefile
###
# Handle the nested test suite.
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
$(RecursiveTargets)::
$(Verb) for dir in test; do \
if [ -f $(PROJ_SRC_DIR)/$${dir}/Makefile ] && [ ! -f $${dir}/Makefile ]; then \
$(MKDIR) $${dir}; \
$(CP) $(PROJ_SRC_DIR)/$${dir}/Makefile $${dir}/Makefile; \
fi \
done
endif
test::
@ $(MAKE) -C test
report::
@ $(MAKE) -C test report
clean::
@ $(MAKE) -C test clean
.PHONY: test report clean

View File

@ -1,4 +1,4 @@
##===- tools/remove-cstr-calls/Makefile --------------------*- Makefile -*-===##
##===- tools/extra/remove-cstr-calls/Makefile --------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
@ -7,7 +7,7 @@
#
##===----------------------------------------------------------------------===##
CLANG_LEVEL := ../..
CLANG_LEVEL := ../../..
TOOLNAME = remove-cstr-calls
NO_INSTALL = 1
@ -15,9 +15,10 @@ NO_INSTALL = 1
# No plugins, optimize startup time.
TOOL_NO_EXPORTS = 1
LINK_COMPONENTS := support mc
include $(CLANG_LEVEL)/../../Makefile.config
LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser support mc
USEDLIBS = clangEdit.a clangTooling.a clangFrontend.a clangSerialization.a clangDriver.a \
clangRewrite.a clangParse.a clangSema.a clangAnalysis.a \
clangRewrite.a clangParse.a clangSema.a clangAnalysis.a \
clangAST.a clangASTMatchers.a clangLex.a clangBasic.a
include $(CLANG_LEVEL)/Makefile

View File

@ -1,4 +1,13 @@
CLANG_LEVEL := ..
##===- tools/extra/test/Makefile ---------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
CLANG_LEVEL := ../../..
include $(CLANG_LEVEL)/Makefile
# Test in all immediate subdirectories if unset.
@ -29,42 +38,25 @@ ifdef VG
LIT_ARGS += "--vg"
endif
all:: lit.site.cfg Unit/lit.site.cfg
@ echo '--- Running clang tests for $(TARGET_TRIPLE) ---'
all:: lit.site.cfg
@ echo '--- Running the Clang extra tools tests for $(TARGET_TRIPLE) ---'
@ $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py \
$(LIT_ARGS) $(TESTARGS) $(TESTDIRS)
FORCE:
lit.site.cfg: FORCE
@echo "Making Clang 'lit.site.cfg' file..."
@echo "Making Clang extra tools' 'lit.site.cfg' file..."
@$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g > lit.tmp
@$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> lit.tmp
@$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> lit.tmp
@$(ECHOPATH) s=@LLVM_LIBS_DIR@=$(LibDir)=g >> lit.tmp
@$(ECHOPATH) s=@CLANG_SOURCE_DIR@=$(PROJ_SRC_DIR)/..=g >> lit.tmp
@$(ECHOPATH) s=@CLANG_BINARY_DIR@=$(PROJ_OBJ_DIR)/..=g >> lit.tmp
@$(ECHOPATH) s=@CLANG_TOOLS_SOURCE_DIR@=$(PROJ_SRC_DIR)/..=g >> lit.tmp
@$(ECHOPATH) s=@CLANG_TOOLS_BINARY_DIR@=$(PROJ_OBJ_DIR)/..=g >> lit.tmp
@$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> lit.tmp
@sed -f lit.tmp $(PROJ_SRC_DIR)/lit.site.cfg.in > $@
@-rm -f lit.tmp
Unit/lit.site.cfg: FORCE
@echo "Making Clang 'Unit/lit.site.cfg' file..."
@$(MKDIR) $(dir $@)
@$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g > unit.tmp
@$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> unit.tmp
@$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> unit.tmp
@$(ECHOPATH) s=@LLVM_LIBS_DIR@=$(LibDir)=g >> unit.tmp
@$(ECHOPATH) s=@CLANG_SOURCE_DIR@=$(PROJ_SRC_DIR)/..=g >> unit.tmp
@$(ECHOPATH) s=@CLANG_BINARY_DIR@=$(PROJ_OBJ_DIR)/..=g >> unit.tmp
@$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> unit.tmp
@$(ECHOPATH) s=@LLVM_BUILD_MODE@=$(BuildMode)=g >> unit.tmp
@$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> unit.tmp
@$(ECHOPATH) s=@SHLIBDIR@=$(SharedLibDir)=g >> unit.tmp
@$(ECHOPATH) s=@SHLIBPATH_VAR@=$(SHLIBPATH_VAR)=g >> unit.tmp
@sed -f unit.tmp $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@
@-rm -f unit.tmp
clean::
@ find . -name Output | xargs rm -fr