From 723ccd615f99b65454e199cda9feb31f2283e787 Mon Sep 17 00:00:00 2001 From: John Criswell Date: Mon, 30 Jun 2003 22:13:48 +0000 Subject: Adding in sample project tree. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7018 91177308-0d34-0410-b5e6-96231b3b80d8 --- projects/sample/Makefile | 19 +++++++++++++++++++ projects/sample/Makefile.common | 16 ++++++++++++++++ projects/sample/Makefile.config | 16 ++++++++++++++++ projects/sample/include/sample.h | 8 ++++++++ projects/sample/lib/Makefile | 11 +++++++++++ projects/sample/lib/sample/Makefile | 16 ++++++++++++++++ projects/sample/lib/sample/sample.c | 24 ++++++++++++++++++++++++ projects/sample/tools/Makefile | 11 +++++++++++ projects/sample/tools/sample/Makefile | 20 ++++++++++++++++++++ projects/sample/tools/sample/main.c | 14 ++++++++++++++ 10 files changed, 155 insertions(+) create mode 100644 projects/sample/Makefile create mode 100644 projects/sample/Makefile.common create mode 100644 projects/sample/Makefile.config create mode 100644 projects/sample/include/sample.h create mode 100644 projects/sample/lib/Makefile create mode 100644 projects/sample/lib/sample/Makefile create mode 100644 projects/sample/lib/sample/sample.c create mode 100644 projects/sample/tools/Makefile create mode 100644 projects/sample/tools/sample/Makefile create mode 100644 projects/sample/tools/sample/main.c (limited to 'projects') diff --git a/projects/sample/Makefile b/projects/sample/Makefile new file mode 100644 index 0000000000..1fe32c795e --- /dev/null +++ b/projects/sample/Makefile @@ -0,0 +1,19 @@ +# +# This is a sample Makefile for a project that uses LLVM. +# + +# +# Indicates our relative path to the top of the project's root directory. +# +LEVEL = . + +# +# Directories that needs to be built. +# +DIRS = lib tools + +# +# Include the Master Makefile that knows how to build all. +# +include $(LEVEL)/Makefile.common + diff --git a/projects/sample/Makefile.common b/projects/sample/Makefile.common new file mode 100644 index 0000000000..7aa0ef9f0d --- /dev/null +++ b/projects/sample/Makefile.common @@ -0,0 +1,16 @@ +# +# Set this variable to the top of the LLVM source tree. +# +LLVM_SRC_ROOT = $(LEVEL)/../.. + +# +# Set this variable to the top level directory where LLVM was built +# (this is *not* the same as OBJ_ROOT as defined in LLVM's Makefile.config). +# +#LLVM_OBJ_ROOT = $(LEVEL)/../.. + +# +# Include LLVM's Master Makefile. +# +include $(LLVM_SRC_ROOT)/Makefile.common + diff --git a/projects/sample/Makefile.config b/projects/sample/Makefile.config new file mode 100644 index 0000000000..1649978363 --- /dev/null +++ b/projects/sample/Makefile.config @@ -0,0 +1,16 @@ +# +# Set this variable to the top of the LLVM source tree. +# +LLVM_SRC_ROOT = $(LEVEL)/../.. + +# +# Set this variable to the top level directory where LLVM was built +# (i.e. where all of the object files are located). +# +#LLVM_OBJ_ROOT = $(LEVEL)/../.. + +# +# Include LLVM's Makefile Makefile. +# +include $(LLVM_SRC_ROOT)/Makefile.config + diff --git a/projects/sample/include/sample.h b/projects/sample/include/sample.h new file mode 100644 index 0000000000..db3441f76f --- /dev/null +++ b/projects/sample/include/sample.h @@ -0,0 +1,8 @@ +/* + * File: sample.h + * + * This is a sample header file that is global to the entire project. + * It is located here so that everyone will find it. + */ +extern int compute_sample (int a); + diff --git a/projects/sample/lib/Makefile b/projects/sample/lib/Makefile new file mode 100644 index 0000000000..4b971053d0 --- /dev/null +++ b/projects/sample/lib/Makefile @@ -0,0 +1,11 @@ +# +# Relative path to the top of the source tree. +# +LEVEL=.. + +# +# List all of the subdirectories that we will compile. +# +DIRS=sample + +include $(LEVEL)/Makefile.common diff --git a/projects/sample/lib/sample/Makefile b/projects/sample/lib/sample/Makefile new file mode 100644 index 0000000000..5569afbdda --- /dev/null +++ b/projects/sample/lib/sample/Makefile @@ -0,0 +1,16 @@ +# +# Indicate where we are relative to the top of the source tree. +# +LEVEL=../.. + +# +# Give the name of a library. This will build a dynamic version. +# +SHARED_LIBRARY=1 +LIBRARYNAME=sample + +# +# Include Makefile.common so we know what to do. +# +include $(LEVEL)/Makefile.common + diff --git a/projects/sample/lib/sample/sample.c b/projects/sample/lib/sample/sample.c new file mode 100644 index 0000000000..bd78ed5746 --- /dev/null +++ b/projects/sample/lib/sample/sample.c @@ -0,0 +1,24 @@ +/* + * File: sample.c + * + * Description: + * This is a sample source file for a library. It helps to demonstrate + * how to setup a project that uses the LLVM build system, header files, + * and libraries. + */ + +#include +#include + +// LLVM Header File +#include "Support/DataTypes.h" + +// Header file global to this project +#include "sample.h" + +int +compute_sample (int a) +{ + return a; +} + diff --git a/projects/sample/tools/Makefile b/projects/sample/tools/Makefile new file mode 100644 index 0000000000..4b971053d0 --- /dev/null +++ b/projects/sample/tools/Makefile @@ -0,0 +1,11 @@ +# +# Relative path to the top of the source tree. +# +LEVEL=.. + +# +# List all of the subdirectories that we will compile. +# +DIRS=sample + +include $(LEVEL)/Makefile.common diff --git a/projects/sample/tools/sample/Makefile b/projects/sample/tools/sample/Makefile new file mode 100644 index 0000000000..a6106ac4d2 --- /dev/null +++ b/projects/sample/tools/sample/Makefile @@ -0,0 +1,20 @@ +# +# Indicate where we are relative to the top of the source tree. +# +LEVEL=../.. + +# +# Give the name of the tool. +# +TOOLNAME=sample + +# +# List libraries that we'll need +# +USEDLIBS=sample + +# +# Include Makefile.common so we know what to do. +# +include $(LEVEL)/Makefile.common + diff --git a/projects/sample/tools/sample/main.c b/projects/sample/tools/sample/main.c new file mode 100644 index 0000000000..66073352de --- /dev/null +++ b/projects/sample/tools/sample/main.c @@ -0,0 +1,14 @@ +#include +#include + +#include + +#include "sample.h" + +int +main (int argc, char ** argv) +{ + printf ("%d\n", compute_sample (5)); + exit (0); +} + -- cgit v1.2.3-18-g5258