如果语句没有被正确评估(automake,makefile.am)

时间:2012-12-20 20:48:43

标签: makefile automake

现在我终于让xmonad与MATE DE很好地玩了,我虽然尝试将GNOME2/3/XFCE4 panel applet移植到交配,因为MATE基本上是GNOME2。

到目前为止,我已经为MATE添加了必要的依赖项,ifdef等,并且运行autogen.sh --with-panel=mate吐出Makefile并显示任何错误。但是,运行make会出现此错误:Makefile:770: *** missing separator. Stop.这是我的Makefile:http://pastebin.com/bLF9TD4M

以下是导致错误的部分:

#    $(applet_files): $(applet_files:.desktop=.desktop.in)
#           $(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR)|" $< > $@
    if PANEL_MATE
        applet_files = org.mate.panel.XmonadLogApplet.panel-applet
        $(applet_files): $(applet_files:.panel-applet=.panel-applet.in)
                $(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR)|" $< > $@
    else
        applet_files = org.gnome.panel.XmonadLogApplet.panel-applet
        $(applet_files): $(applet_files:.panel-applet=.panel-applet.in)
                $(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR)|" $< > $@
    endif

    if !PANEL_MATE
        servicedir = $(SESSION_BUS_SERVICES_DIR)
        service_in_files = org.gnome.panel.applet.XmonadLogAppletFactory.service.in
        service_DATA = $(service_in_files:.service.in=.service)
        org.gnome.panel.applet.XmonadLogAppletFactory.service: $(service_in_files)
                $(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR)|" $< > $@
    else
        servicedir = $(SESSION_BUS_SERVICES_DIR)
        service_in_files = org.mate.panel.applet.XmonadLogAppletFactory.service.in
        service_DATA = $(service_in_files:.service.in=.service)
                org.mate.panel.applet.XmonadLogAppletFactory.service: $(service_in_files)
                $(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR)|" $< > $@
    endif

这些IF语句是Makefile.am文件遗留下来的,它们不应该在这里。如果我手动删除if语句(保留其中的相关内容)并运行make,我得到这个:

make  all-am
make[1]: Entering directory `/home/ari/development/xmonad-log-applet'
gcc -DHAVE_CONFIG_H -I.  -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include   -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include      -g -O2 -MT xmonad_log_applet-main.o -MD -MP -MF .deps/xmonad_log_applet-main.Tpo -c -o xmonad_log_applet-main.o `test -f 'main.c' || echo './'`main.c
main.c:15:21: fatal error: gtk/gtk.h: No such file or directory
compilation terminated.
make[1]: *** [xmonad_log_applet-main.o] Error 1
make[1]: Leaving directory `/home/ari/development/xmonad-log-applet'
make: *** [all] Error 2

这是我第一次真正使用makefile和automake,所以任何帮助都会受到赞赏。以下是我对github的修改:https://github.com/geniass/xmonad-log-applet

1 个答案:

答案 0 :(得分:0)

您无法在Automake中的if块内缩进代码。 (Makefiles对缩进很敏感。)