Skip to content

Commit fd958cf

Browse files
authored
moved file to right place
1 parent a076a6f commit fd958cf

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

Tools/Make/Example1/Makefiles.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# MAKE
2+
3+
> The hard work you don't see
4+
5+
You can find examples in the [Make Folder](Make)
6+
Makefiles are recepies. Basically you just define:
7+
| type | |
8+
| --- | --- |
9+
| variables | short names for commands and files |
10+
| rules | how to do it, which input/output to use |
11+
| targets | recepy-name (all when not specified)|
12+
13+
### Variables
14+
There are many conventions on naming them.
15+
As an example we would call TARGET the name of the final result, eg. executable\
16+
`TARGET = progname`
17+
18+
You recall it by putting \&() around the name like\
19+
`$(TARGET)`
20+
21+
If you define the compiler variable to be CC\
22+
you could do so to compile and build your program
23+
```
24+
CC = gcc
25+
$(CC) <source.c> -o $(TARGET)
26+
```
27+
28+
A simple Makefile cold just be:
29+
```
30+
TARGET = testing_C
31+
CC = gcc
32+
all:
33+
< TAB-8 > $(CC) <source.c> -o $(TARGET)
34+
```
35+
where < TAB-8 > is a real size 8 tab. ⚠️ not 8 spaces. this has to be set in your editor\
36+
`:set noexpandtab` `:set softtabstop=8` and `:set ts=8` in vim
37+
38+
You can make it permanent to your file:\
39+
On the first line of Makefile write the following _vim_modeline_:
40+
41+
`vim: noexpandtab: ts=8: softtabstop=8`
42+
43+
> At this point, when you type `make`\
44+
> You will get `testing_C` in the current folder.

0 commit comments

Comments
 (0)