blippy
blippy

Reputation: 1540

make distcheck permission denied

In my src directory I have the interface file neoleo.i which is used by swig to create neoleo_wrap.c via the rule:

neoleo_wrap.c : $(srcdir)/neoleo.i neoleo_swig.c neoleo_swig.h
        swig -tcl8 $(srcdir)/neoleo.i

When I type make dist ; make distcheck it outputs:

swig -tcl8 ../../../src/neoleo.i
Unable to open file ../../../src/neoleo_wrap.c: Permission denied
make[2]: *** [Makefile:1313: neoleo_wrap.c] Error 1

What do I need to do to fix this?

Some relevant parts of my Makefile.am:

EXTRA_DIST = $(srcdir)/neoleo.i
BUILT_SOURCES = getdate.c parse.c parse.h posixtm.c posixtm.h neoleo_wrap.c
nodist_libneoleo_la_SOURCES = neoleo_wrap.c
neoleo_wrap.c : $(srcdir)/neoleo.i neoleo_swig.c neoleo_swig.h
        swig -tcl8 $(srcdir)/neoleo.i

Complete Makefile.am available here:

Makefile.am

Upvotes: 1

Views: 434

Answers (1)

MadScientist
MadScientist

Reputation: 100926

automake distcheck verifies that your build system behaves correctly according to its standards and part of that is that the source directory is not modified in any way. distcheck uses permissions to ensure this. In your case, swig is trying to write its output file to the source directory which is not right (according to automake): that directory must not be modified.

Even if you didn't care about this, your makefile is wrong because it says that your rule will build neoleo_wrap.c, but your swig command line will actually create ../../src/neoleo_wrap.c; make will not forgive this betrayal.

So, you need to change your swig command to something like:

neoleo_wrap.c : $(srcdir)/neoleo.i neoleo_swig.c neoleo_swig.h
        swig -tcl8 -o $@ $<

Upvotes: 5

Related Questions