Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

We don't really understand it, so we'll give it to the programmers.


devel / comp.unix.programmer / make: why are installed files never a target?

SubjectAuthor
* make: why are installed files never a target?Dario Niedermann
`- make: why are installed files never a target?Jorgen Grahn

1
make: why are installed files never a target?

<slrnth9ce2.8f6.dario@darioniedermann.it>

  copy mid

http://rslight.i2p/devel/article-flat.php?id=2906&group=comp.unix.programmer#2906

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: dario@darioniedermann.it (Dario Niedermann)
Newsgroups: comp.unix.programmer
Subject: make: why are installed files never a target?
Date: Sun, 4 Sep 2022 16:10:10 +0200
Organization: Not speaking for any
Lines: 28
Message-ID: <slrnth9ce2.8f6.dario@darioniedermann.it>
Injection-Info: reader01.eternal-september.org; posting-host="e521b73a76be45415fe0f63b30f91ad2";
logging-data="3421200"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18NdDR3w0+0LdeF90dxOZyc"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:1xuN8XmaYMoS0s1wg9eqtVjtNzg=
X-Bogomips: 4788.44
X-Linux-Distro: Devuan Beowulf
X-Text-Editor: nvi-1.81.6 (2007-11-18)
 by: Dario Niedermann - Sun, 4 Sep 2022 14:10 UTC

While writing a makefile for a program of my own, it's occurred to me
that I've always seen makefiles with just "phony" install targets
(even make's original manual from Bell Labs does it that way).
But I think I've never seen the actual destination files used as targets.

So I've tried to do that in my makefile:

-----
$(bindir)/prog: prog
install -D prog $@

$(mandir)/prog.1.gz: prog.1.gz
install -D prog.1.gz $@

install: $(bindir)/prog $(mandir)/prog.1.gz
-----

Aside from looking like a more truthful representation of what really
happens, this has the advantage that make will say 'nothing to be done
for install' if you try to install files that are older or equal to what
you have already installed.
But are there any disadvantages I'm not considering?

--
Dario Niedermann -:- finger my email address for PGP key, etc.

Also on the Internet at: <gopher://darioniedermann.it/>
<https://www.darioniedermann.it/>

Re: make: why are installed files never a target?

<slrnthq34l.2aga.grahn+nntp@frailea.sa.invalid>

  copy mid

http://rslight.i2p/devel/article-flat.php?id=2907&group=comp.unix.programmer#2907

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: grahn+nntp@snipabacken.se (Jorgen Grahn)
Newsgroups: comp.unix.programmer
Subject: Re: make: why are installed files never a target?
Date: 10 Sep 2022 22:15:49 GMT
Lines: 49
Message-ID: <slrnthq34l.2aga.grahn+nntp@frailea.sa.invalid>
References: <slrnth9ce2.8f6.dario@darioniedermann.it>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net +X5eds/LeDjkOO7wyXZRdQFCfjbDbszDRwo2+/BJhmzG2k+Zop
Cancel-Lock: sha1:KZmsh7fJLo5s/VlEOIlo5sSUVx8=
User-Agent: slrn/1.0.3 (OpenBSD)
 by: Jorgen Grahn - Sat, 10 Sep 2022 22:15 UTC

On Sun, 2022-09-04, Dario Niedermann wrote:
> While writing a makefile for a program of my own, it's occurred to me
> that I've always seen makefiles with just "phony" install targets
> (even make's original manual from Bell Labs does it that way).
> But I think I've never seen the actual destination files used as targets.
>
> So I've tried to do that in my makefile:
>
> -----
> $(bindir)/prog: prog
> install -D prog $@
>
> $(mandir)/prog.1.gz: prog.1.gz
> install -D prog.1.gz $@
>
> install: $(bindir)/prog $(mandir)/prog.1.gz
> -----
>
> Aside from looking like a more truthful representation of what really
> happens, this has the advantage that make will say 'nothing to be done
> for install' if you try to install files that are older or equal to what
> you have already installed.
> But are there any disadvantages I'm not considering?

This may not be a direct answer, but:

The way I see it, "make install" is a harmless and convenient abuse of
make(1). I want it to install unconditionally, because

- The destination is outside the "project" and can be affected by
things outside it. You may have ~/prog-1.2/ and ~/prog-1.3/ and you
may be building in and installing from both directories.

- Ownership and permissions matter for the destination files.
Make doesn't care about such things.

- When I want to install something, I think it through first. If I
want it installed, I don't care what's there already. (And if I
really want control, I probably want to generate a package (RPM,
.deb) and install that one.)

So I accept that the "install", "clean", "check" targets (and maybe a
few more) are odd.

/Jörgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .


devel / comp.unix.programmer / make: why are installed files never a target?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor