Question: Modify the Makefile1 so that all files generates o file. - see link above. Have a separate target for each .o file, retain the $(CFLAGS)

 Modify the Makefile1 so that all files generates o file. -

see link above. Have a separate target for each .o file, retain

Modify the Makefile1 so that all files generates o file. - see link above. Have a separate target for each .o file, retain the $(CFLAGS) variable and just add the -c flag to generate a .o file. Test it out: make -f Makefile1 clean make -f Makefile1 Output should look exactly same as below: {csci-odin: ingrid: 163} make -f Makefile1 gcc -g -Wall -c runProgram.c gcc -g -Wall -C statistics.c gcc -g -Wall -c getInput.c gcc -g -Wall statistics.c getInput.c runProgram.c -o runProgram gcc -g -Wall longProgram.c -o longProgram * there is a typo in the image above, one the line where you create the runProgram executable, the .c files need to be .o files. Makefile1 1 CFLAGS -g -Wall 2 CC gcc 3 4 all: runProgram longProgram 5 6 8 # 9 # checks time stamps of all pre-requisites and check if it needs 10 # recompilation 11 # 12 # Modfy the prereqs which are currently .c files to .o files. 13 # Move the .h prereq to the prerque of the target statistics.o 14 # 15 # Note to complile .c files to a .o file you need the 16 # -c flag 17 # 18 # # https://www.gnu.org/software/make/manual/html_node/Simple-Makefile.html 19 # 20 # 21 # 22 runProgram: runProgram.c getInput.c statistics.c statistics.h $(CC) $(CFLAGS) statistics.c getInput.c runProgram.c -o runProgram 23 24 25 26 # add .o file targets here, one for each .c file 27 # 28 runProgram.o: runProgram.c 29 $(CC) $(CFLAGS) -c runProgram.c 30 31 getInput.o: getInput.c 32 $(CC) $(CFLAGS) -c getInput.c 33 34 statistics.o: statistics.c 35 $(CC) $(CFLAGS) -c statistics.c 36 37 longProgram: longProgram.c 38 $(CC) $(CFLAGS) $@.C -0 $a 39 40 clean: rm -f runProgram 42 rm -f longProgram rm -f *.0 44 rm -rf runProgram.dSYM rm -rf longProgram.dSYM 41 43 45 46 47 Modify the Makefile1 so that all files generates o file. - see link above. Have a separate target for each .o file, retain the $(CFLAGS) variable and just add the -c flag to generate a .o file. Test it out: make -f Makefile1 clean make -f Makefile1 Output should look exactly same as below: {csci-odin: ingrid: 163} make -f Makefile1 gcc -g -Wall -c runProgram.c gcc -g -Wall -C statistics.c gcc -g -Wall -c getInput.c gcc -g -Wall statistics.c getInput.c runProgram.c -o runProgram gcc -g -Wall longProgram.c -o longProgram * there is a typo in the image above, one the line where you create the runProgram executable, the .c files need to be .o files. Makefile1 1 CFLAGS -g -Wall 2 CC gcc 3 4 all: runProgram longProgram 5 6 8 # 9 # checks time stamps of all pre-requisites and check if it needs 10 # recompilation 11 # 12 # Modfy the prereqs which are currently .c files to .o files. 13 # Move the .h prereq to the prerque of the target statistics.o 14 # 15 # Note to complile .c files to a .o file you need the 16 # -c flag 17 # 18 # # https://www.gnu.org/software/make/manual/html_node/Simple-Makefile.html 19 # 20 # 21 # 22 runProgram: runProgram.c getInput.c statistics.c statistics.h $(CC) $(CFLAGS) statistics.c getInput.c runProgram.c -o runProgram 23 24 25 26 # add .o file targets here, one for each .c file 27 # 28 runProgram.o: runProgram.c 29 $(CC) $(CFLAGS) -c runProgram.c 30 31 getInput.o: getInput.c 32 $(CC) $(CFLAGS) -c getInput.c 33 34 statistics.o: statistics.c 35 $(CC) $(CFLAGS) -c statistics.c 36 37 longProgram: longProgram.c 38 $(CC) $(CFLAGS) $@.C -0 $a 39 40 clean: rm -f runProgram 42 rm -f longProgram rm -f *.0 44 rm -rf runProgram.dSYM rm -rf longProgram.dSYM 41 43 45 46 47

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!