# Overwriting files in Makefile

1 messages from 2005-05-12 to 2005-05-12. Participants: Horst von Brand.
Thread: https://gitlist.dev/t/586

## Horst von Brand, 2005-05-12 15:56

Subject: Overwriting files in Makefile
Message-ID: <200505121556.j4CFuRVS010004@laptop11.inf.utfsm.cl>
URL: https://gitlist.dev/e/200505121556.j4CFuRVS010004%40laptop11.inf.utfsm.cl

```
The current setup disturbs me. The Makefile copies the scripts into the
destination, and then edits them in place. Why not just generate them from
.in files before installing, i.e. by a rule something like

%: %.in
   sed -e 's;@LIBDIR@;$(sedlibdir);g' $^ > $@

with '@LIBDIR@' in the .in file whereever the substitution should take
place. This way you also avoid the possible loss of the permission bits
when fooling around (any SUID/SGID would get lost; not that it matters
here).

In any case, the '\/'s (LTS, "Leaning Toothpick Syndrome") when futzing
around with file paths can be avoided by using something else than '/' as
delimiter for sed(1)'s substitute command, like ';' here.
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

```
