Makefile Help

Discussion in 'C Programming' started by pycraze, Jul 24, 2007.

  1. pycraze

    pycraze Guest

    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
    pycraze, Jul 24, 2007
    #1
    1. Advertising

  2. pycraze

    Ben Pfaff Guest

    pycraze <> 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[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.\
    \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\
    );}return 0;}
    Ben Pfaff, Jul 24, 2007
    #2
    1. Advertising

  3. pycraze

    jacob navia Guest

    pycraze wrote:
    [snip]
    >
    > myaps: $(OBJ) gcc $(CFLAGS) -o $@ $(OBJ)


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

    But I could be wrong.
    jacob navia, Jul 24, 2007
    #3
  4. pycraze

    pycraze Guest

    On Jul 24, 8:48 pm, jacob navia <> 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 .
    pycraze, Jul 25, 2007
    #4
  5. pycraze

    pycraze Guest

    On Jul 24, 8:36 pm, Ben Pfaff <> wrote:
    > pycraze <> 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[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.\
    > \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\
    > );}return 0;}


    Thank you Ben . I will surely consider your suggestion .
    pycraze, Jul 25, 2007
    #5
  6. pycraze

    Mark Bluemel Guest

    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
    Mark Bluemel, Jul 25, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TheSomberlain

    newbie help with makefile

    TheSomberlain, Aug 5, 2003, in forum: C++
    Replies:
    2
    Views:
    438
    Kevin Goodsell
    Aug 5, 2003
  2. tmponko
    Replies:
    3
    Views:
    5,202
    tmponko
    Jan 1, 2004
  3. matthias_k
    Replies:
    1
    Views:
    370
    Victor Bazarov
    Nov 7, 2004
  4. Jess

    makefile help

    Jess, Apr 25, 2007, in forum: C++
    Replies:
    0
    Views:
    331
  5. Jess

    makefile help

    Jess, Apr 25, 2007, in forum: C++
    Replies:
    4
    Views:
    355
Loading...

Share This Page