Matthias Andreas Benkard | f59e097 | 2018-04-10 22:01:34 +0200 | [diff] [blame] | 1 | For detailed information on using, building, and modifying Weld, please visit: |
| 2 | http://www.agottem.com/weld |
| 3 | |
| 4 | Weld provides a variety of options when building. When building, the following variables may be set |
| 5 | either in your environment or on the command line: |
| 6 | |
| 7 | source_path -- set to the root of the project |
| 8 | build_path -- set to the directory all build output should be directed to |
| 9 | config_file -- arbitrary file to include with the build which may set additional settings |
| 10 | mode -- set to 'release' or 'debug' to build the desired binary |
| 11 | arch -- set to the desired architecture such as 'i686' or 'amd64' |
| 12 | platform -- set to the desired platform target such as 'unix' or 'win32' |
| 13 | c_toolchain -- set to the toolchain to use for the build such as 'gcc' |
| 14 | show_progress -- set to 1 to print the name of each artifact being built |
| 15 | debug_weld -- set to 1 to print out internal weld debugging info |
| 16 | |
| 17 | The above variables may be simply set in your weld project's top-level makefile or in a config file |
| 18 | which is specified by the "config_file" variable. For instance, you could define the config file |
| 19 | "example_config.mk" below: |
| 20 | |
| 21 | example_config.mk: |
| 22 | source_path := /my/projects/fun |
| 23 | build_path := /my/projects/build |
| 24 | mode := debug |
| 25 | arch := i686 |
| 26 | platform := linux |
| 27 | c_toolchain := gcc |
| 28 | |
| 29 | You could then build with the command line: |
| 30 | make config_file=example_config.mk |
| 31 | |
| 32 | Alternatively you could simply add these options to your project's top-level makefile: |
| 33 | |
| 34 | makefile: |
| 35 | source_path := /my/projects/fun |
| 36 | build_path := /my/projects/build |
| 37 | mode := debug |
| 38 | arch := i686 |
| 39 | platform := linux |
| 40 | c_toolchain := gcc |
| 41 | |
| 42 | include $(weld_path)/weld.mk |
| 43 | |
| 44 | With the above, you could then simply build with the command line: |
| 45 | make |
| 46 | |
| 47 | Once your weld project is setup, you can build by specifying the following targets |
| 48 | |
| 49 | # build everything |
| 50 | make |
| 51 | make build |
| 52 | |
| 53 | # clean everything |
| 54 | make clean |
| 55 | |
| 56 | # build just a single component and its dependencies |
| 57 | make my_component_name |
| 58 | |
| 59 | # build just a single source file for a component |
| 60 | make my_component_name/source.o |
| 61 | |
| 62 | # install just a component's headers |
| 63 | make my_component_name_headers |
| 64 | |
| 65 | # clean just a component's headers |
| 66 | make clean_my_component_name_headers |
| 67 | |
| 68 | # install just a component's resources |
| 69 | make my_component_name_resources |
| 70 | |
| 71 | # clean just a component's resources |
| 72 | make clean_my_component_name_resources |
| 73 | |
| 74 | # make just a library |
| 75 | make libmy_component_name.a |
| 76 | |
| 77 | # make just a binary |
| 78 | make bin/my_component_name |
| 79 | |
| 80 | The above make commands may be a bit verbose for your taste as each command is echoed |
| 81 | to the terminal. For something a little easier to read, you might prefer: |
| 82 | make --quiet show_progress=1 |
| 83 | |
| 84 | There are quite a few options and possibilities involved here. For the best experience, |
| 85 | I recommend doing something like this: |
| 86 | alias weld="make -C /my/project/root --quiet show_progress=1"" |
| 87 | |
| 88 | The above will enable you to, from any directory, do the following: |
| 89 | weld my_component |
| 90 | weld clean |
| 91 | weld |