I'm trying to debug some very basic and unfinished Debian packaging for Open Dylan.

I'm getting errors in the Debian build log (gist).

The relevant bit is at the end, namely:

Preparing to install Open Dylan...
Copying sources...
cp: cannot create directory ‘/usr/local/sources’: Permission denied
Makefile:328: recipe for target 'install-stage' failed

This clearly corresponds to the lines starting at 342 in Makefile.in, namely:

# Install stage installs stage 3 into prefix
    @echo Preparing to install Open Dylan in $(prefix)...
    @install -d $(prefix)
    @echo Copying sources to $(prefix)/sources...
    @rm -rf $(prefix)/sources
    @cp -R $(abs_srcdir)/sources $(prefix)

Probably the last line is the culprit, but I'm having difficulty seeing what is going wrong.

It would help greatly if I could get the build to consistently echo every line before executing it, but as you can see in the extract quoted above, it didn't happen when I needed it to. Namely at that cp line.

NOTE: Open Dylan isn't using Automake, though they are using Autoconf. And so they have a handwritten Makefile.in.

UPDATE: Adding make -n to the dh_auto_build and dh_auto_install overrides works. Thusly:

        PATH=$(binpath):$$PATH make -n

        PATH=$(binpath):$$PATH make -n install

The new build log(gist) now has the following for the upstream Open Dylan Makefile install target:

echo Preparing to install Open Dylan...
install -d /usr/local
echo Copying sources...
rm -rf /usr/local/sources
cp -R /usr/local/src/opendylan/opendylan-2014.1/sources /usr/local
find /usr/local/sources -depth -name '.*' -exec rm -rf {} \;
rm -rf /usr/local/sources/bootstrap1-registry
echo Installing Open Dylan in /usr/local
install -d /usr/local/bin /usr/local/databases /usr/local/lib /usr/local/lib/runtime
install -d /usr/local/share/opendylan /usr/local/include/opendylan
cp -R /usr/local/src/opendylan/opendylan-2014.1/Bootstrap.3/bin /usr/local
cp -R /usr/local/src/opendylan/opendylan-2014.1/Bootstrap.3/databases /usr/local
cp -R /usr/local/src/opendylan/opendylan-2014.1/Bootstrap.3/include/opendylan /usr/local/include
# We use force here because on Mac OS X, the lib directory likely contains read-only
# static libraries for the Boehm GC.
cp -Rf /usr/local/src/opendylan/opendylan-2014.1/Bootstrap.3/lib /usr/local
cp -Rf /usr/local/src/opendylan/opendylan-2014.1/Bootstrap.3/share/opendylan /usr/local/share
cp -R /usr/local/src/opendylan/opendylan-2014.1/tools/lldb /usr/local/share/opendylan
cp -R /usr/local/src/opendylan/opendylan-2014.1/tools/bash_completion /usr/local/share/opendylan
cp /usr/local/src/opendylan/opendylan-2014.1/License.txt /usr/local
cp /usr/local/src/opendylan/opendylan-2014.1/packages/unix/README /usr/local
echo Done!

This is clearly all wrong from the beginning. For some reason, prefix here is /usr/local, while it should be /debian/tmp/usr (I think).

The first line of the Open Dylan Makefile.in has:

prefix          = $(DESTDIR)@prefix@

which looks kind of non-standard. In the generated Makefile, this becomes:

prefix          = $(DESTDIR)/usr/local

Normally Debian passes /usr to ./configure by default, so I'm not sure what happened here, or why (apparently), DESTDIR is blank.


The @ before some of the lines tells make "do not echo this line".

You could edit and remove some of the @s or strip them all from the Makefile with:

sed -i -e 's/^\(\t\+)@/\1/ ; s/\(^\t\+\)echo/\1@echo/' Makefile

The make doc extract by @Ortomala Lokni made a good point about echo, so i've modified the sed script to put an @ back before any echo commands.

To deal with Automake, you probably want to be a bit more careful with removing the @ characters, Automake uses @NAME@ to substitute variables into the ouput Makefile:

Maybe something like this, so that it doesn't change lines that begin with \t+@NAME@:

sed -ire 's/^(\t+)@([^ @]+ )/(\t)\1/ ; s/(^\t+)echo/\1@echo/' Makefile.in
| improve this answer | |

To complete the cas answer you can read the GNU make manual which says:

Normally make prints each line of the recipe before it is executed. We call this echoing because it gives the appearance that you are typing the lines yourself.

When a line starts with ‘@’, the echoing of that line is suppressed. The ‘@’ is discarded before the line is passed to the shell. Typically you would use this for a command whose only effect is to print something, such as an echo command to indicate progress through the makefile:

@echo About to make distribution files

When make is given the flag ‘-n’ or ‘--just-print’ it only echoes most recipes, without executing them. See Summary of Options. In this case even the recipe lines starting with ‘@’ are printed. This flag is useful for finding out which recipes make thinks are necessary without actually doing them.

The ‘-s’ or ‘--silent’ flag to make prevents all echoing, as if all recipes started with ‘@’. A rule in the makefile for the special target .SILENT without prerequisites has the same effect (see Special Built-in Target Names). .SILENT is essentially obsolete since ‘@’ is more flexible.

| improve this answer | |
  • Thank you for the answer. How would one pass the -n option via the Debian build system? – Faheem Mitha Nov 1 '15 at 23:27
  • 1
    Actually, it looks like amending my override from PATH=$(binpath):$$PATH make to PATH=$(binpath):$$PATH make -n works. – Faheem Mitha Nov 1 '15 at 23:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.