Question: Gcc, Linux Requirements Write a Makefile, it should be able to(make) or if given the target all (make all). Requirements 1. Compile src/challenge.c into an
Gcc, Linux
Requirements Write a Makefile, it should be able to(make) or if given the target all (make all).
Requirements
1. Compile src/challenge.c into an executable challenge. You have a sole source file src/challenge.c, and need to use it to produce an executable named challenge(at the PROJECT directory level).
Use one rule to build obj/challenge.o from src/challenge.c, and another rule to build challenge from obj/challenge.o.
2. Create the output directory. Note that the output directory does not exists by default.
3. Run challenge on all input files challenge takes arguments in the form ./challenge [-n num_lines] [in_file] [out_file] The Makefile should have a variable NUM that is set to 20. (One can override the value of this variable with -e NUM=[num_lines], e.g, -e NUM=20.) And so for each file input/[file_name].in, an associated file named output/[file_name].out should be produced that contains the first NUM lines of [file_name].in. Note that the rule here should be a pattern rule. This rule needs both challenge and output as additional pre-requisites . 4. You should also provide a clean target. This target should delete the output folder and everything in it, as well as your .o file(s).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
