make and remote dependencies

View: New views
4 Messages — Rating Filter:   Alert me  

make and remote dependencies

by Paul Wise-2 :: Rate this Message:

| View Threaded | Show Only this Message

Hi all,

I'm trying to get remote dependencies[1] to work. Is there any way to
get the example Makefile [2] to always run wget to try and download
remote.c but only rebuild remote.o and remote when remote.c was updated
by wget? With [2], make always runs wget and always runs gcc.

     1. http://lists.gnu.org/archive/html/help-gnu-utils/2009-04/msg00007.html
     2. http://people.debian.org/~pabs/tmp/Makefile

--
bye,
pabs

http://bonedaddy.net/pabs3/


_______________________________________________
Help-make mailing list
Help-make@...
https://lists.gnu.org/mailman/listinfo/help-make

signature.asc (853 bytes) Download Attachment

Re: make and remote dependencies

by Paul Smith-20 :: Rate this Message:

| View Threaded | Show Only this Message

On Mon, 2012-04-16 at 12:33 +0800, Paul Wise wrote:
> I'm trying to get remote dependencies[1] to work. Is there any way to
> get the example Makefile [2] to always run wget to try and download
> remote.c but only rebuild remote.o and remote when remote.c was updated
> by wget? With [2], make always runs wget and always runs gcc.
>
>      1. http://lists.gnu.org/archive/html/help-gnu-utils/2009-04/msg00007.html
>      2. http://people.debian.org/~pabs/tmp/Makefile

Remove the .PHONY; that forces all targets that depend on it to always
rebuild.

Try:

        remote.c: FORCE
        wget -O tmp -N http://people.debian.org/~pabs/tmp/remote.c || { rm remote.c; exit 1; }
        cmp tmp $@ || cp tmp $@
        rm -f tmp
        FORCE:;

--
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@...>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


_______________________________________________
Help-make mailing list
Help-make@...
https://lists.gnu.org/mailman/listinfo/help-make

Re: make and remote dependencies

by Paul Wise-2 :: Rate this Message:

| View Threaded | Show Only this Message

On Mon, 2012-04-16 at 02:09 -0400, Paul Smith wrote:

>         remote.c: FORCE
>         wget -O tmp -N http://people.debian.org/~pabs/tmp/remote.c || { rm remote.c; exit 1; }
>         cmp tmp $@ || cp tmp $@
>         rm -f tmp
>         FORCE:;

Wow, I didn't know about the FORCE thing, thanks.

BTW, wget -O -N explicitly does not work. I've switched to curl due to
this issue.

--
bye,
pabs

http://bonedaddy.net/pabs3/


_______________________________________________
Help-make mailing list
Help-make@...
https://lists.gnu.org/mailman/listinfo/help-make

signature.asc (853 bytes) Download Attachment

Re: make and remote dependencies

by Paul Smith-20 :: Rate this Message:

| View Threaded | Show Only this Message

On Mon, 2012-04-16 at 14:40 +0800, Paul Wise wrote:
> On Mon, 2012-04-16 at 02:09 -0400, Paul Smith wrote:
>
> >         remote.c: FORCE
> >         wget -O tmp -N http://people.debian.org/~pabs/tmp/remote.c || { rm remote.c; exit 1; }
> >         cmp tmp $@ || cp tmp $@
> >         rm -f tmp
> >         FORCE:;
>
> Wow, I didn't know about the FORCE thing, thanks.

FORCE is just a convention.  The GNU make manual section on .PHONY
discusses the difference between a force rule and a .PHONY rule.

> BTW, wget -O -N explicitly does not work. I've switched to curl due to
> this issue.

I don't know exactly what -N does (the man page says it enables
time-stamping but doesn't give a clear idea of what that means), but I
think you don't want it at all and you should just use -O without -N.

--
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@...>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


_______________________________________________
Help-make mailing list
Help-make@...
https://lists.gnu.org/mailman/listinfo/help-make