Simple Makefile question
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 > Simple Makefile question




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

    Simple Makefile question  
bucket79


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


 
02-19-04 11:33 PM

Hi. I just got a simple question about makefile
There's file 1_1.c and INC, LIB declaration is fine.
and i wanna make executable 1_1.out
so this makefile will work fine

OBJ = 1_1.out

.SUFFIXES: .c .o

all:$(OBJ)

.c.o:
$(CC) -c $(INC) $<
.o.out:
$(CC) -o $@ $? $(LIB)
rm $<

but what if i wanna make excutable 1_1 ?
i mean, how can i set a implicit rule like .c.o when output file has no
extension
i already tested

.o:
.o.:

but it doesn't work either, surely 





[ Post a follow-up to this message ]



    Re: Simple Makefile question  
Wolfgang Kaufmann


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


 
02-20-04 04:33 AM

* Thus spoke bucket79 <bucket79@daum.net>:

Hallo,

> Hi. I just got a simple question about makefile
> There's file 1_1.c and INC, LIB declaration is fine.
> and i wanna make executable 1_1.out
[...]
> but what if i wanna make excutable 1_1 ?
> i mean, how can i set a implicit rule like .c.o when output file has no
> extension

Do you mean something like:

| CC = g++
| LD = g++
| CC_FLAGS = -Wall -W -ggdb -pg -c -g -DNDEBUG
| LD_FLAGS = -ggdb -o $(EXEC)
| ##EXEC = 1_1.out
| EXEC = 1_1
|
| SOURCES = foo.cpp bar.cpp
|
| ALL_OBJS = foo.o bar.o
|
| all : $(ALL_OBJS)
| 	$(LD) $(LD_FLAGS) $(ALL_OBJS)
|
| %.o : %.c
| 	$(CC) $(CC_FLAGS) $(LD) -o $@ $<



Wolfgang.
--
"I can remember the exact instant when I realized that a large part of my li
fe
from then on was going to be spent in finding mistakes in my own programs."
-- Maurice Wilkes, 1947





[ Post a follow-up to this message ]



    Re: Simple Makefile question  
bucket79


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


 
02-22-04 06:33 PM

Wolfgang Kaufmann <wk-usenet-200402@theparallax.com> wrote in message news:<slrnc3c14o.2
qm.wk-usenet-200402@news.theparallax.net>...
> * Thus spoke bucket79 <bucket79@daum.net>:
>
> Hallo,
> 
>  [...] 
>
> Do you mean something like:
>
>  | CC = g++
>  | LD = g++
>  | CC_FLAGS = -Wall -W -ggdb -pg -c -g -DNDEBUG
>  | LD_FLAGS = -ggdb -o $(EXEC)
>  | ##EXEC = 1_1.out
>  | EXEC = 1_1
>  |
>  | SOURCES = foo.cpp bar.cpp
>  |
>  | ALL_OBJS = foo.o bar.o
>  |
>  | all : $(ALL_OBJS)
>  | 	$(LD) $(LD_FLAGS) $(ALL_OBJS)
>  |
>  | %.o : %.c
>  | 	$(CC) $(CC_FLAGS) $(LD) -o $@ $<
>
>
>
>         Wolfgang.


thanks for reply
but i wanna know the case not using variables like LD_FLAGS but
implicty rule like .c.o

ps. sorry, i posted my original message in wrong thread
i pushed 'reply' button rather than 'post new message'  ;(





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 04:52 PM.      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