我正在尝试为我的一个Vala项目设置一个自动工具构建系统,这是到目前为止我所想到的。
配置.ac
AC_INIT(White House, 1.0)
AC_CONFIG_SRCDIR(src/Window.vala)
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_PROG_CC_STDC
AM_PROG_VALAC([0.7.0])
AC_PROG_INSTALL
WHITE_HOUSE_PACKAGES="--pkg gio-2.0 --pkg gtk+-3.0 --pkg gee-0.8 --target-glib 2.32 --pkg json-glib-1.0"
PKG_CHECK_MODULES(WHITE_HOUSE, [gio-2.0 gtk+-3.0 gee-0.8 json-glib-1.0])
AC_SUBST(WHITE_HOUSE_CFLAGS)
AC_SUBST(WHITE_HOUSE_LIBS)
AC_SUBST(WHITE_HOUSE_PACKAGES)
AC_CONFIG_FILES([
Makefile
resources/white-house.desktop
resources/Makefile
src/Makefile
])
AC_OUTPUT
制作文件.am
SUBDIRS = resources src
EXTRA_DIST = autogen.sh
src/Makefile.am
AM_CPPFLAGS = $(WHITE_HOUSE_CFLAGS)
bin_PROGRAMS = white-house
white_house_SOURCES = AutomapDialog.vala Drawable.vala Map.vala Preferences.vala Room.vala TextView.vala AutoMapper.vala Handle.vala Passage.vala RoomDialog.vala Tab.vala Window.vala
white_house_VALAFLAGS = $(WHITE_HOUSE_PACKAGES)
white_house_CFLAGS = $(WHITE_HOUSE_CFLAGS)
white_house_LDFLAGS = $(WHITE_HOUSE_LIBS)
资源/Makefile.am
desktopdir = $(datadir)/applications
desktop_DATA = white-house.desktop
icondir = $(datadir)/icons
icon_DATA = white-house.svg
当我跑步时
制作
我得到了很多错误的形式
src/File.c:####: undefined reference to some_function ()
。在我看来,它没有正确通过CFLAGS。我做错了什么?
编辑:经过进一步研究,我发现如果源文件被传递到gcc,就会发生“未定义引用”错误
之后
图书馆。下面是make正在使用的命令。
gcc -std=gnu99 -pthread -I/usr/local/include/gee-0.8 -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircommon -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/json-glib-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -O2 -L/usr/local/lib -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgee-0.8 -ljson-glib-1.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -o white-house white_house-Window.o
正如您所看到的,源文件是最后一件事。如果我在
-l
它编译的参数很好。所以问题是:为什么Makefile会将它们放在错误的顺序中?