understanding Makefile

i know it's unix related, but i'm having a hard time getting some response. If anyone could guide me in the right directed or help explain what I'm mixing up, it'd be greatly appreciated...

I have a homework assignment but I am struggling to create the makefile. My teacher hasn't provided any walk through examples (and it's an online class).Please help!

here are the directions:
Create a makefile that builds executables test1.x and test2.x. Look at the #include statements in test1.cpp and test2.cpp to deduce what the intermediate targets and dependencies should be.

Design the class ID, placing the definition in file id.h

Implement the class ID, placing the class implementation in file id.cpp. You can test the code for syntax errors with the command "make id.o" or the command "co3330 id".

Thoroughly test class ID, starting out with the supplied test harnesses in file hw3/test?.cpp using your makefile to build the executables. (Note - you could also use the command line compile scripts "co3330" to create object files and then and "g++ -otest1.x id.o test1.o" to create executables, as in Homework 1.)

Turn in id.h, id.cpp, and makefile using the submit script.


_____

so far I have...

id.cpp: id.h
<tab> g++47 -c -Wall - Wextra -I. id.cpp
test1.cpp: id.cpp id.h
<tab> g++47 -c -Wall -Wextra -I. test1.cpp
test2.cpp: id.h
<tab> g++47 -c -Wall -Wextra -I. test2.cpp

I don't even know where to go. We were previously given the makefiles to copy into our directory, and now expected to understand how to do it ourselves. If anyone could help explain this...


_____________

should i be creating the .o files as well..

id.o: id.h id.cpp
<tab> g++47 -c -Wall -Wextra -I. id.cpp
id.cpp: id.h
<tab> g++47 -c -Wall -Wextra -I. test1.cpp
test2.o: id.h id.cpp
<tab> g++47 -c -Wall -Wextra -I. test2.cpp
test.x: id.o test1.o test2.o
<tab> g++47 -otest.x test1.o test2.o id.o
Read Chapter 2: An Introduction to Makefiles in this tutorial
https://www.gnu.org/software/make/manual/make.html#Introduction
Topic archived. No new replies allowed.