Install data directory tree with massive number of files using automake

前端 未结 3 1177
一向
一向 2021-02-07 10:17

I have a data directory which I would like automake to generate install and uninstall targets for. Essentially, I just want to copy this directory verbatim to the DATA director

3条回答
  •  名媛妹妹
    2021-02-07 10:56

    I would use a script to generate a Makefile fragment that lists all the files:

    echo 'subdir_files =' > subfiles.mk
    find subdir -type f -print | sed 's/^/  /;$q;s/$/ \\/' >> subfiles.mk
    

    and then include this subfiles.mk from your main Makefile.am:

    include $(srcdir)/subfiles.mk
    nobase_dist_pkgdata_DATA = $(subdir_files)
    

    A second option is to EXTRA_DIST = subdir, and then to write custom install-data-local and uninstall-local rules.

    The problem here is that EXTRA_DIST = subdir will distributes all files in subdir/, including backup files, configuration files (e.g. from your VCS), and other things you would not want to distribute.

    Using a script as above let you filter the files you really want to distribute.

提交回复
热议问题