Need Makefile HELP!
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Need Makefile HELP!




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Need Makefile HELP!  
dennis.varghese@wipro.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-25-07 06:20 AM

Hi ,

I have written the below Makefile .

srcdir   = ./lib
o        = .o

LDFLAGS  =
CC       = gcc
CFLAGS   = -O2 -Wall -Wno-implicit
INCLUDES = -I. -I$(srcdir)

COMPILE  = $(CC) $(INCLUDES) $(CFLAGS)
LINK     = $(CC) -o $@ $(CFLAGS) $(LDFLAGS)

RM       = rm -f

OBJ      = read_conf$o config_affairs$o getpass$o utilities$o        \
des$o md4$o http_header$o ntlm_procs$o ntlm_message$o     \
ntlm_auth$o base64$o basic_auth$o sig_hand$o              \
proxy_client$o server$o main$o

all: myaps

.o.c:     $(CC) $(CFLAGS) $(INCLUDES) -c $<

myaps: $(OBJ)       gcc $(CFLAGS) -o $@ $(OBJ)

.PHONY: clean

clean:      $(RM) *.o

After do make -n i get

gcc -O2 -Wall -Wno-implicit   -c -o read_conf.o read_conf.c
gcc -O2 -Wall -Wno-implicit   -c -o config_affairs.o config_affairs.c
gcc -O2 -Wall -Wno-implicit   -c -o getpass.o getpass.c
gcc -O2 -Wall -Wno-implicit   -c -o utilities.o utilities.c
gcc -O2 -Wall -Wno-implicit   -c -o des.o des.c
gcc -O2 -Wall -Wno-implicit   -c -o md4.o md4.c
gcc -O2 -Wall -Wno-implicit   -c -o http_header.o http_header.c
gcc -O2 -Wall -Wno-implicit   -c -o ntlm_procs.o ntlm_procs.c
gcc -O2 -Wall -Wno-implicit   -c -o ntlm_message.o ntlm_message.c
gcc -O2 -Wall -Wno-implicit   -c -o ntlm_auth.o ntlm_auth.c
gcc -O2 -Wall -Wno-implicit   -c -o base64.o base64.c
gcc -O2 -Wall -Wno-implicit   -c -o basic_auth.o basic_auth.c
gcc -O2 -Wall -Wno-implicit   -c -o sig_hand.o sig_hand.c
gcc -O2 -Wall -Wno-implicit   -c -o proxy_client.o proxy_client.c
gcc -O2 -Wall -Wno-implicit   -c -o server.o server.c
gcc -O2 -Wall -Wno-implicit   -c -o main.o main.c
make: *** No rule to make target `gcc', needed by `myaps'.  Stop.

I do not find the reason why i get the message -" No rule to make
target `gcc', needed by `myaps'.  Stop." with my Makefile .

Can anyone help me with this problem






[ Post a follow-up to this message ]



    Re: Need Makefile HELP!  
Logan Shaw


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-25-07 06:20 AM

dennis.varghese@wipro.com wrote:
> myaps: $(OBJ)       gcc $(CFLAGS) -o $@ $(OBJ)

This should be on two different lines.

- Logan





[ Post a follow-up to this message ]



    Re: Need Makefile HELP!  
Chris Torek


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-25-07 06:20 AM

In article <1185335243.469457.307130@j4g2000prf.googlegroups.com>
<dennis.varghese@wipro.com> wrote:
>   I have written the below Makefile .

[much snippage]

>.o.c:     $(CC) $(CFLAGS) $(INCLUDES) -c $<

Besides the other reply you got, this line is somewhat dangerous:
it gives "make" a rule to convert a ".o" file into a ".c" file.
You want the opposite -- a method of converting a ".c" file into
a ".o" file.

Luckily for you, that rule is built-in, and reads, in effect:

.c.o:
$(CC) $(CFLAGS) -c $<

(note that this is two separate lines).  You will not get your
$(INCLUDES) expanded, since it is not part of $(CC) nor $(CFLAGS)
(but if you put your -I directives into CFLAGS, you will not need
your own rule anyway).
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W)  +1 801 277 2603
email: forget about it   http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.





[ Post a follow-up to this message ]



    Re: Need Makefile HELP!  
dennis.varghese@wipro.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-25-07 12:20 PM

On Jul 25, 9:48 am, Chris Torek <nos...@torek.net> wrote:
> In article <1185335243.469457.307...@j4g2000prf.googlegroups.com>
>
>  <dennis.vargh...@wipro.com> wrote: 
>
> [much snippage]
> 
>
> Besides the other reply you got, this line is somewhat dangerous:
> it gives "make" a rule to convert a ".o" file into a ".c" file.
> You want the opposite -- a method of converting a ".c" file into
> a ".o" file.
>
> Luckily for you, that rule is built-in, and reads, in effect:
>
>     .c.o:
>         $(CC) $(CFLAGS) -c $<
>
> (note that this is two separate lines).  You will not get your
> $(INCLUDES) expanded, since it is not part of $(CC) nor $(CFLAGS)
> (but if you put your -I directives into CFLAGS, you will not need
> your own rule anyway).
> --
> In-Real-Life: Chris Torek, Wind River Systems
> Salt Lake City, UT, USA (40=B039.22'N, 111=B050.29'W)  +1 801 277 2603
> email: forget about it  http://web.torek.net/torek/index.html
> Reading email is like searching for food in the garbage, thanks to spamme=
rs.

Hi chris ,

Thanks for your reply .

i first did try to put both on saperate lines . e.g.

.c.o: lib/aps.h
$(CC) $(CFLAGS) $(INCLUDES) -c $<

But to this line i get an error -

*** missing separator.  Stop.   How do i solve this error .






[ Post a follow-up to this message ]



    Re: Need Makefile HELP!  
Jens Thoms Toerring


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-26-07 12:21 AM

dennis.varghese@wipro.com wrote:
> .c.o: lib/aps.h
>       $(CC) $(CFLAGS) $(INCLUDES) -c $<

>    But to this line i get an error -

> *** missing separator.  Stop.   How do i solve this error .

You need a tab character

>       $(CC) $(CFLAGS) $(INCLUDES) -c $<
^^^^^^^
here at the very start of the line instead a number of spaces.

Regards, Jens
--
\   Jens Thoms Toerring  ___      jt@toerring.de
\__________________________      http://toerring.de





[ Post a follow-up to this message ]



    Re: Need Makefile HELP!  
Scott Lurndal


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-26-07 12:21 AM

dennis.varghese@wipro.com writes:

>
>Hi chris ,
>
>    Thanks for your reply .
>
>    i first did try to put both on saperate lines . e.g.
>
>.c.o: lib/aps.h
>      $(CC) $(CFLAGS) $(INCLUDES) -c $<
>
>   But to this line i get an error -
>
>*** missing separator.  Stop.   How do i solve this error .

Make sure you use a tab character, not spaces before the $(CC).

scott





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:56 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register