For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > May 2006 > i think i'm a little confused about MAKE









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 i think i'm a little confused about MAKE
ifmusic@gmail.com

2006-05-16, 10:01 pm

this is my MakeFile:
---------------------------------
CC = gcc

SinDirs: CDE Ciudad Equipo Router

Router:
$(CC) ROUTER.c -o router

CDE:
$(CC) CDE2.c -o cde

Ciudad:
$(CC) ciudad.c -o ciudad

Equipo:
$(CC) eqselect2.c -o equipo

Directorios:
mkdir eq1 | mkdir eq2 | mkdir eq3 | mkdir eq4
cp equipo ./eq1/ | cp equipo ./eq2/ | cp equipo ./eq3/ | cp equipo
../eq4/
cp eq1.cfg ./eq1/ | cp eq2.cfg ./eq2/ | cp eq3.cfg ./eq3/ | cp
eq4.cfg ./eq4/
mv ./eq1/eq1.cfg ./eq1/equipo.cfg | mv ./eq2/eq2.cfg
../eq2/equipo.cfg
mv ./eq3/eq3.cfg ./eq3/equipo.cfg | mv ./eq4/eq4.cfg
../eq4/equipo.cfg

I wanted to create a makefile so that:
-Compiled 4 different Source codes (which are diferrent apps, but
they're work "together" but share NO code, there is no code dependency
between them, they're 4 codes i want to compile at the same time)
-The target "directorios" would create, or at least, try to create
dirs, copy files and rename them.

This Makefile "works" but there must be some conceptual mistake because
if i have only the .Cs and the .CFGs everthing works fine.
But I KNOW that one of the great things about make is that knows when a
file has to be compiled and when it doesn't have to. I realized that
when i MODIFY "router.c" for example and run "make" it says that
"there's nothing to be done"

i dont know what's wrong .
hope you understood what i want to do so that you could help me.

thanks a lot.

Fletcher Glenn

2006-05-16, 10:01 pm

make is case-sensitive. Your targets must match the rule:

ROUTER:
<tab>$(CC) ROUTER.c -o ROUTER

--

Fletcher Glenn

<ifmusic@gmail.com> wrote in message
news:1147834957.453224.211380@g10g2000cwb.googlegroups.com...
> this is my MakeFile:
> ---------------------------------
> CC = gcc
>
> SinDirs: CDE Ciudad Equipo Router
>
> Router:
> $(CC) ROUTER.c -o router
>
> CDE:
> $(CC) CDE2.c -o cde
>
> Ciudad:
> $(CC) ciudad.c -o ciudad
>
> Equipo:
> $(CC) eqselect2.c -o equipo
>
> Directorios:
> mkdir eq1 | mkdir eq2 | mkdir eq3 | mkdir eq4
> cp equipo ./eq1/ | cp equipo ./eq2/ | cp equipo ./eq3/ | cp equipo
> ./eq4/
> cp eq1.cfg ./eq1/ | cp eq2.cfg ./eq2/ | cp eq3.cfg ./eq3/ | cp
> eq4.cfg ./eq4/
> mv ./eq1/eq1.cfg ./eq1/equipo.cfg | mv ./eq2/eq2.cfg
> ./eq2/equipo.cfg
> mv ./eq3/eq3.cfg ./eq3/equipo.cfg | mv ./eq4/eq4.cfg
> ./eq4/equipo.cfg
>
> I wanted to create a makefile so that:
> -Compiled 4 different Source codes (which are diferrent apps, but
> they're work "together" but share NO code, there is no code dependency
> between them, they're 4 codes i want to compile at the same time)
> -The target "directorios" would create, or at least, try to create
> dirs, copy files and rename them.
>
> This Makefile "works" but there must be some conceptual mistake because
> if i have only the .Cs and the .CFGs everthing works fine.
> But I KNOW that one of the great things about make is that knows when a
> file has to be compiled and when it doesn't have to. I realized that
> when i MODIFY "router.c" for example and run "make" it says that
> "there's nothing to be done"
>
> i dont know what's wrong .
> hope you understood what i want to do so that you could help me.
>
> thanks a lot.
>



ifmusic@gmail.com

2006-05-17, 8:03 am


Fletcher Glenn ha escrito:

> make is case-sensitive. Your targets must match the rule:
>
> ROUTER:
> <tab>$(CC) ROUTER.c -o ROUTER
>


ok, but that does not solve the problem. Make's still saying "nothing
to be done" even after i made changes to the code!

Hope you understand, again :
i have 4 codes (ROUTER.C eqselect2.c ...etc) and i just want to compile
All of them using make so i thought a proper way to do it was:

TheWholeProyect: app1 app2 app3 app4

where app[i] is a target that compiles every code.

Pascal Bourguignon

2006-05-17, 10:02 pm

ifmusic@gmail.com writes:

> Fletcher Glenn ha escrito:
>
>
> ok, but that does not solve the problem. Make's still saying "nothing
> to be done" even after i made changes to the code!


But that's not what you said!

You're telling to make that if there is no file named ROUTER
then it should create it executing $(CC) ROUTER.c -o ROUTER
If there's already a file named ROUTER, then there's nothing more to do!


Now, if you want to build a new version of ROUTER when ROUTER.c
changes, you should say so:

ROUTER: ROUTER.c
$(CC) ROUTER.c -o ROUTER



--
__Pascal Bourguignon__ http://www.informatimago.com/

"Indentation! -- I will show you how to indent when I indent your skull!"

ifmusic@gmail.com

2006-05-17, 10:02 pm

Sr. You Are Absolutely 100% Right . Thank you very much, now i get it.
thanks.

bye.

Pascal Bourguignon ha escrito:
[color=darkred]

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com