- What are
make
, Makefiles - When, why and how to use Makefiles
- What are rules and how to set and use them
- What are explicit and implicit rules
- What are the most common / useful rules
- What are variables and how to set and use them
- Allowed editors:
vi
,vim
,emacs
- OS: Ubuntu 20.04 LTS
- Version of
gcc
: 9.3.0 - Version of
make
: GNU Make 4.2.1 - All your files should end with a new line
- A
README.md
file, at the root of the folder of the project, is mandatory
In the following tasks, we are going to use these files. We want to compile these only.
Create your first Makefile.
Requirements:
- name of the executable:
holberton
- rules:
all
- The
all
rule builds your executable
- The
- variables: none
Requirements:
- name of the executable:
holberton
- rules:
all
- The
all
rule builds your executable
- The
- variables:
CC
,SRC
CC
: the compiler to be usedSRC
: the.c
files
Create your first useful Makefile.
Requirements:
- name of the executable:
holberton
- rules:
all
- The
all
rule builds your executable
- The
- variables:
CC
,SRC
,OBJ
,NAME
CC
: the compiler to be usedSRC
: the.c
filesOBJ
: the.o
filesNAME
: the name of the executable
- The
all
rule should recompile only the updated source files - You are not allowed to have a list of all the
.o
files
Requirements:
- name of the executable:
holberton
- rules:
all
,clean
,oclean
,fclean
,re
all
: builds your executableclean
: deletes all Emacs and Vim temporary files along with the executableoclean
: deletes the object filesfclean
: deletes the Emacs temporary files, the executable, and the object filesre
: forces recompilation of all source files
- variables:
CC
,SRC
,OBJ
,NAME
,RM
CC
: the compiler to be usedSRC
: the.c
filesOBJ
: the.o
filesNAME
: the name of the executableRM
: the program to delete files
- The
all
rule should recompile only the updated source files - The
clean
,oclean
,fclean
,re
rules should never fail - You are not allowed to have a list of all the
.o
files
Requirements:
- name of the executable:
holberton
- rules:
all
,clean
,fclean
,oclean
,re
all
: builds your executableclean
: deletes all Emacs and Vim temporary files along with the executableoclean
: deletes the object filesfclean
: deletes the Emacs temporary files, the executable, and the object filesre
: forces recompilation of all source files
- variables:
CC
,SRC
,OBJ
,NAME
,RM
,CFLAGS
CC
: the compiler to be usedSRC
: the.c
filesOBJ
: the.o
filesNAME
: the name of the executableRM
: the program to delete filesCFLAGS
: your favorite compiler flags:-Wall -Werror -Wextra -pedantic
- The
all
rule should recompile only the updated source files The
clean
,oclean
,fclean
,re
rules should never failYou are not allowed to have a list of all the
.o
files
Technical interview preparation:
- You are not allowed to google anything
- Whiteboard first
Create a function def island_perimeter(grid):
that returns the perimeter of the island described in grid
:
grid
is a list of list of integers:- 0 represents a water zone
- 1 represents a land zone
- One cell is a square with side length 1
- Grid cells are connected horizontally/vertically (not diagonally).
- Grid is rectangular, width and height don’t exceed 100
- Grid is completely surrounded by water, and there is one island (or nothing).
- The island doesn’t have “lakes” (water inside that isn’t connected to the water around the island).
Requirements:
- First line contains
#!/usr/bin/python3
- You are not allowed to import any module
- Module and function must be documented