---
# System prepended metadata

title: Regular Meeting (2020.8.2)
tags: [Regular Meeting, DeWei]

---

# Regular Meeting (2020.8.2)

* [`""` for arugment in makefile](https://github.com/curly-wei/xvc-zybo-z7/blob/main/doc/faq/makefile_faq.md)
* The trap of Makefile
* Doc also update when I done its step
* Build will complete this week

## The trap of Makefile

Let's recall the [problem](https://hackmd.io/cUcw3TSvThq1SVBDQONp3Q#Regular-Meeting-2020726) last week

### Example

Makefile in `./`
```makefile
kBDir := $(shell pwd)/build
kODir := $(shell pwd)/out

all: build_sw

init: 
  mkdir -p ${kBDir} ${kODir}

${kODir}/t.elf : init 
  make -C dir O_DIR=${kODir} B_DIR=${kBDir} 

.PHONY: init
```
Makefile in `./dir`

```makefile
kODir := ${O_DIR}
kBDir := ${B_DIR}

kObj := ${kBDir}/t.o
kExec := ${kODir}/t.elf

all: ${kObj} ${kExec}

${kExec}: ${kObj}
  gcc ${kBDir}/t.o -o ${kODir}/t.elf
${kObj}: t.c 
  gcc -c t.c -o ${kBDir}/t.o

```

Probmlem:

if we remove `./build/t.o`, run `make again`, 

then we will get message `nothing to do`

How to solve:

Makefile in `./`
```makefile
kBDir := $(shell pwd)/build
kODir := $(shell pwd)/out

all: build_sw

init: 
  mkdir -p ${kBDir} ${kODir}

build_sw: init 
  make -C dir O_DIR=${kODir} B_DIR=${kBDir}

.PHONY: init
```

`${kODir}/t.elf: init` -> `build_sw: init`

`build_sw` seems *label*,

when run `make build_sw`, 

make will always go to (`-C` `cd` ) `dir` to do sub-makefile(`dir/Makefile`),

include check if file has been changed

###### tags: `Regular Meeting` `DeWei`