Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Makefile Help

Reply
Thread Tools

Makefile Help

 
 
pycraze
Guest
Posts: n/a
 
      07-24-2007
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

 
Reply With Quote
 
 
 
 
Ben Pfaff
Guest
Posts: n/a
 
      07-24-2007
pycraze <(E-Mail Removed)> writes:

> I have written the below Makefile .


Questions about makefiles are better asked elsewhere. Perhaps
comp.unix.programmer is an appropriate place.
--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
 
Reply With Quote
 
 
 
 
jacob navia
Guest
Posts: n/a
 
      07-24-2007
pycraze wrote:
[snip]
>
> myaps: $(OBJ) gcc $(CFLAGS) -o $@ $(OBJ)


I think you need a new line before "gcc"...

But I could be wrong.
 
Reply With Quote
 
pycraze
Guest
Posts: n/a
 
      07-25-2007
On Jul 24, 8:48 pm, jacob navia <(E-Mail Removed)> wrote:
> pycraze wrote:
>
> [snip]
>
>
>
> > myaps: $(OBJ) gcc $(CFLAGS) -o $@ $(OBJ)

>
> I think you need a new line before "gcc"...
>
> But I could be wrong.


Thank you Jacob . I will surely consider your suggestion .

 
Reply With Quote
 
pycraze
Guest
Posts: n/a
 
      07-25-2007
On Jul 24, 8:36 pm, Ben Pfaff <(E-Mail Removed)> wrote:
> pycraze <(E-Mail Removed)> writes:
> > I have written the below Makefile .

>
> Questions about makefiles are better asked elsewhere. Perhaps
> comp.unix.programmer is an appropriate place.
> --
> int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
> \n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
> );while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
> );}return 0;}


Thank you Ben . I will surely consider your suggestion .

 
Reply With Quote
 
Mark Bluemel
Guest
Posts: n/a
 
      07-25-2007
pycraze wrote:
> Hi ,
>
> I have written the below Makefile .


And what does this have to do with the C programming language?

[snip]

A bit of non-topical advice follows :-

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


Read the manual pages for make files. The line above is a dependency
line. It says that to make "myaps" you need, among other things, an
object locally called "gcc". It doesn't know how to make "gcc".

As Jacob has already told you (and you said you'd consider his
contribution - what the hell does that mean?) the command to build
"myaps" must be on a newline (and preceded by at least one TAB
character, if I recall correctly).

Next time:
a) read the <insert expletive here> manual
b) if you're still stuck find an appropriate newsgroup at which to ask -
this one is about C, not about general programming
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
makefile help Jess C++ 0 04-25-2007 05:23 AM
PLZ HELP ME ...CHANGING OF MAKEFILE FROM FREEBSD TO REDHAT 9.0 ...... yogesh Computer Support 0 12-27-2006 06:17 AM
Please help with C++ Makefile and % Operator matthias_k C++ 1 11-07-2004 05:40 PM
Makefile Macro Substitution Help tmponko C++ 3 01-01-2004 12:57 AM
newbie help with makefile TheSomberlain C++ 2 08-05-2003 10:07 PM



Advertisments