threads / discuss / 586

Overwriting files in Makefile

Subject: Overwriting files in Makefile

## tl;dr

One message between May 12, 2005 and May 12, 2005.

replies: 0people: 1as markdown or json

Horst von Brand· May 12, 2005, 15:56 UTC · lore

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

← back to recent threads