LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-13-2006, 03:52 AM   #1
reakinator
Member
 
Registered: Oct 2005
Location: California
Distribution: Ubuntu Feisty
Posts: 52

Rep: Reputation: 15
can someone help me with a makefile?


Hello,

I'm no good with makefiles yet. Nonetheless, I have the source for a program that I would like to build and a makefile that worked with previous versions of the program. But I get an error pretty fast saying: *** No rule to make target `main.o', needed by `SDIFEdit'.

Here is the guts of the makefile. main.cpp is in ../source.:


MAKE = make
PROJECTDIR = $(PWD)
CXX = g++
PREFIX=/usr/local

CXXFLAGS = -Wall -W $(DBFLAG) $(OPTFLAG) $(CPPFLAGS) -I../source/stk -I../source -I. \
-I${PREFIX}/include -I/usr/include -I/usr/local/include -D __LINUX_OSS__
LDFLAGS = $(DBFLAG) -L${PREFIX}/lib/$(SYS) -L/usr/X11R6/lib -L/usr/lib -L. -L.. -lglut -lGL -lGLU -lXmu -lSM -lICE -lXext -lX11 -ldl -lsdif$(DBEXT) -lm


editor_OBJS = Window.o MainWindow.o SdifViewer.o SplineEditor.o SplineSurface.o SdifDescriptor.o SVMatrix.o SVStream.o GUIComponent.o Sonagram.o ColorChooser.o SliceViewWindow.o ViewPointsWindow.o AudioWindow.o AudioPlayer.o EventManager.o

stk_OBJS = stk/Stk.o stk/WaveLoop.o stk/WvIn.o stk/WvOut.o stk/RtWvOut.o stk/RtAudio.o

OBJS = main.o $(editor_OBJS)

all: SDIFEdit

SDIFEdit: $(OBJS)
$(CXX) $(OBJS) $(LDFLAGS) -o SDIFEdit


If anyone wiser than myself can give some insight, thankyou many times.

Richie
 
Old 05-13-2006, 08:26 AM   #2
taylor_venable
Member
 
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892

Rep: Reputation: 43
Since the object files don't already exist within the directory, the Makefile needs to know how to make them. In other words, for each object file, you need a rule telling how to compile it from source.
 
Old 05-14-2006, 09:03 AM   #3
reakinator
Member
 
Registered: Oct 2005
Location: California
Distribution: Ubuntu Feisty
Posts: 52

Original Poster
Rep: Reputation: 15
oops, I left out one important line:

all: SDIFEdit

SDIFEdit: $(OBJS)
$(CXX) $(OBJS) $(LDFLAGS) -o SDIFEdit

%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $<



I would assume this is the rule, saying look for a .cpp file with the same name, then abide the CXX flags already set and do what -c$< means. It obviously isn't what gcc is looking for though.

I hope to get this fixed soon, since this program is essential to work I'm doing in school. Likewise, I hope to learn how to use makefiles soon, since they cause my eyes to squint alot right now.

Cheers,
Richie
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what is the meaning of Makefile,Makefile.am,Makefile.in cynthia_thomas Linux - General 3 12-08-2005 05:00 AM
How to modify makefile.in or makefile.am QiangWan Linux - Newbie 1 05-17-2005 11:07 AM
how to get (makefile -f makefile )output into the textview widget in Pygtk sailu_mvn Programming 3 02-28-2005 03:57 AM
Makefile Quest101 Programming 3 01-05-2005 02:31 PM
generate Makefile from Makefile.in without calling ./configure ? chris78 Programming 2 05-02-2004 12:23 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration