Install arbitrary data files in fixed location with Automake?

做~自己de王妃 提交于 2019-12-01 05:11:49

Do not use full paths in your Makefile.am. Ever. You can tell automake to put the datafile1 in $(datadir) which will expand to $(prefix)/share/MyProduct, or you can define flash_DIR to expand to $(prefix)/MyProduct/flash_memory and put the files there, but the end user must be allowed to set $(prefix) either to /usr or to something else. What you want to do in Makefile.am is:

flashdir = $(prefix)/$(PACKAGE)/flash_memory
flash_DATA = datafile1

(It would probably be more appropriate to use $(prefix)/@PACKAGE@/flash_memory, since PACKAGE probably should not be modifiable at make time, but I don't think this is terribly important.)

Then, when you are a user, run make install with prefix set to /usr. If you try to use an absolute path in the Makefile.am, it will disallow staged installations (ie setting DESTDIR), will restrict user flexibility, and is the wrong thing to do. The main point is that the package maintainer does not get to choose the final location; that is a decision for the user.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!