Initial set of Makefiles
authorIain Sandoe <iain@codesourcery.com>
Wed, 4 Jun 2014 09:54:07 +0000 (09:54 +0000)
committerIain Sandoe <iain@codesourcery.com>
Wed, 4 Jun 2014 09:54:07 +0000 (09:54 +0000)
This provides support for the autoconfing & make build style.
The format, style and implementation follows that used within the llvm and clang projects.

TODO: implement out-of-source documentation builds.
llvm-svn: 210177

26 files changed:
lld/Makefile [new file with mode: 0644]
lld/include/Makefile [new file with mode: 0644]
lld/include/lld/Makefile [new file with mode: 0644]
lld/lib/Core/Makefile [new file with mode: 0644]
lld/lib/Driver/Makefile [new file with mode: 0644]
lld/lib/Makefile [new file with mode: 0644]
lld/lib/Passes/Makefile [new file with mode: 0644]
lld/lib/ReaderWriter/ELF/Hexagon/Makefile [new file with mode: 0644]
lld/lib/ReaderWriter/ELF/Makefile [new file with mode: 0644]
lld/lib/ReaderWriter/ELF/Mips/Makefile [new file with mode: 0644]
lld/lib/ReaderWriter/ELF/PPC/Makefile [new file with mode: 0644]
lld/lib/ReaderWriter/ELF/X86/Makefile [new file with mode: 0644]
lld/lib/ReaderWriter/ELF/X86_64/Makefile [new file with mode: 0644]
lld/lib/ReaderWriter/MachO/Makefile [new file with mode: 0644]
lld/lib/ReaderWriter/Makefile [new file with mode: 0644]
lld/lib/ReaderWriter/Native/Makefile [new file with mode: 0644]
lld/lib/ReaderWriter/PECOFF/Makefile [new file with mode: 0644]
lld/lib/ReaderWriter/YAML/Makefile [new file with mode: 0644]
lld/test/Makefile [new file with mode: 0644]
lld/tools/Makefile [new file with mode: 0644]
lld/tools/lld/Makefile [new file with mode: 0644]
lld/unittests/CoreTests/Makefile [new file with mode: 0644]
lld/unittests/DriverTests/Makefile [new file with mode: 0644]
lld/unittests/Makefile [new file with mode: 0644]
lld/utils/Makefile [new file with mode: 0644]
lld/utils/linker-script-test/Makefile [new file with mode: 0644]

diff --git a/lld/Makefile b/lld/Makefile
new file mode 100644 (file)
index 0000000..18c59f1
--- /dev/null
@@ -0,0 +1,86 @@
+##===- 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_TOP_LEVEL := 1
+LLD_LEVEL := .
+DIRS := include lib tools utils unittests
+
+PARALLEL_DIRS :=
+
+endif
+
+ifeq ($(MAKECMDGOALS),libs-only)
+  DIRS := $(filter-out tools docs, $(DIRS))
+  OPTIONAL_DIRS :=
+endif
+ifeq ($(BUILD_LLD_ONLY),YES)
+  DIRS := $(filter-out docs unittests, $(DIRS))
+  OPTIONAL_DIRS :=
+endif
+
+###
+# Common Makefile code, shared by all lld Makefiles.
+
+# Set LLVM source root level.
+LEVEL := $(LLD_LEVEL)/../..
+
+# Include LLVM common makefile.
+include $(LEVEL)/Makefile.common
+
+ifneq ($(ENABLE_DOCS),1)
+  DIRS := $(filter-out docs, $(DIRS))
+endif
+
+CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLD_LEVEL)/include
+CPP.Flags += -I$(PROJ_OBJ_DIR)/$(LLD_LEVEL)/include
+
+###
+# lld Top Level specific stuff.
+
+ifeq ($(IS_TOP_LEVEL),1)
+
+ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
+$(RecursiveTargets)::
+       $(Verb) for dir in test unittests; 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
+
+libs-only: all
+
+tags::
+       $(Verb) etags `find . -type f -name '*.h' -or -name '*.cpp' | \
+         grep -v /lib/Headers | grep -v /test/`
+
+cscope.files:
+       find tools lib include -name '*.cpp' \
+                           -or -name '*.def' \
+                           -or -name '*.td' \
+                           -or -name '*.h' > cscope.files
+
+.PHONY: test report clean cscope.files
+
+endif
diff --git a/lld/include/Makefile b/lld/include/Makefile
new file mode 100644 (file)
index 0000000..d890335
--- /dev/null
@@ -0,0 +1,4 @@
+LLD_LEVEL := ..
+DIRS := lld
+
+include $(LLD_LEVEL)/Makefile
diff --git a/lld/include/lld/Makefile b/lld/include/lld/Makefile
new file mode 100644 (file)
index 0000000..e29a0cb
--- /dev/null
@@ -0,0 +1,44 @@
+LLD_LEVEL := ../..
+DIRS :=
+
+include $(LLD_LEVEL)/Makefile
+
+install-local::
+       $(Echo) Installing lld include files
+       $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
+       $(Verb) if test -d "$(PROJ_SRC_DIR)" ; then \
+         cd $(PROJ_SRC_DIR)/.. && \
+         for  hdr in `find lld -type f \
+             '(' -name LICENSE.TXT \
+              -o -name '*.def' \
+              -o -name '*.h' \
+              -o -name '*.inc' \
+             ')' -print \
+              | grep -v CVS | grep -v .svn | grep -v .dir` ; do \
+           instdir=$(DESTDIR)`dirname "$(PROJ_includedir)/$$hdr"` ; \
+           if test \! -d "$$instdir" ; then \
+             $(EchoCmd) Making install directory $$instdir ; \
+             $(MKDIR) $$instdir ;\
+           fi ; \
+           $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
+         done ; \
+       fi
+ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
+       $(Verb) if test -d "$(PROJ_OBJ_ROOT)/tools/lld/include/lld" ; then \
+         cd $(PROJ_OBJ_ROOT)/tools/lld/include && \
+         for hdr in `find lld -type f \
+             '(' -name LICENSE.TXT \
+              -o -name '*.def' \
+              -o -name '*.h' \
+              -o -name '*.inc' \
+             ')' -print \
+            | grep -v CVS | grep -v .tmp | grep -v .dir` ; do \
+           instdir=$(DESTDIR)`dirname "$(PROJ_includedir)/$$hdr"` ; \
+           if test \! -d "$$instdir" ; then \
+             $(EchoCmd) Making install directory $$instdir ; \
+             $(MKDIR) $$instdir ;\
+           fi ; \
+           $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
+         done ; \
+       fi
+endif
diff --git a/lld/lib/Core/Makefile b/lld/lib/Core/Makefile
new file mode 100644 (file)
index 0000000..042d01a
--- /dev/null
@@ -0,0 +1,13 @@
+##===- lld/lib/Core/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 := lldCore
+
+include $(LLD_LEVEL)/Makefile
diff --git a/lld/lib/Driver/Makefile b/lld/lib/Driver/Makefile
new file mode 100644 (file)
index 0000000..19024cf
--- /dev/null
@@ -0,0 +1,38 @@
+##===- lld/lib/Driver/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 := lldDriver
+
+BUILT_SOURCES = CoreOptions.inc UniversalDriverOptions.inc DarwinLdOptions.inc \
+                GnuLdOptions.inc WinLinkOptions.inc
+
+TABLEGEN_INC_FILES_COMMON = 1
+
+include $(LLD_LEVEL)/Makefile
+
+$(ObjDir)/CoreOptions.inc.tmp : CoreOptions.td $(LLVM_TBLGEN) $(ObjDir)/.dir
+       $(Echo) "Building LLD CoreOptions Option tables with tblgen"
+       $(Verb) $(LLVMTableGen) -gen-opt-parser-defs -o $(call SYSPATH, $@) $<
+
+$(ObjDir)/UniversalDriverOptions.inc.tmp : UniversalDriverOptions.td $(LLVM_TBLGEN) $(ObjDir)/.dir
+       $(Echo) "Building LLD Universal Driver Options tables with tblgen"
+       $(Verb) $(LLVMTableGen) -gen-opt-parser-defs -o $(call SYSPATH, $@) $<
+
+$(ObjDir)/DarwinLdOptions.inc.tmp : DarwinLdOptions.td $(LLVM_TBLGEN) $(ObjDir)/.dir
+       $(Echo) "Building LLD Darwin ld Option tables with tblgen"
+       $(Verb) $(LLVMTableGen) -gen-opt-parser-defs -o $(call SYSPATH, $@) $<
+
+$(ObjDir)/GnuLdOptions.inc.tmp : GnuLdOptions.td $(LLVM_TBLGEN) $(ObjDir)/.dir
+       $(Echo) "Building LLD Gnu ld Option tables with tblgen"
+       $(Verb) $(LLVMTableGen) -gen-opt-parser-defs -o $(call SYSPATH, $@) $<
+
+$(ObjDir)/WinLinkOptions.inc.tmp : WinLinkOptions.td $(LLVM_TBLGEN) $(ObjDir)/.dir
+       $(Echo) "Building LLD WinLinkOptions Option tables with tblgen"
+       $(Verb) $(LLVMTableGen) -gen-opt-parser-defs -o $(call SYSPATH, $@) $<
diff --git a/lld/lib/Makefile b/lld/lib/Makefile
new file mode 100644 (file)
index 0000000..41a7b55
--- /dev/null
@@ -0,0 +1,16 @@
+##===- lib/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 := ..
+
+# ARCMigrate and Rewrite are always needed because of libclang.
+PARALLEL_DIRS = Core Driver Passes ReaderWriter
+
+include $(LLD_LEVEL)/../../Makefile.config
+
+include $(LLD_LEVEL)/Makefile
diff --git a/lld/lib/Passes/Makefile b/lld/lib/Passes/Makefile
new file mode 100644 (file)
index 0000000..255a6df
--- /dev/null
@@ -0,0 +1,13 @@
+##===- lld/lib/Passes/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 := lldPasses
+
+include $(LLD_LEVEL)/Makefile
diff --git a/lld/lib/ReaderWriter/ELF/Hexagon/Makefile b/lld/lib/ReaderWriter/ELF/Hexagon/Makefile
new file mode 100644 (file)
index 0000000..8d6f1a0
--- /dev/null
@@ -0,0 +1,16 @@
+##===- lld/lib/ReaderWriter/ELF/Hexagon/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 := lldHexagonELFTarget
+USEDLIBS = lldCore.a
+
+CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLD_LEVEL)/lib/ReaderWriter/ELF/Hexagon -I$(PROJ_SRC_DIR)/$(LLD_LEVEL)/lib/ReaderWriter/ELF
+
+include $(LLD_LEVEL)/Makefile
diff --git a/lld/lib/ReaderWriter/ELF/Makefile b/lld/lib/ReaderWriter/ELF/Makefile
new file mode 100644 (file)
index 0000000..798a6d0
--- /dev/null
@@ -0,0 +1,21 @@
+##===- lld/lib/ReaderWriter/ELF/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 := lldELF
+USEDLIBS = lldHexagonELFTarget.a lldPPCELFTarget.a lldMipsELFTarget.a \
+           lldX86ELFTarget.a lldX86_64ELFTarget.a \
+           lldReaderWriter.a lldPasses.a
+
+CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLD_LEVEL)/lib/ReaderWriter/ELF
+
+# these link against this lib
+PARALLEL_DIRS := Hexagon PPC X86 X86_64 Mips
+
+include $(LLD_LEVEL)/Makefile
diff --git a/lld/lib/ReaderWriter/ELF/Mips/Makefile b/lld/lib/ReaderWriter/ELF/Mips/Makefile
new file mode 100644 (file)
index 0000000..20263a1
--- /dev/null
@@ -0,0 +1,15 @@
+##===- lld/lib/ReaderWriter/ELF/PPC/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 := lldMipsELFTarget
+USEDLIBS = lldCore.a
+CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLD_LEVEL)/lib/ReaderWriter/ELF
+
+include $(LLD_LEVEL)/Makefile
diff --git a/lld/lib/ReaderWriter/ELF/PPC/Makefile b/lld/lib/ReaderWriter/ELF/PPC/Makefile
new file mode 100644 (file)
index 0000000..ad4a789
--- /dev/null
@@ -0,0 +1,15 @@
+##===- lld/lib/ReaderWriter/ELF/PPC/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 := lldPPCELFTarget
+USEDLIBS = lldCore.a
+CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLD_LEVEL)/lib/ReaderWriter/ELF
+
+include $(LLD_LEVEL)/Makefile
diff --git a/lld/lib/ReaderWriter/ELF/X86/Makefile b/lld/lib/ReaderWriter/ELF/X86/Makefile
new file mode 100644 (file)
index 0000000..058d513
--- /dev/null
@@ -0,0 +1,15 @@
+##===- lld/lib/ReaderWriter/ELF/X86/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 := lldX86ELFTarget
+USEDLIBS = lldCore.a
+CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLD_LEVEL)/lib/ReaderWriter/ELF
+
+include $(LLD_LEVEL)/Makefile
diff --git a/lld/lib/ReaderWriter/ELF/X86_64/Makefile b/lld/lib/ReaderWriter/ELF/X86_64/Makefile
new file mode 100644 (file)
index 0000000..c163160
--- /dev/null
@@ -0,0 +1,15 @@
+##===- lld/lib/ReaderWriter/ELF/X86_64/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 := lldX86_64ELFTarget
+USEDLIBS = lldCore.a
+CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLD_LEVEL)/lib/ReaderWriter/ELF
+
+include $(LLD_LEVEL)/Makefile
diff --git a/lld/lib/ReaderWriter/MachO/Makefile b/lld/lib/ReaderWriter/MachO/Makefile
new file mode 100644 (file)
index 0000000..619b9ea
--- /dev/null
@@ -0,0 +1,14 @@
+##===- lld/lib/ReaderWriter/MachO/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 := lldMachO
+USEDLIBS = lldReaderWriter.a lldCore.a
+
+include $(LLD_LEVEL)/Makefile
diff --git a/lld/lib/ReaderWriter/Makefile b/lld/lib/ReaderWriter/Makefile
new file mode 100644 (file)
index 0000000..2358744
--- /dev/null
@@ -0,0 +1,16 @@
+##===- lld/lib/ReaderWriter/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 := lldReaderWriter
+
+# these link against this lib
+PARALLEL_DIRS := ELF MachO Native PECOFF YAML
+
+include $(LLD_LEVEL)/Makefile
diff --git a/lld/lib/ReaderWriter/Native/Makefile b/lld/lib/ReaderWriter/Native/Makefile
new file mode 100644 (file)
index 0000000..fea2cc5
--- /dev/null
@@ -0,0 +1,14 @@
+##===- lld/lib/ReaderWriter/Native/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 := lldNative
+USEDLIBS = lldReaderWriter.a lldCore.a
+
+include $(LLD_LEVEL)/Makefile
diff --git a/lld/lib/ReaderWriter/PECOFF/Makefile b/lld/lib/ReaderWriter/PECOFF/Makefile
new file mode 100644 (file)
index 0000000..8e47376
--- /dev/null
@@ -0,0 +1,14 @@
+##===- lld/lib/ReaderWriter/PECOFF/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 := lldPECOFF
+USEDLIBS = lldReaderWriter.a lldCore.a
+
+include $(LLD_LEVEL)/Makefile
diff --git a/lld/lib/ReaderWriter/YAML/Makefile b/lld/lib/ReaderWriter/YAML/Makefile
new file mode 100644 (file)
index 0000000..02a66f9
--- /dev/null
@@ -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
diff --git a/lld/test/Makefile b/lld/test/Makefile
new file mode 100644 (file)
index 0000000..2d45e4f
--- /dev/null
@@ -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
diff --git a/lld/tools/Makefile b/lld/tools/Makefile
new file mode 100644 (file)
index 0000000..0a6da94
--- /dev/null
@@ -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
diff --git a/lld/tools/lld/Makefile b/lld/tools/lld/Makefile
new file mode 100644 (file)
index 0000000..448fafb
--- /dev/null
@@ -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
diff --git a/lld/unittests/CoreTests/Makefile b/lld/unittests/CoreTests/Makefile
new file mode 100644 (file)
index 0000000..55668a6
--- /dev/null
@@ -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
diff --git a/lld/unittests/DriverTests/Makefile b/lld/unittests/DriverTests/Makefile
new file mode 100644 (file)
index 0000000..e538a08
--- /dev/null
@@ -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
diff --git a/lld/unittests/Makefile b/lld/unittests/Makefile
new file mode 100644 (file)
index 0000000..0fbb17d
--- /dev/null
@@ -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
diff --git a/lld/utils/Makefile b/lld/utils/Makefile
new file mode 100644 (file)
index 0000000..f81a4b5
--- /dev/null
@@ -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
diff --git a/lld/utils/linker-script-test/Makefile b/lld/utils/linker-script-test/Makefile
new file mode 100644 (file)
index 0000000..de40ca5
--- /dev/null
@@ -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