- What is a makefile and how does it work
- Installing the make utility
- make-official documentation
- More about Makefile
- 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
- Create your first Makefile.
name of the executable: school
rules: all
The all rule builds your executable
The all
rule builds your executable
variables: none
Mode: mandatory
File: 0-Makefile
- Requirements:
name of the executable: school
rules: all
The all rule builds your executable
The all
rule builds your executable
variables: CC, SRC
CC: the compiler to be used SRC: the .c files
CC
: the compiler to be used
SRC
: the .c
files
Mode: mandatory
File: 1-Makefile
- Create your first useful Makefile.
name of the executable: school
rules: all
The all rule builds your executable
The all
rule builds your executable
variables: CC, SRC, OBJ, NAME
CC: the compiler to be used SRC: the .c files OBJ: the .o files NAME: the name of the executable
CC
: the compiler to be used
SRC
: the .c
files
OBJ
: the .o
files
NAME
: 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
Mode: mandatory
File: 2-Makefile
- Requirements:
name of the executable: school
rules: all, clean, oclean, fclean, re
all: builds your executable clean: deletes all Emacs and Vim temporary files along with the executable oclean: deletes the object files fclean: deletes all Emacs and Vim temporary files, the executable, and the object files re: forces recompilation of all source files
all
: builds your executable
clean
: deletes all Emacs and Vim temporary files along with the executable
oclean
: deletes the object files
fclean
: deletes all Emacs and Vim temporary files, the executable, and the object files
re
: forces recompilation of all source files
variables: CC, SRC, OBJ, NAME, RM
CC: the compiler to be used SRC: the .c files OBJ: the .o files NAME: the name of the executable RM: the program to delete files
CC
: the compiler to be used
SRC
: the .c
files
OBJ
: the .o
files
NAME
: the name of the executable
RM
: 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
Mode: mandatory
File: 3-Makefile
- Requirements:
name of the executable: school
rules: all, clean, fclean, oclean, re
all: builds your executable clean: deletes all Emacs and Vim temporary files along with the executable oclean: deletes the object files fclean: deletes all Emacs and Vim temporary files, the executable, and the object files re: forces recompilation of all source files
all
: builds your executable
clean
: deletes all Emacs and Vim temporary files along with the executable
oclean
: deletes the object files
fclean
: deletes all Emacs and Vim temporary files, the executable, and the object files
re
: forces recompilation of all source files
variables: CC, SRC, OBJ, NAME, RM, CFLAGS
CC: the compiler to be used SRC: the .c files OBJ: the .o files NAME: the name of the executable RM: the program to delete files CFLAGS: your favorite compiler flags: -Wall -Werror -Wextra -pedantic
CC
: the compiler to be used
SRC
: the .c
files
OBJ
: the .o
files
NAME
: the name of the executable
RM
: the program to delete files
CFLAGS
: 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 fail
You are not allowed to have a list of all the .o
files
Mode: mandatory
File: 4-Makefile
- Technical interview preparation:
You are not allowed to google anything Whiteboard first
Mode: mandatory
File: 5-island_perimeter.py
- Requirements:
name of the executable: school
rules: all, clean, fclean, oclean, re
all: builds your executable clean: deletes all Emacs and Vim temporary files along with the executable oclean: deletes the object files fclean: deletes all Emacs and Vim temporary files, the executable, and the object files re: forces recompilation of all source files
all
: builds your executable
clean
: deletes all Emacs and Vim temporary files along with the executable
oclean
: deletes the object files
fclean
: deletes all Emacs and Vim temporary files, the executable, and the object files
re
: forces recompilation of all source files
variables: CC, SRC, OBJ, NAME, RM, CFLAGS
CC: the compiler to be used SRC: the .c files OBJ: the .o files NAME: the name of the executable RM: the program to delete files CFLAGS: your favorite compiler flags: -Wall -Werror -Wextra -pedantic
CC
: the compiler to be used
SRC
: the .c
files
OBJ
: the .o
files
NAME
: the name of the executable
RM
: the program to delete files
CFLAGS
: 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 fail
You are not allowed to have a list of all the .o
files
You have to use $(RM)
for the cleaning up rules, but you are not allowed to set the RM
variable
You are not allowed to use the string $(CC)
more than once in your Makefile
You are only allowed to use the string $(RM)
twice in your Makefile
You are not allowed to use the string $(CFLAGS)
(but the compiler should still use the flags you set in this variable)
You are not allowed to have an $(OBJ)
rule
You are not allowed to use the %.o: %.c
rule
Your Makefile should work even if there is a file in the folder that has the same name as one of your rule
Your Makefile should not compile if the header file m.h
is missing
Mode: #advanced
File: 100-Makefile