llvm.org GIT mirror llvm / 527036d
Documentation: use a 'console' highlighter for terminal output examples. This gives a nicer output than 'bash'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169979 91177308-0d34-0410-b5e6-96231b3b80d8 Dmitri Gribenko 6 years ago
2 changed file(s) with 39 addition(s) and 39 deletion(s). Raw diff Collapse all Expand all
7878 #. Run ``configure`` with an alternative ``PATH`` that is correct. In a
7979 Bourne compatible shell, the syntax would be:
8080
81 .. code-block:: bash
81 .. code-block:: console
8282
8383 % PATH=[the path without the bad program] ./configure ...
8484
105105 If the Makefile already exists in your object tree, you can just run the
106106 following command in the top level directory of your object tree:
107107
108 .. code-block:: bash
108 .. code-block:: console
109109
110110 % ./config.status ;
111111
132132
133133 For example, if you built LLVM with the command:
134134
135 .. code-block:: bash
135 .. code-block:: console
136136
137137 % gmake ENABLE_PROFILING=1
138138
139139 ...then you must run the tests with the following commands:
140140
141 .. code-block:: bash
141 .. code-block:: console
142142
143143 % cd llvm/test
144144 % gmake ENABLE_PROFILING=1
174174 -----------------------------------------------------------------------------
175175 If the error is of the form:
176176
177 .. code-block:: bash
177 .. code-block:: console
178178
179179 gmake[2]: *** No rule to make target `/path/to/somefile',
180 needed by `/path/to/another/file.d'.
180 needed by `/path/to/another/file.d'.
181181 Stop.
182182
183183 This may occur anytime files are moved within the Subversion repository or
184184 removed entirely. In this case, the best solution is to erase all ``.d``
185185 files, which list dependencies for source files, and rebuild:
186186
187 .. code-block:: bash
187 .. code-block:: console
188188
189189 % cd $LLVM_OBJ_DIR
190190 % rm -f `find . -name \*\.d`
504504 If you would like to get the LLVM test suite (a separate package as of 1.4), you
505505 get it from the Subversion repository:
506506
507 .. code-block:: bash
507 .. code-block:: console
508508
509509 % cd llvm/projects
510510 % svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
522522 mirrors reflect only ``trunk`` for each project. You can do the read-only GIT
523523 clone of LLVM via:
524524
525 .. code-block:: bash
525 .. code-block:: console
526526
527527 % git clone http://llvm.org/git/llvm.git
528528
529529 If you want to check out clang too, run:
530530
531 .. code-block:: bash
531 .. code-block:: console
532532
533533 % git clone http://llvm.org/git/llvm.git
534534 % cd llvm/tools
539539 in your clone. To configure ``git pull`` to pass ``--rebase`` by default on the
540540 master branch, run the following command:
541541
542 .. code-block:: bash
542 .. code-block:: console
543543
544544 % git config branch.master.rebase true
545545
552552 branch, and ``mybranch`` is rebased onto ``master``. At first you may check
553553 sanity of whitespaces:
554554
555 .. code-block:: bash
555 .. code-block:: console
556556
557557 % git diff --check master..mybranch
558558
559559 The easiest way to generate a patch is as below:
560560
561 .. code-block:: bash
561 .. code-block:: console
562562
563563 % git diff master..mybranch > /path/to/mybranch.diff
564564
569569 But you may generate patchset with git-format-patch. It generates by-each-commit
570570 patchset. To generate patch files to attach to your article:
571571
572 .. code-block:: bash
572 .. code-block:: console
573573
574574 % git format-patch --no-attach master..mybranch -o /path/to/your/patchset
575575
576576 If you would like to send patches directly, you may use git-send-email or
577577 git-imap-send. Here is an example to generate the patchset in Gmail's [Drafts].
578578
579 .. code-block:: bash
579 .. code-block:: console
580580
581581 % git format-patch --attach master..mybranch --stdout | git imap-send
582582
602602
603603 To set up clone from which you can submit code using ``git-svn``, run:
604604
605 .. code-block:: bash
605 .. code-block:: console
606606
607607 % git clone http://llvm.org/git/llvm.git
608608 % cd llvm
621621 To update this clone without generating git-svn tags that conflict with the
622622 upstream git repo, run:
623623
624 .. code-block:: bash
624 .. code-block:: console
625625
626626 % git fetch && (cd tools/clang && git fetch) # Get matching revisions of both trees.
627627 % git checkout master
639639 ``dcommit``. When that happens, ``git svn dcommit`` stops working, complaining
640640 about files with uncommitted changes. The fix is to rebuild the metadata:
641641
642 .. code-block:: bash
642 .. code-block:: console
643643
644644 % rm -rf .git/svn
645645 % git svn rebase -l
721721
722722 #. Change directory into the object root directory:
723723
724 .. code-block:: bash
724 .. code-block:: console
725725
726726 % cd OBJ_ROOT
727727
728728 #. Run the ``configure`` script located in the LLVM source tree:
729729
730 .. code-block:: bash
730 .. code-block:: console
731731
732732 % SRC_ROOT/configure --prefix=/install/path [other options]
733733
763763 Once you have LLVM configured, you can build it by entering the *OBJ_ROOT*
764764 directory and issuing the following command:
765765
766 .. code-block:: bash
766 .. code-block:: console
767767
768768 % gmake
769769
774774 parallel build options provided by GNU Make. For example, you could use the
775775 command:
776776
777 .. code-block:: bash
777 .. code-block:: console
778778
779779 % gmake -j2
780780
856856 After following the instructions there for installing Sphinx, build the LLVM
857857 HTML documentation by doing the following:
858858
859 .. code-block:: bash
859 .. code-block:: console
860860
861861 $ cd SRC_ROOT/docs
862862 $ make -f Makefile.sphinx
892892
893893 * Change directory to where the LLVM object files should live:
894894
895 .. code-block:: bash
895 .. code-block:: console
896896
897897 % cd OBJ_ROOT
898898
899899 * Run the ``configure`` script found in the LLVM source directory:
900900
901 .. code-block:: bash
901 .. code-block:: console
902902
903903 % SRC_ROOT/configure
904904
944944 execute LLVM bitcode files directly. To do this, use commands like this (the
945945 first command may not be required if you are already using the module):
946946
947 .. code-block:: bash
947 .. code-block:: console
948948
949949 % mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
950950 % echo ':llvm:M::BC::/path/to/lli:' > /proc/sys/fs/binfmt_misc/register
954954 This allows you to execute LLVM bitcode files directly. On Debian, you can also
955955 use this command instead of the 'echo' command above:
956956
957 .. code-block:: bash
957 .. code-block:: console
958958
959959 % sudo update-binfmts --install llvm /path/to/lli --magic 'BC'
960960
12451245
12461246 #. Next, compile the C file into a native executable:
12471247
1248 .. code-block:: bash
1248 .. code-block:: console
12491249
12501250 % clang hello.c -o hello
12511251
12561256
12571257 #. Next, compile the C file into a LLVM bitcode file:
12581258
1259 .. code-block:: bash
1259 .. code-block:: console
12601260
12611261 % clang -O3 -emit-llvm hello.c -c -o hello.bc
12621262
12661266
12671267 #. Run the program in both forms. To run the program, use:
12681268
1269 .. code-block:: bash
1269 .. code-block:: console
12701270
12711271 % ./hello
12721272
12731273 and
12741274
1275 .. code-block:: bash
1275 .. code-block:: console
12761276
12771277 % lli hello.bc
12781278
12811281
12821282 #. Use the ``llvm-dis`` utility to take a look at the LLVM assembly code:
12831283
1284 .. code-block:: bash
1284 .. code-block:: console
12851285
12861286 % llvm-dis < hello.bc | less
12871287
12881288 #. Compile the program to native assembly using the LLC code generator:
12891289
1290 .. code-block:: bash
1290 .. code-block:: console
12911291
12921292 % llc hello.bc -o hello.s
12931293
12941294 #. Assemble the native assembly language file into a program:
12951295
1296 .. code-block:: bash
1297
1298 **Solaris:** % /opt/SUNWspro/bin/cc -xarch=v9 hello.s -o hello.native
1299
1300 **Others:** % gcc hello.s -o hello.native
1296 .. code-block:: console
1297
1298 % /opt/SUNWspro/bin/cc -xarch=v9 hello.s -o hello.native # On Solaris
1299
1300 % gcc hello.s -o hello.native # On others
13011301
13021302 #. Execute the native code program:
13031303
1304 .. code-block:: bash
1304 .. code-block:: console
13051305
13061306 % ./hello.native
13071307