How can I install a directory tree of HTML files, stylesheets and images with automake without having to create Makefiles in each subdirectory?
Using the following in the toplevel directory
htmldir = $(docdir)/foo/html
html_DATA = \
stylesheets/foo.css \
images/foo.jpg \
index.html \
about/index.html \
faq/index.html
EXTRA_DIST = $(html_DATA)
fails because the subdirectories are not created before install is called.
You could write
foohtmldir = $(htmldir)/foo/html
nobase_dist_foohtml_DATA = \
stylesheets/foo.css \
images/foo.jpg \
index.html \
about/index.html \
faq/index.html
htmldir is a variable the user is entitled to modify using configure --htmldir=... so I suggest using another one if you want to write to some subdirectory of it. The nobase_ prefix will tell Automake not to strip leading directories during installation, and the dist_ prefix requires the files to be distributed.
Related
Question Summary
I'm trying to make clean and I'm getting the following output:
Makefile:835: /absolute/path/to/server/server/example/.deps/libfoo-bar.Plo: No such file or directory
Makefile:836: /absolute/path/to/server/server/example/.deps/libfoo-baz.Plo: No such file or directory
Makefile:837: /absolute/path/to/server/server/example/.deps/libfoo-qux.Plo: No such file or directory
Makefile:838: /absolute/path/to/server/server/example/.deps/libfoo-quux.Plo: No such file or directory
Makefile:839: /absolute/path/to/server/server/example/.deps/libfoo-quuz.Plo: No such file or directory
Makefile:840: /absolute/path/to/server/server/example/.deps/libfoo-corge.Plo: No such file or directory
Makefile:841: /absolute/path/to/server/server/example/.deps/libfoo-grault.Plo: No such file or directory
Makefile:842: /absolute/path/to/server/server/example/.deps/libfoo-garply.Plo: No such file or directory
Makefile:843: /absolute/path/to/server/server/example/.deps/libfoo-waldo.Plo: No such file or directory
Makefile:844: /absolute/path/to/server/server/example/.deps/libfoo-fred.Plo: No such file or directory
Makefile:845: /absolute/path/to/server/server/example/.deps/libfoo-plugh.Plo: No such file or directory
Makefile:846: /absolute/path/to/server/server/example/.deps/libfoo-xyzzy.Plo: No such file or directory
Makefile:847: /absolute/path/to/server/server/example/.deps/libfoo-babble.Plo: No such file or directory
Makefile:848: /absolute/path/to/server/server/example/.deps/libfoo-thud.Plo: No such file or directory
Makefile:848: /absolute/path/to/server/server/example/.deps/libfoo-flarp.Plo: No such file or directory
make: *** No rule to make target '/absolute/path/to/server/server/example/.deps/libfoo-flarp.Plo'. Stop.
How can I successfully do a make clean? I don't understand what these .Plo files are, and they are usually something I don't mess with.
Investigation
My Makefile.am
The Makefile.am which is used to generate the Makefile from which I'm trying to run the clean contains this preamble:
include $(top_srcdir)/server/include.am
include $(top_srcdir)/server/tests/include.am
...
The first $(top_srcdir)/server/include.am includes the following:
...
server_libdir = $(exec_prefix)/lib
serverdir = $(top_srcdir)/server
...
and in the specified $(top_srcdir)/server/tests/include.am, I have a lot of things including:
...
server_lib_LTLIBRARIES = libfoo.la
libfoo_la_SOURCES = \
/absolute/path/to/server/server/example/bar.c \
/absolute/path/to/server/server/example/baz.c \
/absolute/path/to/server/server/example/qux.c \
/absolute/path/to/server/server/example/quux.c \
/absolute/path/to/server/server/example/quuz.c \
/absolute/path/to/server/server/example/corge.c \
/absolute/path/to/server/server/example/grault.c \
/absolute/path/to/server/server/example/garply.c \
/absolute/path/to/server/server/example/waldo.c \
/absolute/path/to/server/server/example/fred.c \
/absolute/path/to/server/server/example/plugh.c \
/absolute/path/to/server/server/example/xyzzy.c \
...
Investigating the Makefile Contents
If I look at the Makefile directly and find the lines generating these errors, I see the following:
include /absolute/path/to/server/server/example/$(DEPDIR)/libfoo-bar.Plo
include /absolute/path/to/server/server/example/$(DEPDIR)/libfoo-baz.Plo
include /absolute/path/to/server/server/example/$(DEPDIR)/libfoo-qux.Plo
...
Where are the .Plo files generated?
Frustratingly, there seems to be the exact .Plo files that I need generated all over the place, just not in the right place; for example these files exist:
/absolute/path/to/server/tests/absolute/path/to/server/server/example/$(DEPDIR)/libfoo-bar.Plo
/absolute/path/to/server/tests/absolute/path/to/server/server/example/$(DEPDIR)/libfoo-baz.Plo
/absolute/path/to/server/tests/absolute/path/to/server/server/example/$(DEPDIR)/libfoo-qux.Plo
...
and there are 7 other directories where these .Plo files are created.
Unsuccessful Attempts
Running config.status directly
I found this message on the GNU mailing list:
Actually, these .P files are created by config.status for each
directory it creates an Automake Makefile in. (BTW, make sure
./config.status --help' lists the relevant Makfiles in the Configuration files' section).
You can request the creation of the .P files for a given directory
by running
% rm -Rf kernel/framework/.deps
% ./config.status kernel/framework/Makefile depfiles
And ran ./config.status as described but the output of make clean hasn't changed
According to this other Stack Overflow question, they were able to generate .Plo files, but I don't know what is different for them.
re-run configure with the --disable-dependency-tracking option
I have makefile.am used with automake for crossplatrom project , where I also need to build resource file, so I add it like this:
program_la_SOURCES = \
manifest.rc \
context.cpp \
forks.cpp \
....
But this is ignored by the compiler.
I then tried to add something like:
%.rc : %.o
but this did not help either. I see other source files builded as .o, but nothing for resource file.
I have created a Yocto recipe for my program.
What are the default folders that are building image from recipe ?
At the time of building image, I want to move my files to another folder like "/opt/xyz".
Should I simply do "mv" or is there any other options?
I guess you want to copy your compiled program to a folder such as ${bindir}:
Quote from Yocto ref-manual 1.1:
When specifying paths as part of the CONFFILES variable, it is good practice to use appropriate path variables. For example, ${sysconfdir} rather than /etc or ${bindir} rather than /usr/bin. You can find a list of these variables at the top of the meta/conf/bitbake.conf file in the Source Directory.
You can copy files from your working directory to any directory in the target filesystem. See the hello-world example for instance (note that the example is taken from the 1.1 reference manual, but I haven't found it yet in the newer version):
DESCRIPTION = "Simple helloworld application"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
PR = "r0"
SRC_URI = "file://helloworld.c"
S = "${WORKDIR}"
do_compile() {
${CC} helloworld.c -o helloworld
}
do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
}
FILES_${PN} = "${bindir}"
In this example, the helloworld binary would be copied to /usr/bin on your image (could be /opt too, see Source Directory for the variable definition).
Adjust FILES_${PN} var for ${sysconfdir} ${bindir} ${datadir} ${libdir} directories.
do_install(){
install -d ${D}{base_prefix}/opt/xyz/
install -m ${WORKDIR}/yourbinary ${D}${base_prefix}/opt/xyz/
}
FILES_${PN} = "${base_prefix}/opt/*"
above
1st line creates the dir in imagedir in that opt/xvz/
2nd line copy your binary to opt/xyz/dir
3rd line use to copy of your opt/xyz/binary to yocto rootfs.
I am building pbs_mom for Torque. The latest autotools complain about subdir-ojbects option being disabled. I have enabled subdir-obects using AM_INIT_AUTOMAKE which allows me to get everything set up and configured. But when I do a make a conflict occurs because pbs_mom uses sources files for pbs_server but compiles them differently.
The pbs_mom_SOURCES line looks like the following
pbs_mom_SOURCES = catch_child.c mom_comm.c mom_inter.c mom_main.c \
mom_server.c prolog.c requests.c start_exec.c \
start_exec.h checkpoint.c tmsock_recov.c \
mom_req_quejob.c mom_job_func.c \
mom_process_request.c alps_reservations.c \
release_reservation.c generate_alps_status.c \
../server/attr_recov.c ../server/dis_read.c \
../server/job_attr_def.c ../server/job_recov.c \
../server/reply_send.c ../server/resc_def_all.c \
../server/job_qs_upgrade.c
Before enabling subdir-ojbects the .o files from the ../server source files would be put in the current directory (src/resmom). But with subdir-objects enabled it keeps them in the same directory as the source which is src/server.
How can I direct the Makefile.am to move the .o files to the src/resmom directory?
I have an application with several subdirectories, which I want to compile non-recursive. For this I have seperated all sorucefiles from the subdirectories into several variables, which I then use in the final collection of sources. Something like this:
GUI_SOURCEFILES = Gui/MainWindow.cc \
Gui/StatusBar.cc
...
foo_SOURCES = $(GUI_SOURCEFILES) \
$(DATABASE_SOURCEFILES) \
main.cc
Now however this forces me to write Gui/ for all gui sourcefiles and Db\ in front of all database files. I think it should be possible to create this prefix automaticall, but I cannot find a way to do this correctly. I tried the usual make way:
GUI_SOURCEFILES = MainWindow.cc \
StatusBar.cc
...
foo_SOURCES = $(GUI_SOURCEFILES) \
$(patsubst %,Gui/%,$(DATABASE_SOURCEFILES)) \
main.cc
But autotools will not compile this Makefile.am at all.
Is there a way to get autotools to do this for me?
There is no way here, all filenames must be available at automake time, and that precludes certain make-time like functions (non-portable at that).