Makefiles

Video
There is a utility called make that aids in compiling c and c++ code, it is standard on a linux system
gnu make


Part1----------------------

for this lab you will create a Makefile for all the files provided for you
there is a small program that will display a generated password
it can produce 4 different types of passwords and passwords of various length
we want to compile this program 4 different times to produce 4 different executables
each will produce a different type of random password.


Prior to lab the layout and format of the basic Makefile will be discussed

you will create your own Makefile for this lab

you MUST use a variable to store the options for all calls to the compiler "-Wall -std=c++11"

you MUST use a variable to store the name of the compiler to use  "g++"



You MUST implement all the following commands:

make       --- start the make program with no additional data this will use the default or  "all" condition , simply compile all the executables

make clean   --- remove all files ending in (  .o, .gch, .log )  and all the executables this Makefile creates

make makeAlphaPassword   ---- compiles password.cpp (and any of its required files) to produce the executable makeAlphaPassword
                              you will need to set the preproccesor constant TYPE to 1


make makeNumericPassword   ---- compiles password.cpp (and any of its required files) to produce the executable makeNumericPassword
                              you will need to set the preproccesor constant TYPE to 2

make makeAlphaNumericPassword   ---- compiles password.cpp (and any of its required files) to produce the executable makeAlphaNumericPassword
                              you will need to set the preproccesor constant TYPE to 3

make makeSpecialPassword   ---- compiles password.cpp (and any of its required files) to produce the executable makeSpecialPassword
                              you will need to set the preproccesor constant TYPE to 4

make randomLib.o   ---- compile randomLib.cpp , it should recompile if ANY of the file requirements change


-------------
look at the output here, you can use this as a test your make file should behave EXACTLY as this one does, for each of the following commands

msarr@sleipnir> pwd /home/fac/msarr/assignments/cmps2020/lab/lab18 msarr@sleipnir> ls Makefile password.cpp randomLib.cpp randomLib.h msarr@sleipnir> make g++ -Wall -std=c++11 -c randomLib.cpp g++ -Wall -std=c++11 -o makeAlphaPassword -D TYPE=1 password.cpp randomLib.o g++ -Wall -std=c++11 -o makeAlphaNumericPassword -D TYPE=3 password.cpp randomLib.o g++ -Wall -std=c++11 -o makeNumericPassword -D TYPE=2 password.cpp randomLib.o g++ -Wall -std=c++11 -o makeSpecialPassword -D TYPE=4 password.cpp randomLib.o msarr@sleipnir> ls Makefile makeAlphaPassword makeSpecialPassword randomLib.cpp randomLib.o makeAlphaNumericPassword makeNumericPassword password.cpp randomLib.h msarr@sleipnir> make clean rm -f *~ core *.log *.gch *.o makeAlphaPassword makeAlphaNumericPassword makeNumericPassword makeSpecialPassword msarr@sleipnir> make makeAlphaNumericPassword g++ -Wall -std=c++11 -c randomLib.cpp g++ -Wall -std=c++11 -o makeAlphaNumericPassword -D TYPE=3 password.cpp randomLib.o msarr@sleipnir> make makeAlphaPassword g++ -Wall -std=c++11 -o makeAlphaPassword -D TYPE=1 password.cpp randomLib.o msarr@sleipnir> make makeNumericPassword g++ -Wall -std=c++11 -o makeNumericPassword -D TYPE=2 password.cpp randomLib.o msarr@sleipnir> make makeSpecialPassword g++ -Wall -std=c++11 -o makeSpecialPassword -D TYPE=4 password.cpp randomLib.o msarr@sleipnir> touch randomLib.h msarr@sleipnir> make g++ -Wall -std=c++11 -c randomLib.cpp g++ -Wall -std=c++11 -o makeAlphaPassword -D TYPE=1 password.cpp randomLib.o g++ -Wall -std=c++11 -o makeAlphaNumericPassword -D TYPE=3 password.cpp randomLib.o g++ -Wall -std=c++11 -o makeNumericPassword -D TYPE=2 password.cpp randomLib.o g++ -Wall -std=c++11 -o makeSpecialPassword -D TYPE=4 password.cpp randomLib.o msarr@sleipnir> make make: Nothing to be done for `all'. msarr@sleipnir> ls Makefile makeAlphaPassword makeSpecialPassword randomLib.cpp randomLib.o makeAlphaNumericPassword makeNumericPassword password.cpp randomLib.h msarr@sleipnir> make clean rm -f *~ core *.log *.gch *.o makeAlphaPassword makeAlphaNumericPassword makeNumericPassword makeSpecialPassword msarr@sleipnir> ls Makefile password.cpp randomLib.cpp randomLib.h