gnome-hello.sgml topic.dat
下面是doc/C/Makefile.am:
gnome_hello_helpdir=$(datadir)/gnome/help/gnome-hello/C gnome_hello_help_DATA=\\ gnome-hello.html\\ topic.dat SGML_FILES=\\ gnome-hello.sgml
#filesthataren?tinabinary/data/librarytargethavetobelistedhere #tobeincludedinthetarballwhenyou?makedist? EXTRA_DIST=\\ topic.dat\\ $(SGML_FILES)
##The-beforethecommandmeanstoignoreitifitfails.Thatway ##peoplecanstillbuildthesoftwarewithoutthedocbooktools all:
gnome-hello.html:gnome-hello/gnome-hello.html -cpgnome-hello/gnome-hello.html.
gnome-hello/gnome-hello.html:$(SGML_FILES) -db2htmlgnome-hello.sgml
##whenwemakedist,weincludethegeneratedHTMLsopeopledon?t ##havetohavethedocbooktools dist-hook:
mkdir$(distdir)/gnome-hello
-cpgnome-hello/*.htmlgnome-hello/*.css$(distdir)/gnome-hello -cpgnome-hello.html$(distdir) install-data-local:gnome-hello.html
$(mkinstalldirs)$(gnome_hello_helpdir)/images
-forfilein$(srcdir)/gnome-hello/*.html$(srcdir)/gnome-hello/*.css;do\\ basefile=`basename$$file`;\\
$(INSTALL_DATA)$(srcdir)/$$file$(gnome_hello_helpdir)/$$basefile;\\ done
gnome-hello.ps:gnome-hello.sgml -db2ps$<
gnome-hello.rtf:gnome-hello.sgml -db2rtf$<
需要特别注意的是生成的HTML文件的安装目录:$(datadir)/gnome/help/gnome-hello/C。Gnome库在这里查找帮助文件。每个应用程序的帮助都放在$(datadir)/gnome/help下的它自己的目录下。每个地区的文档都安装在应用程序目录的对应于地区的子目录下。
2..desktop入口
Gnome程序带有一个.desktop入口,它是一个以desktop为后缀的文本文件,描述应用程序应该放在Gnome主菜单的什么位置。安装一个.desktop入口文件可以让应用程序显示在Gnome面板菜单(主菜单)中。下面是gnome-hello.desktop文件:
[DesktopEntry] Name=GnomeHello Name[es]=GnomeHola Name[fi]=GNOME-hei Name[no]=Gnomehallo Name[sv]=GnomeHej Comment=HelloWorld Comment[es]=HolaMundo Comment[fi]=Hei,maailma Comment[sv]=HejV?rlden Comment[no]=Halloverden
Exec=gnome-hello Icon=gnome-hello-logo.png Terminal=0 Type=Application
这个文件由键-值对组成。Name键指定在缺省地区场合的名称;任何键都可以有一个用于标明地区的字符串,放在一对方括号里面。当登录到X窗口时,如果指定了不同的地区,系统会根据语言从这里读取相应的字符串。Comment键是一个“工具提示”或“暗示”,用以更详细地描述应用程序。Exec 是用来执行程序的命令行。Terminal是布尔类型,如果为非0值,程序在一个终端内运行。在这里Type应该是“Application” 安装一个.desktop条目很简单。下面是GnomeHello中的最顶层的Makefile.am文件:
SUBDIRS=macrospointlsrcpixmapsdoc EXTRA_DIST=\\ gnome-hello.desktop
Applicationsdir=$(datadir)/gnome/apps/Applications Applications_DATA=gnome-hello.desktop
注意,在$(datadir)/gnome/apps/下有一个目录树,可以将应用程序安装到下面子目录所对应的类别中。GnomeHello 将自己安装在“Applications”类中,而其他的应用程序也许会选择Games、Graphics、Internet或者其他合适的地方。尽量选择一个已经存在的类别,而不是自己建一个。
Makefile.am中的EXTRA_DIST变量列出了需要包含在发布软件包(压缩的tar文件)中的文件。最重要的文件会自动包含进来,例如,所有作为二进制或库的源文件的文件都会自动包含。
然而,automake并不认识.desktop文件,或SGML文档,所有这些文件必须列在EXTRA_DIST中。如果将这些文件留在EXTRA_DIST之外,用makedistcheck命令编译发布程序通常会失败。