Question

C language. A Makefile should have (at least) the following rules: Rules to compile .c files...

C language. A Makefile should have (at least) the following rules:
Rules to compile .c files into .o files (input.o, display.o, and main.o)
An all rule that will combine input.o, display.o, and main.o into an executable called "scroll".
A clean rule that will remove the executable scroll and all .o files
A run rule that will run the program.
Any extra rules you find helpful.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

I dont have any information about the input.c,display.c and main.c files so i am using my own simple coded files. But the makefile works with your files also...

Look at the code and comments for better understanding...................:-))

Screenshot of the codes:

-/QA/c/input.c - Sublime Text (UNREGISTI -/QA/c/display.c - Sublime Text (UNREGISTERE Find View Goto Tools Project Pref File

Screenshot of the Makefile code:

--/QA/c/Makefile. - Sublime Text (UNREGISTERED) Project Preferences Help File Edit Selection Find View Goto Tools Makefile al

Output:

gm@Tricia: -/QA/C File Edit View Search Terminal Help gm@Tricia:-/QA/c$ make gcc input.o display.o main.o -o scroll ./scroll

Code to copy:

all: compile run
#Rules to compile the input.c display.c amd main.c
input.o: input.c
        gcc -c input.c
display.o: display.c
        gcc -c display.c
#I am passing -w option to disable unwanted warnings you can remove it if you want
main.o: main.c
        gcc -c -w main.c

#Rule to generate the executable scroll
compile: input.o display.o main.o
        gcc input.o display.o main.o -o scroll
#Rule to run the executable
run:
        ./scroll
#Rule to clean the file
clean:
        rm -rf *.o

I hope this would help.................:-))

Add a comment
Know the answer?
Add Answer to:
C language. A Makefile should have (at least) the following rules: Rules to compile .c files...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Make File you should create a Makefile containing targets for all the exercises; by default, the...

    Make File you should create a Makefile containing targets for all the exercises; by default, the Makefile should compile all the files, and the output of each of them should be an executable file named i. Further, when the make is called with a number, your Makefile should compile only that exercise. Examples: •make 1 compiles only 1.c into the executable file 1 •make compiles all C files •make clean removes all generated executable files OBS( I Have different programs...

  • The code in project2 is for a program that plays a simple game called Chomp. The...

    The code in project2 is for a program that plays a simple game called Chomp. The programmers of this project have opted to package some of their code in a “module” called chomp.adt, from which the related files cookie.h and cookie.cpp files can be generated. The steps necessary to produce this program are: Run the command csplit chomp.adt "/Split Here/" and copy the resulting file xx00 to cookie.h. Run the command csplit chomp.adt "/Split Here/" and copy the resulting file...

  • OUTPUT MUST MATCH THE IMAGE TO THE TEE. I have the majority of the program written,...

    OUTPUT MUST MATCH THE IMAGE TO THE TEE. I have the majority of the program written, just having issues with the output. Please make sure to have the right alignment, variable data types and number padding/decimals as shown below! ​ MUST BE IN C NOT C++/C#! Assume the Item Num is an int that must be padded with zeros (ex: 1234 ---> 00001234) Write a C program for a shopping list to run on ocelot. Use the listed items and...

  • You will write a C program, q1 sequence.c, that computes the value of the nth term...

    You will write a C program, q1 sequence.c, that computes the value of the nth term in any recursive sequence with the following structure: an = c1 · an−1 + c2 · an−2 a0 > 0 a1 > 0 c1 6= 0 c2 6= 0 Your C program will take 5 integer arguments on the command line: n, a0, a1, c1 and c2. n must be an integer greater than or equal to 0. If more or fewer arguments are...

  • Goals . Understand how to implement operator overloading in C++ Warning: Programs must compile us...

    c++ format Goals . Understand how to implement operator overloading in C++ Warning: Programs must compile using gt+ on the Computer Science Linux systems. If your code does not compile on CS machines you will get 0 for the assignment. Organize your files into folders by lab assignment. For this assignment, create a folder called Lab9. A. Read Chapter 18 B. Create a new class called RationalNumber to represent fractions. The class should have the following capabilities: 1) It should...

  • For this activity, you are required to provide files called fun.cpp as well as a makefile to comp...

    For this activity, you are required to provide files called fun.cpp as well as a makefile to compile and run it. In your file, fun.cpp, should have a skeleton of a main program as per normal which you will then fill it in as per the following. The objective of this activity is to demonstrate the basics of functions and their use. For this activity, you will need to declare your functions alongside your main program skeleton. You will use...

  • Tokeniser in C++

    TokenisersBackgroundThe primary task of any language translator is to work out how the structure and meaning of an input in a given language so that an appropriate translation can be output in another language. If you think of this in terms of a natural language such as English. When you attempt to read a sentence you do not spend your time worrying about what characters there are, how much space is between the letters or where lines are broken. What...

  • C++ 2.3 Activity 3: Bubble Sort For this activity, you are required to provide files called...

    C++ 2.3 Activity 3: Bubble Sort For this activity, you are required to provide files called act3.cpp as well as a makefile to compile and run it. In your file, act3.cpp, should have a skeleton of a main program as per normal which you will then fill it in as per the following. The objective of this activity is to demonstrate the bubble sort algorithm for arrays. You are going to implement this as a function with the following definition:...

  • Using PuTTY Linux Server Task Compiling:             1) Download the two files from blackboard, driver.cpp, and...

    Using PuTTY Linux Server Task Compiling:             1) Download the two files from blackboard, driver.cpp, and circle.h             2) Create a new directory to store the files in             3) Compile the code a) Run the command g++ driver.cpp -o executable_name, this will compile the code both for driver.cpp and the referenced file circle.h note: -o parameter specifies a new name for the executable, if you do not specify the “-o” parameter the default name of the executable is “a.out”...

  • I have 2 quiestions In the Makefile rule prog2.o: prog2.cpp Set.h Stack.h Queue.h g++ $(CCFLAGS) -c...

    I have 2 quiestions In the Makefile rule prog2.o: prog2.cpp Set.h Stack.h Queue.h g++ $(CCFLAGS) -c prog2.cpp what is the dependency list? A. prog2.o B. g++ $(CCFLAGS) -c prog2.cpp C. g++ D. prog2.cpp Set.h Stack.h Queue.h ------------------------------------------------- A C++ program named examProg written to accept command-line arguments is run at the Unix command line as follows: D987655@turing:~$ examProg dog cat frog What will be the value of argc? A. 1 B.2 C.3 D.4

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT