An introductory project on:
- Makefiles and how to use them
- Explicit and implicit rules
- Setting variables
- Ubuntu 14.04
- gcc 4.8.4
- GNU Make 3.81
- Source files for all Makefiles: main.c, holberton.c, m.h
- Requirements:
- name of the executable:
holberton
- rules:
all
all
: builds your executable
- variables: none
- name of the executable:
- Requirements:
- name of the executable:
holberton
- rules:
all
all
: builds your executable
- variables:
CC
,SRC
CC
: the compiler to be usedSRC
: the.c
files
- name of the executable:
- Requirements:
- name of the executable:
holberton
- rules:
all
all
: builds your executable
- 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
- name of the executable:
- 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 all Emacs and Vim 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 command to delete files
- The
all
rule should recompile only the updated source files - You are not allowed to have a list of all the
.o
files - The
clean
,oclean
,fclean
, andre
rules should never fail
- name of the executable:
- 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 all Emacs and Vim 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 command to delete filesCFLAGS
: compiler flags-Wall -Werror -Wextra -pedantic
- The
all
rule should recompile only the updated source files - You are not allowed to have a list of all the
.o
files - The
clean
,oclean
,fclean
, andre
rules should never fail
- name of the executable:
- 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 all Emacs and Vim 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 command to delete filesCFLAGS
: compiler flags-Wall -Werror -Wextra -pedantic
- The
all
rule should recompile only the updated source files - You are not allowed to have a list of all the
.o
files - The
clean
,oclean
,fclean
, andre
rules should never fail - You have to use
$(RM)
for the cleaning up rules, but you are not allowed to set theRM
variable - You are only allowed to use the string
$(CC)
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 rules
- Your Makefile should not compile if the header file
m.h
is missing
- name of the executable: