14 changes: 14 additions & 0 deletions lld/lib/ReaderWriter/YAML/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
##===- lld/lib/ReaderWriter/YAML/Makefile --------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##

LLD_LEVEL := ../../..
LIBRARYNAME := lldYAML
USEDLIBS = lldReaderWriter.a lldCore.a

include $(LLD_LEVEL)/Makefile
71 changes: 71 additions & 0 deletions lld/test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
LLD_LEVEL := ..
include $(LLD_LEVEL)/Makefile

# Test in all immediate subdirectories if unset.
ifdef TESTSUITE
TESTDIRS := $(TESTSUITE:%=$(PROJ_SRC_DIR)/%)
else
TESTDIRS ?= $(PROJ_SRC_DIR)
endif

# 'lit' wants objdir paths, so it will pick up the lit.site.cfg.
TESTDIRS := $(TESTDIRS:$(PROJ_SRC_DIR)%=$(PROJ_OBJ_DIR)%)

# Allow EXTRA_TESTDIRS to provide additional test directories.
TESTDIRS += $(EXTRA_TESTDIRS)

ifndef TESTARGS
ifdef VERBOSE
TESTARGS = -v
else
TESTARGS = -s -v
endif
endif

# Make sure any extra test suites can find the main site config.
LIT_ARGS := --param lld_site_config=$(PROJ_OBJ_DIR)/lit.site.cfg

ifdef VG
LIT_ARGS += "--vg"
endif

all:: lit.site.cfg Unit/lit.site.cfg
@ echo '--- Running lld tests for $(TARGET_TRIPLE) ---'
@ $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py \
$(LIT_ARGS) $(TESTARGS) $(TESTDIRS)

FORCE:

lit.site.cfg: FORCE
@echo "Making lld '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=@LLD_SOURCE_DIR@=$(PROJ_SRC_DIR)/..=g >> lit.tmp
@$(ECHOPATH) s=@LLD_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 lld '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=@LLD_SOURCE_DIR@=$(PROJ_SRC_DIR)/..=g >> unit.tmp
@$(ECHOPATH) s=@LLD_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

.PHONY: all report clean
17 changes: 17 additions & 0 deletions lld/tools/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
##===- tools/Makefile --------------------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##

LLD_LEVEL := ..
LEVEL := $(LLD_LEVEL)/../..

include $(LLD_LEVEL)/../../Makefile.config

DIRS := lld

include $(LLD_LEVEL)/Makefile
28 changes: 28 additions & 0 deletions lld/tools/lld/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
##===------- lld/Makefile --------------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===--------------------------------------------------------------------===##

LLD_LEVEL := ../..

TOOLNAME = lld

# No plugins, optimize startup time.
TOOL_NO_EXPORTS = 1

#include /Makefile.config
LEVEL := $(LLD_LEVEL)/../..
include $(LEVEL)/Makefile.config

LINK_COMPONENTS := $(TARGETS_TO_BUILD)
USEDLIBS = lldDriver.a \
lldELF.a lldMachO.a lldPasses.a lldPECOFF.a lldYAML.a \
lldReaderWriter.a lldCore.a lldNative.a \
lldHexagonELFTarget.a lldPPCELFTarget.a lldMipsELFTarget.a \
lldX86ELFTarget.a lldX86_64ELFTarget.a LLVMOption.a

include $(LLD_LEVEL)/Makefile
14 changes: 14 additions & 0 deletions lld/unittests/CoreTests/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
##===- unittests/CoreTests/Makefile ----------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##

LLD_LEVEL = ../..
TESTNAME = CoreTest
USEDLIBS = gtest.a LLVMOption.a LLVMSupport.a

include $(LLD_LEVEL)/unittests/Makefile
19 changes: 19 additions & 0 deletions lld/unittests/DriverTests/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
##===---- unittests/DriverTests/Makefile ----------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===---------------------------------------------------------------------===##

LLD_LEVEL = ../..
TESTNAME = DriverTests
USEDLIBS = lldDriver.a \
lldELF.a lldMachO.a lldPasses.a lldPECOFF.a lldYAML.a \
lldReaderWriter.a lldCore.a lldNative.a \
lldHexagonELFTarget.a lldPPCELFTarget.a lldMipsELFTarget.a \
lldX86ELFTarget.a lldX86_64ELFTarget.a LLVMLinker.a \
LLVMOption.a LLVMObject.a LLVMBitReader.a LLVMCore.a LLVMSupport.a

include $(LLD_LEVEL)/unittests/Makefile
31 changes: 31 additions & 0 deletions lld/unittests/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
##===- unittests/Makefile ----------------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##

# If LLD_LEVEL is not set, then we are the top-level Makefile. Otherwise, we
# are being included from a subdirectory makefile.

ifndef LLD_LEVEL

IS_UNITTEST_LEVEL := 1
LLD_LEVEL := ..

PARALLEL_DIRS = CoreTests DriverTests

include $(LLD_LEVEL)/../../Makefile.config

endif # LLD_LEVEL

include $(LLD_LEVEL)/Makefile

ifndef IS_UNITTEST_LEVEL

MAKEFILE_UNITTEST_NO_INCLUDE_COMMON := 1
include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest

endif # IS_UNITTEST_LEVEL
17 changes: 17 additions & 0 deletions lld/utils/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
##===- tools/Makefile --------------------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##

LLD_LEVEL := ..
LEVEL := $(LLD_LEVEL)/../..

include $(LLD_LEVEL)/../../Makefile.config

DIRS := linker-script-test

include $(LLD_LEVEL)/Makefile
24 changes: 24 additions & 0 deletions lld/utils/linker-script-test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
##===-------------- linker-script-test/Makefile ----------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===--------------------------------------------------------------------===##

LLD_LEVEL := ../..

TOOLNAME = linker-script-test

# No plugins, optimize startup time.
TOOL_NO_EXPORTS = 1

#include /Makefile.config
LEVEL := $(LLD_LEVEL)/../..
include $(LEVEL)/Makefile.config

LINK_COMPONENTS := $(TARGETS_TO_BUILD)
USEDLIBS = lldReaderWriter.a LLVMSupport.a

include $(LLD_LEVEL)/Makefile