]> git.donarmstrong.com Git - qmk_firmware.git/blob - Embedding.md
Created Embedding (markdown)
[qmk_firmware.git] / Embedding.md
1 If you want to use TMK for your own keyboard project, you've got three options for embedding the [core][1].  
2 The recommended option is [subtrees](#1-git-subtree).
3
4 After adding the embed you'll need to [modify the Makefile](#modifications-to-the-makefile) of your project to point to the core correctly.
5
6 ## 1. git subtree
7
8 In order to set up the subtree in your project, first add the core repository as a remote:  
9 ```
10 git remote add -f core https://github.com/tmk/tmk_core
11 ```
12
13 Then add the core as a subtree (directory) in your local repository:  
14 ```
15 git subtree add -P tmk_core core master --squash
16 ```
17
18 And that's it!
19
20 When you want to update the subtree in your repository to match the master on [tmk_core][1], do this:  
21 ```
22 git subtree pull -P tmk_core core master --squash
23 ```
24
25 ## 2. git submodule
26
27 In order to set up the submodule in your project, first add a new submodule:  
28 ```
29 git submodule add https://github.com/tmk/tmk_core tmk_core
30 ```
31
32 Then pull, sync and update the submodule:  
33 ```
34 git pull
35 git submodule sync --recursive
36 git submodule update --init --recursive
37 ```
38
39 And that's it!
40
41 When you want to update the subtree in your repository to match the master on [tmk_core][1], follow the same steps as above.
42
43 If you want to clone a repository from GitHub that has submodule(s) in it, pass <kbd>--recursive</kbd> when cloning, like so:  
44 `git clone --recursive https://github.com/<username>/<repository>`
45
46 ## 3. Manually (without git)
47
48 *Note: This is not recommended in any way, but it's still possible.*
49
50 Download a zipped version of the [tmk_core][1] repository using this link:  
51 <https://github.com/tmk/tmk_core/archive/master.zip>
52
53 Extract the zip in your project's directory, then rename the folder to <kbd>tmk_core</kbd>.
54
55 ## Modifications to the *Makefile*
56
57 The one thing you have to make sure to change in the *Makefile* (compared to [tmk_keyboard](https://github.com/tmk/tmk_keyboard) drivers' *[Makefile](https://github.com/tmk/tmk_keyboard/blob/master/keyboard/gh60/Makefile#L45)*) is the "TMK_DIR" variable, which needs to point to the embed directory:  
58 ```Makefile
59 TMK_DIR = ./tmk_core
60 ```
61
62 [1]: https://github.com/tmk/tmk_core