|
Home > Archive > Unix Programming > July 2007 > Need Makefile HELP!
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Need Makefile HELP!
|
|
| dennis.varghese@wipro.com 2007-07-25, 1: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
| |
| Logan Shaw 2007-07-25, 1:20 am |
| dennis.varghese@wipro.com wrote:
> myaps: $(OBJ) gcc $(CFLAGS) -o $@ $(OBJ)
This should be on two different lines.
- Logan
| |
| Chris Torek 2007-07-25, 1: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.
| |
| dennis.varghese@wipro.com 2007-07-25, 7:20 am |
| 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 .
| |
| Jens Thoms Toerring 2007-07-25, 7:21 pm |
| 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
| |
| Scott Lurndal 2007-07-25, 7:21 pm |
| 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
|
|
|
|
|