Question

In: Computer Science

in unix(bash) Write a Makefile with a recipe which can be used to compile myprog.c into...

in unix(bash)

Write a Makefile with a recipe which can be used to compile myprog.c into myprog. Be sure to indicate that "myprog" depends on myprog.c!

Solutions

Expert Solution

SOLUTION:

The following solution has been implemented in such a way that the Makefile specifies that the Output "myprog" depends on the file to be compiled being "myprog.c".

Makefile

# Select the Compiler
COMPILER = gcc

# Select the flags
FLAGS  = -g -Wall

# Select the File
FILE = myprog

# Describe the Target Functionality
all: $(FILE)

$(FILE): $(FILE).c
        $(COMPILER) $(FLAGS) -o $(FILE) $(FILE).c

clean:
        $(RM) $(FILE)

*** Target "clean" is not mangatory***

SCREENSHOT:

Note:

The Makefile has 2 targets, i) all ii) clean

Since all comes first it will be executed first by default, unless a target for execution is specified.

You can either issue the command "make" or "make all".

The "clean" target can be executed using the command "make clean".

Hope this helps..!


Related Solutions

UNIX ONLY Write a bash script that will accept a filename as a command line argument....
UNIX ONLY Write a bash script that will accept a filename as a command line argument. Your script should first check whether the filename has been passed as argument or not (hint: at least one argument has to be provided). If no argument has been provided your script should display appropriate message and exit. If a file name has been provided, your script should check if the file exists in the current directory and display the contents of the file....
Program in Bash: Write a program using bash script that can read a file from the...
Program in Bash: Write a program using bash script that can read a file from the same directory, sort the nonrepeating integers from 0-9 from smallest to largest, and output the results on the same line. Do not use the sort function.
Program in Bash: Write a program using bash script that can read a file from the...
Program in Bash: Write a program using bash script that can read a file from the same directory, sort the nonrepeating integers from 0-9 from smallest to largest, and output the results on the same line. Do not use the sort function.
UNIX/LINUX LAB   (1) Compile hello.c program: gcc hello.c -o hello (2) Compile hello.c program with -static...
UNIX/LINUX LAB   (1) Compile hello.c program: gcc hello.c -o hello (2) Compile hello.c program with -static option: gcc -static hello.c -o hello1 (3) Use size command to see the memory layout of these two programs (hello and hello1). (4) Write a brief summary of what you have noted here. Submit the session history (log) of this activity and a brief summary. hello.c program bottom //////////// #include <stdio.h> #include <stdlib.h> int main() { printf("Hello World\n"); // waw hello Richard and ok...
create a questionaire that can be used to compile a report for the assignment below "The...
create a questionaire that can be used to compile a report for the assignment below "The students are expected to visit any company of their choice and find out how they do their maintenance budget. Conduct interviews with va rious levels of personnel. The student is expected to present a typed three- pages report (detailed report) toget her with the completed interview question with responses from the company maintenance personnel. Company maintenance budget must be attached to the report. Proof...
Write a recipe for someone else to make a good mayo. In your recipe include the...
Write a recipe for someone else to make a good mayo. In your recipe include the ingredients, their amounts and directions on how to combine the ingredients in order to end up with a stable emulsion.
Use the Design Recipe to write a function count_vowels, which consumes a string and returns the...
Use the Design Recipe to write a function count_vowels, which consumes a string and returns the number of vowels in that string. For these purposes, the vowels are a, e, i, o, and u, but never y. Include a Docstring! Note: Count both upper and lowercase vowels! Write 3 assert_equal statements to test your function.
UNIX/LINUX LAB (1) Review the sample shell program (tryShell.c), and compile/run the program (tryShell) with the...
UNIX/LINUX LAB (1) Review the sample shell program (tryShell.c), and compile/run the program (tryShell) with the following commands, and at the end, use CTRL+C to terminate the program: ls ls -l tryShell* date whoami hostname uname -a ctrl+C    (2) Run the program (tryShell) with "time -p" with a few commands: time -p ./tryShell (3) Edit the program (tryShell.c) so that it will exit (terminate the program) when the input command string is "exit" try shell.c code at bottom //////////// #include...
please write in c using linux or unix Write a program that will simulate non -...
please write in c using linux or unix Write a program that will simulate non - preemptive process scheduling algorithm: First Come – First Serve Your program should input the information necessary for the calculation of average turnaround time including: Time required for a job execution; Arrival time; The output of the program should include: starting and terminating time for each job, turnaround time for each job, average turnaround time. Step 1: generate the input data (totally 10 jobs) and...
Please write in C using linux or unix. Write a program that will simulate non -...
Please write in C using linux or unix. Write a program that will simulate non - preemptive process scheduling algorithm: First Come – First Serve Your program should input the information necessary for the calculation of average turnaround time including: Time required for a job execution; Arrival time; The output of the program should include: starting and terminating time for each job, turnaround time for each job, average turnaround time. Step 1: generate the input data (totally 10 jobs) and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT