LinuxQuestions.org
Visit Jeremy's Blog.
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 02-02-2011, 05:32 AM   #1
HarryBoy
Member
 
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215

Rep: Reputation: 16
No rule to make target needed by `all'


My make file has the following lines:

blah blah

INCLUDES= -I./src \
-I./include \
-I$(PROJECTPATH)/myproject/libs/liburi/include

LDFLAGS+= -L$(PROJECTPATH)/myproject/libs/liburl/ \
-L$(PROJECTPATH)/myproject/libs/liburl/src \

EXTRA_LIBS+= libul.so.1 \
otherlibs.so.1


When I try to make it it says:

rm -f *.so.*
rm -f *.a
make: *** No rule to make target `liburi.so.1', needed by `all'. Stop.

The LDFLAGS specifies the library path, which is specified as -L$(PROJECTPATH)/myproject/libs/liburl/

When I check this directory on my machine I see that the file: liburi.so.1 is indeed there.

What is going wrong? I am new top make files so please help me understand what could be going wrong.
 
Old 02-02-2011, 06:11 AM   #2
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
I believe the problem is your settings for EXTRA_LIBS; try using the -l (lowercase L) following by the shorthand notation of the library name. Thus if you want to build with a library called "libfoo.so", the shorthand notation is "foo".

If you have a library named otherlibs.so, then it is not properly named. It should be libotherlibs.so, and when you specify it in EXTRA_LIBS, it should be done as -lotherlibs.

Also, it is not typical to specify the path to source code with LDFLAGS. I believe you should remove the second entry that you specified (ie. liburl/src).


P.S. Here's a simple Makefile (which I have not tested):
Code:
APP      = myprog

SRCS     = $(wildcard *.c)
OBJS     = $(SRCS:c=o)

INCLUDES = -I$(PROJECTPATH)/myproject/libs/liburl/include
DEBUG    = -g
CFLAGS   = -Wall -pedantic -c $(INCLUDES) $(DEBUG)

LDFLAGS  = -L$(PROJECTPATH)/myproject/libs/liburl
LDFLAGS += -lurl

.PHONY: all clean realclean

all : $(APP)

$(APP) : $(OBJS)
        $(CC) $^ $(LDFLAGS) -o $@

%.o : %.c
        $(CC) $(CFLAGS) $^

clean :
        $(RM) $(OBJS)

realclean : clean
        $(RM) $(APP)

Last edited by dwhitney67; 02-02-2011 at 06:23 AM.
 
  


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
Error in Makefile:No rule to make target `g++',needed by... stop karthik.c Programming 5 03-09-2009 12:55 AM
No rule to make target DAC960.c , needed by ll_rw_blk.o devika.pict Linux - Software 1 03-01-2009 04:13 PM
No rule to make target DAC960.c , needed by ll_rw_blk.o devika.pict Linux - Newbie 1 02-28-2009 11:55 PM
Help needed for make file problem : make: *** No rule to make target `flash', needed rameshsatyavaram Linux - Newbie 3 09-11-2008 02:13 AM
No rule to make target `-lwrap', needed by `ftpd' seanog07 SUSE / openSUSE 2 07-14-2006 03:21 AM

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

All times are GMT -5. The time now is 05:40 AM.

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