In this project, I practiced writing Makefiles.
- tests: Folder of test files. Provided by Holberton School.
-
holberton.c: C function that displays a seahorse in text. Used for Makefile practice purposes throughout project. Provided by Holberton School.
-
main.c: Main C function that runs the function defined in holberton.c. Provided by Holberton School.
- m.h: Header file defining the function prototype used in
holberton.c. Provided by Holberton School.
-
0. make -f 0-Makefile
- 0-Makefile: Makefile that creates an executable
holbertonbased on holberton.c and main.c. Includes:- Rule
allthat builds the executable.
- Rule
- 0-Makefile: Makefile that creates an executable
-
1. make -f 1-Makefile
- 1-Makefile: Makefile that creates an executable
holbertonbased on holberton.c and main.c. Builds on 0-Makefile with:- Variable
CCthat defines the compiler to be used. - Variable
SRCthat defines the.cfiles to compile. - The
allrule only recompiles updated source files.
- Variable
- 1-Makefile: Makefile that creates an executable
-
2. make -f 2-Makefile
- 2-Makefile: Makefile that creates an executable
holbertonbased on holberton.c and main.c. Builds on 1-Makefile with:- Variable
OBJthat defines the.ofiles to compile. - Variable
NAMEthat defines the name of the executable.
- Variable
- 2-Makefile: Makefile that creates an executable
-
3. make -f 3-Makefile
- 3-Makefile: Makefile that creates an executable
holbertonbased on holberton.c and main.c. Builds on 2-Makefile with:- Rule
cleanthat deletes all Emacs/Vim temporary files as well as the executable. - Rule
ocleanthat deletes the object files. - Rule
fcleanthat deltes all of the temporary files, executable, and object files. - Rule
rethat forces recompilation of all source files. - Variable
RMthat defines the command to delete files.
- Rule
- 3-Makefile: Makefile that creates an executable
-
4. A complete Makefile
- 4-Makefile: Makefile that creates an executable
holbertonbased on holberton.c and main.c. Builds on 3-Makefile with:- Variable
CFLAGSthat defines the compiler flags-Wall -Werror -Wextra -pedantic.
- Variable
- 4-Makefile: Makefile that creates an executable
-
5. Island Perimeter
- 5-island_perimeter.py: Python function that returns the perimeter of an island defined in a grid.
- Prototype:
def island_perimeter(grid): - The parameter
gridis a list of a list of integers.- Water is represented by
0. - Land is represented by
1. - Each element of the lists represents a cell square of side length 1.
- Grid cells are connected horizontally/verticaly (not diagonally).
- The grid is rectangular, with a width and height not exceeding 100.
- The grid is completely surrounded by water, and there is either exactly one island or nothing.
- The island does not contain lakes (water inside disconnected from surrounding land).
- Water is represented by
-
6. make -f 100-Makefile
- 100-Makefile: Makefile that creates an executable
holbertonbased on holberton.c and main.c. Builds on 4-Makefile with:- Does not define the variable
RM. - Never uses the string
$(CFLAGS). - Does not compile if the header
m.his missing. - Works even if there are existing files of the same name as any of the Makefile rules in the current directory.
- Does not define the variable
- 100-Makefile: Makefile that creates an executable