Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
db0ed16
index.html translated
Penthurion Aug 26, 2020
5a5ebda
presentation_cmake.md translated
Penthurion Aug 26, 2020
e7538e0
presentation_make.md translated
Penthurion Aug 27, 2020
ec9c7bf
presentation_homework.md translated
Penthurion Aug 27, 2020
15cd393
changed filenames
Penthurion Aug 27, 2020
771b819
changed filenames
Penthurion Aug 27, 2020
078211b
merged polish and english branches
Penthurion Aug 27, 2020
1cf7562
first part of minor fixes
Penthurion Aug 27, 2020
6c133e8
2nd part of minor fixes
Penthurion Aug 27, 2020
17bbc9a
deleted _presentation prefix from filenames
Penthurion Aug 27, 2020
e799e5f
deleted _presentation prefix from filenames
Penthurion Aug 27, 2020
f40e99b
README.md modified to have polish and english versions. Also fixed links
Penthurion Aug 27, 2020
e2823aa
deleted Coders School logo from english version
Penthurion Aug 27, 2020
23e1e75
Update module1/index.en.html
Penthurion Aug 27, 2020
328020c
Update module1/index.en.html
Penthurion Aug 27, 2020
68016a3
Update module1/01_make.en.md
Penthurion Aug 27, 2020
7d913f5
Update module1/02_cmake.en.md
Penthurion Aug 27, 2020
2979439
Update module1/index.pl.html
Penthurion Aug 27, 2020
cc2c479
Update module1/index.en.html
Penthurion Aug 27, 2020
c45393f
Update module1/02_cmake.en.md
Penthurion Aug 27, 2020
ce81fdf
fixed problem with mixed english and polish in files
Penthurion Aug 27, 2020
d119266
Merge branch 'master' of github.com:Penthurion/cmake
Penthurion Aug 27, 2020
55d3101
fixed polish/english mix problem
Penthurion Aug 27, 2020
864f9fe
fixed filenames linked in index.pl.html
Penthurion Aug 27, 2020
f250192
Update module1/index.en.html
Penthurion Aug 28, 2020
f0605db
Update module1/index.en.html
Penthurion Aug 28, 2020
c533a46
Update module1/index.en.html
Penthurion Aug 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@
<img width="500" data-src="coders_school_logo.png" src="coders_school_logo.png" alt="Coders School" class="plain">
</a>

## [Moduł 1](module1/)
## [Moduł 1](module1/index.pl.html)

### [`make`](module1/presentation_make.md)
### [`make`](module1/01_make.pl.md)

### [`cmake`](module1/presentation_cmake.md)
### [`cmake`](module1/02_cmake.pl.md)

### [homework](module1/presentation_homework.md)
### [Zadania domowe](module1/03_homework.pl.md)

___

# Build systems

## [Module 1](module1/index.en.html)

### [`make`](module1/01_make.en.md)

### [`cmake`](module1/02_cmake.en.md)

### [homework](module1/03_homework.en.md)
46 changes: 23 additions & 23 deletions module1/presentation_make.md → module1/01_make.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

___

## Pliki Makefile
## Makefiles

### Struktura pliku Makefile
### The structure of the Makefile

```Makefile
VARIABLE = value
Expand All @@ -24,7 +24,7 @@ targetB: dependencyB1

___

## Przykład - generowanie prezentacji w LaTeX
## Example - generating a presentation in LaTeX

```Makefile
TEX = pdflatex -shell-escape -interaction=nonstopmode -file-line-error
Expand All @@ -47,9 +47,9 @@ calculator:

___

## Kompilacja w C++
## Compilation in C ++

### Pamiętacie fazy kompilacji?
### Do you remember the build phases?
<!-- .element: class="fragment fade-in" -->

```Makefile
Expand All @@ -64,24 +64,24 @@ $(OBJECTS): src/%.o : src/%.cpp src/%.hpp
```
<!-- .element: class="fragment fade-in" -->

### Zmienne pamiętające kontekst
### Variables remembering the context
<!-- .element: class="fragment fade-in" -->

* <!-- .element: class="fragment fade-in" --> <code>$@</code> - nazwa pliku targetu w aktualnie uruchomionej regule
* <!-- .element: class="fragment fade-in" --> <code>$<</code> - nazwa pierwszej zależności
* <!-- .element: class="fragment fade-in" --> <code>$^</code> - lista wszystkich zależności (zawiera ewentualne duplikaty)
* <!-- .element: class="fragment fade-in" --> <code>$?</code> - lista wszystkich zależności, które są nowsze niż target
* <!-- .element: class="fragment fade-in" --> <code>$@</code> - the name of the target file in the currently running rule
* <!-- .element: class="fragment fade-in" --> <code>$<</code> - first dependency name
* <!-- .element: class="fragment fade-in" --> <code>$^</code> - list of all dependencies (includes any duplicates)
* <!-- .element: class="fragment fade-in" --> <code>$?</code> - a list of all dependencies that are newer than target

___

## Zadanie
## Exercise

W katalogu greeter znajdziesz malutki program. Zapoznaj się z jego kodem.
In the greeter directory you will find a small program. Familiarize yourself with its code.

* Skompiluj program z linii komend i uruchom go.
* Napisz prosty Makefile dla tego programu. Zbuduj go za pomocą `make` i uruchom.
* Compile the program from the command line and run it.
* Write a simple Makefile for this program. Build it with `make` and run it.

### Zaklęcie kompilacji
### Spell of building

```bash
g++ -std=c++17 -Wall -Werror -Wextra -pedantic *.cpp -o greeter
Expand All @@ -90,19 +90,19 @@ g++ -std=c++17 -Wall -Werror -Wextra -pedantic *.cpp -o greeter

___

## Polecenie `make`
## `make` command

* <!-- .element: class="fragment fade-in" --> domyślnie szuka w bieżącym katalogu pliku Makefile
* <!-- .element: class="fragment fade-in" --> automatyzuje czynności poprzez wykonywanie receptur zapisanych w plikach Makefile
* <!-- .element: class="fragment fade-in" --> domyślnie wykonuje pierwszą recepturę
* <!-- .element: class="fragment fade-in" --> pozwala na warunkowe wykonywanie czynności
* <!-- .element: class="fragment fade-in" --> pozwala definiować wiele zależności
* <!-- .element: class="fragment fade-in" --> domyślnie uwzględnia daty modyfikacji zależności i na tej podstawie podejmuje decyzję, czy wykonać daną recepturę
* <!-- .element: class="fragment fade-in" --> by default it looks for a Makefile in the current directory
* <!-- .element: class="fragment fade-in" --> automates activities by executing recipes saved in Makefile files
* <!-- .element: class="fragment fade-in" --> executes the first recipe by default
* <!-- .element: class="fragment fade-in" --> allows for conditional performance of activities
* <!-- .element: class="fragment fade-in" --> allows defining many dependencies
* <!-- .element: class="fragment fade-in" --> by default, it takes into account dependency modification dates and on this basis decides whether to execute a given recipe

___

## Q&A

### Linki
### links

[cpp-polska.pl](https://cpp-polska.pl/post/potwor-przeszlosci-makefile-cz-2)
108 changes: 108 additions & 0 deletions module1/01_make.pl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<!-- .slide: data-background="#111111" -->

# `make`

<a href="https://coders.school">
<img width="500" data-src="../coders_school_logo.png" alt="Coders School" class="plain">
</a>

___

## Makefiles

### The structure of the Makefile

```Makefile
VARIABLE = value

targetA: dependencyA1 dependencyA2
[TAB] command $(VARIABLE)

targetB: dependencyB1
[TAB] command
```

___

## Example - generating a presentation in LaTeX

```Makefile
TEX = pdflatex -shell-escape -interaction=nonstopmode -file-line-error
MAKE = make
CODE_DIR = src

.PHONY: all view

all: calculator pdf

view:
evince ContractProgramming.pdf

pdf: ContractProgramming.tex
$(TEX) ContractProgramming.tex

calculator:
$(MAKE) -C $(CODE_DIR)
```

___

## Compilation in C ++

### Do you remember the build phases?
<!-- .element: class="fragment fade-in" -->

```Makefile
SOURCES=$(wildcard src/*.cpp)
OBJECTS=$(patsubst %.cpp, %.o, $(SOURCES))

main: $(OBJECTS)
g++ $^ -o $@

$(OBJECTS): src/%.o : src/%.cpp src/%.hpp
g++ -c $< -o $@
```
<!-- .element: class="fragment fade-in" -->

### Variables remembering the context
<!-- .element: class="fragment fade-in" -->

* <!-- .element: class="fragment fade-in" --> <code>$@</code> - the name of the target file in the currently running rule
* <!-- .element: class="fragment fade-in" --> <code>$<</code> - first dependency name
* <!-- .element: class="fragment fade-in" --> <code>$^</code> - list of all dependencies (includes any duplicates)
* <!-- .element: class="fragment fade-in" --> <code>$?</code> - a list of all dependencies that are newer than target

___

## Exercise

In the greeter directory you will find a small program. Familiarize yourself with its code.

* Compile the program from the command line and run it.
* Write a simple Makefile for this program. Build it with `make` and run it.

### Spell of building

```bash
g++ -std=c++17 -Wall -Werror -Wextra -pedantic *.cpp -o greeter
./greeter
```

___

## `make` command

* <!-- .element: class="fragment fade-in" --> by default it looks for a Makefile in the current directory
* <!-- .element: class="fragment fade-in" --> automates activities by executing recipes saved in Makefile files
* <!-- .element: class="fragment fade-in" --> executes the first recipe by default
* <!-- .element: class="fragment fade-in" --> allows for conditional performance of activities
* <!-- .element: class="fragment fade-in" --> allows defining many dependencies
* <!-- .element: class="fragment fade-in" --> by default, it takes into account dependency modification dates and on this basis decides whether to execute a given recipe

___

## Q&A

### links

[cpp-polska.pl](https://cpp-polska.pl/post/potwor-przeszlosci-makefile-cz-2)
Loading