Mercurial > hg > CbC > CbC_llvm
comparison docs/Projects.rst @ 77:54457678186b LLVM3.6
LLVM 3.6
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 08 Sep 2014 22:06:00 +0900 |
parents | 95c75e76d11b |
children | afa8332a0e37 |
comparison
equal
deleted
inserted
replaced
34:e874dbf0ad9d | 77:54457678186b |
---|---|
35 * You can use the pre-made LLVM sample project. This sample project includes | 35 * You can use the pre-made LLVM sample project. This sample project includes |
36 ``Makefiles``, a configure script that can be used to configure the location | 36 ``Makefiles``, a configure script that can be used to configure the location |
37 of LLVM, and the ability to support multiple object directories from a single | 37 of LLVM, and the ability to support multiple object directories from a single |
38 source directory. | 38 source directory. |
39 | 39 |
40 This document assumes that you will base your project on the LLVM sample project | 40 If you want to devise your own build system, studying other projects and LLVM |
41 found in ``llvm/projects/sample``. If you want to devise your own build system, | 41 ``Makefiles`` will probably provide enough information on how to write your own |
42 studying the sample project and LLVM ``Makefiles`` will probably provide enough | 42 ``Makefiles``. |
43 information on how to write your own ``Makefiles``. | |
44 | |
45 Create a Project from the Sample Project | |
46 ======================================== | |
47 | |
48 Follow these simple steps to start your project: | |
49 | |
50 1. Copy the ``llvm/projects/sample`` directory to any place of your choosing. | |
51 You can place it anywhere you like. Rename the directory to match the name | |
52 of your project. | |
53 | |
54 2. If you downloaded LLVM using Subversion, remove all the directories named | |
55 ``.svn`` (and all the files therein) from your project's new source tree. | |
56 This will keep Subversion from thinking that your project is inside | |
57 ``llvm/trunk/projects/sample``. | |
58 | |
59 3. Add your source code and Makefiles to your source tree. | |
60 | |
61 4. If you want your project to be configured with the ``configure`` script then | |
62 you need to edit ``autoconf/configure.ac`` as follows: | |
63 | |
64 * **AC_INIT** - Place the name of your project, its version number and a | |
65 contact email address for your project as the arguments to this macro | |
66 | |
67 * **AC_CONFIG_AUX_DIR** - If your project isn't in the ``llvm/projects`` | |
68 directory then you might need to adjust this so that it specifies a | |
69 relative path to the ``llvm/autoconf`` directory. | |
70 | |
71 * **LLVM_CONFIG_PROJECT** - Just leave this alone. | |
72 | |
73 * **AC_CONFIG_SRCDIR** - Specify a path to a file name that identifies your | |
74 project; or just leave it at ``Makefile.common.in``. | |
75 | |
76 * **AC_CONFIG_FILES** - Do not change. | |
77 | |
78 * **AC_CONFIG_MAKEFILE** - Use one of these macros for each Makefile that | |
79 your project uses. This macro arranges for your makefiles to be copied from | |
80 the source directory, unmodified, to the build directory. | |
81 | |
82 5. After updating ``autoconf/configure.ac``, regenerate the configure script | |
83 with these commands. (You must be using ``Autoconf`` version 2.59 or later | |
84 and your ``aclocal`` version should be 1.9 or later.) | |
85 | |
86 .. code-block:: bash | |
87 | |
88 % cd autoconf | |
89 % ./AutoRegen.sh | |
90 | |
91 6. Run ``configure`` in the directory in which you want to place object code. | |
92 Use the following options to tell your project where it can find LLVM: | |
93 | |
94 ``--with-llvmsrc=<directory>`` | |
95 Tell your project where the LLVM source tree is located. | |
96 | |
97 ``--with-llvmobj=<directory>`` | |
98 Tell your project where the LLVM object tree is located. | |
99 | |
100 ``--prefix=<directory>`` | |
101 Tell your project where it should get installed. | |
102 | |
103 That's it! Now all you have to do is type ``gmake`` (or ``make`` if you're on a | |
104 GNU/Linux system) in the root of your object directory, and your project should | |
105 build. | |
106 | 43 |
107 Source Tree Layout | 44 Source Tree Layout |
108 ================== | 45 ================== |
109 | 46 |
110 In order to use the LLVM build system, you will want to organize your source | 47 In order to use the LLVM build system, you will want to organize your source |
111 code so that it can benefit from the build system's features. Mainly, you want | 48 code so that it can benefit from the build system's features. Mainly, you want |
112 your source tree layout to look similar to the LLVM source tree layout. The | 49 your source tree layout to look similar to the LLVM source tree layout. |
113 best way to do this is to just copy the project tree from | |
114 ``llvm/projects/sample`` and modify it to meet your needs, but you can certainly | |
115 add to it if you want. | |
116 | 50 |
117 Underneath your top level directory, you should have the following directories: | 51 Underneath your top level directory, you should have the following directories: |
118 | 52 |
119 **lib** | 53 **lib** |
120 | 54 |