---
# System prepended metadata

title: Makefile
tags: [linux2020]

---

# Makefile
###### tags: `linux2020`
Enter into your working directory, create a file and named it **makefile**.
```bash=
$ cd /yourWorkingDirectory
$ touch makefile
$ vim makefile
```
The most simple makefile looks like:
```cmake=
all:yourProgram.c
    gcc yourProgram.c -o yourProgram.out
clean:
    rm -f yourProgram.out
```
which can generate a .out file when you type the **make** in console. If you type **make clean** in the console, it will remove the .out file. Now, build your code and try it.
```bash=
$ cd /yourWorkingDirectory
$ make 
$ ./yourProgram.out
```
[Reference](https://mropengate.blogspot.com/2018/01/makefile.html), [More detail...](http://maxubuntu.blogspot.com/2010/02/makefile.html)