automake

automake Environment Variable Condition

家住魔仙堡 提交于 2020-01-23 13:34:31
问题 I have a file Makefile.am I am using to generate a Makefile. In the generated Makefile I want to have something like: ifndef SOURCECODEPATH SOURCECODEPATH := /home/root/source_code_path endif It seems so simple, does anyone know how I can do it? 回答1: Use the AM_CONDITIONAL macro in configure.ac . The script sets a variable you can test, e.g., a variable that is set to non-empty if the condition is enabled: AM_CONDITIONAL([ENABLE_SOURCECODEPATH], [test "x$ac_srcpath" != "x"]) Then in Makefile

automake Environment Variable Condition

半腔热情 提交于 2020-01-23 13:33:45
问题 I have a file Makefile.am I am using to generate a Makefile. In the generated Makefile I want to have something like: ifndef SOURCECODEPATH SOURCECODEPATH := /home/root/source_code_path endif It seems so simple, does anyone know how I can do it? 回答1: Use the AM_CONDITIONAL macro in configure.ac . The script sets a variable you can test, e.g., a variable that is set to non-empty if the condition is enabled: AM_CONDITIONAL([ENABLE_SOURCECODEPATH], [test "x$ac_srcpath" != "x"]) Then in Makefile

Where to put helper-scripts with GNU autoconf/automake?

只愿长相守 提交于 2020-01-21 08:58:32
问题 I'm working on a project that will be distributed with GNU autoconf/automake, and I have a set of bash scripts which call awk scripts. I would like the bash scripts to end up in the $PATH, but not the awk scripts. How should I insert these into the project? Should they be put in with other binaries? Also, is there a way to determine the final location of the file after installation? I presume that /usr/local/bin isn't always where the executables end up... 回答1: Add something like this to

Automake, generated source files and VPATH builds

强颜欢笑 提交于 2020-01-14 08:55:13
问题 I'm doing VPATH builds with automake. I'm now also using generated source, with SWIG. I've got rules in Makefile.am like: dist_noinst_DATA = whatever.swig whatever.cpp: whatever.swig swig -c++ -php $^ Then the file gets used later: myprogram_SOURCES = ... whatever.cpp It works fine when $builddir == $srcdir . But when doing VPATH builds (e.g. mkdir build; cd build; ../configure; make ), I get error messages about missing whatever.cpp . Should generated source files go to $builddir or $srcdir

configure/make/make install的作用(MarkZZ)

末鹿安然 提交于 2020-01-12 03:49:27
这些都是典型的使用GNU的AUTOCONF和AUTOMAKE产生的程序的安装步骤。 ./configure 是用来检测你的安装平台的目标特征的。比如它会检测你是不是有CC或GCC,并不是需要CC或GCC,它是个shell脚本。 make 是用来编译的,它从Makefile中读取指令,然后编译。 make install 是用来安装的,它也从Makefile中读取指令,安装到指定的位置。 AUTOMAKE和AUTOCONF 是非常有用的用来发布C程序的东西。如果你也写程序想使用AUTOMAKE和AUTOCONF,可以参考CNGNU.ORG上的相关文章。 --End-- 1、configure ,这一步一般用来生成 Makefile,为下一步的编译做准备,你可以通过在 configure 后加上参数来对安装进行控制,比如 代码: ./configure --prefix=/usr 上面的意思是将该软件安装在 /usr 下面,执行文件就会安装在 /usr/bin (而不是默认的 /usr/local/bin),资源文件就会安装在 /usr/share(而不是默认的/usr/local/share)。同时一些软件的配置文件你可以通过指定 --sys-config= 参数进行设定。有一些软件还可以加上 --with、--enable、--without、--disable

静态库和动态库的编译切换

柔情痞子 提交于 2020-01-08 20:02:47
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 如果你想在同一个target上既编译静态库,又能编译动态库,那么稍微修改下 xmale.lua就行了: add_target("test") -- 设置编译target的类型,之前是:static/shared,现在改成动态的 set_kind("$(kind)") -- 添加文件 add_files(*.c) 好了,现在默认编译的时候,会生成静态库:libtest.a 如果你想生成动态库,只需要执行: # 简写 xmake f -k shared # 或者 xmake config --kind=shared # 编译 xmake 配置成动态库模式,重建下就行了。。参数: -k/--kind 可以手动在配置的时候指定,需要编译的target类型,实际会去影响: set_kind("$(kind)") 中的$(kind)的配置变量。。 如果你想在target针对static/shared类型,分别处理不同的宏开关,也可以使用 if kinds("static") then 来判断 add_target("test") -- 设置编译target的类型,之前是:static/shared,现在改成动态的 set_kind("$(kind)") -- 添加文件 add_files(*.c) -- 如果是动态库

基于automake构建工程

烂漫一生 提交于 2020-01-08 16:14:21
在Linux平台,几乎所有工程都是基于Makefile进行编译的,在小型项目中,你可以手写Makefile,但是大型工程,手写Makefile处理起来很复杂,因此就需要使用automake进行构建工程 1.autoscan (autoconf): 扫描源代码以搜寻普通的可移植性问题,比如检查编译器,库,头文件等,生成文件configure.scan,它是configure.ac的一个雏形。 然后直接将configure.scan该名为configure.ac,并编辑:configure.ac 2.aclocal (automake) 根据已经安装的宏,用户定义宏和acinclude.m4文件中的宏将configure.ac文件所需要的宏集中定义到文件 aclocal.m4中。aclocal是一个perl 脚本程序. 3.automake automake将Makefile.am中定义的结构建立Makefile.in,然后configure脚本将生成的Makefile.in文件转换 为Makefile 4.autoconf 将configure.ac中的宏展开,生成configure脚本。这个过程可能要用到aclocal.m4中定义的宏。 5.configure ./configure 生成Makefile 6.编译 执行make 问题: 1

automake third party libraries

早过忘川 提交于 2020-01-05 10:09:40
问题 How to compile and link third party libraries with automake? My file structure is: program/ | +--src/ | | | +--Makefile.am | +--main.cpp | +--lib/ | | | +--Makefile.am | +--library.cpp | +--Makefile.am +--configure.ac +--README Contents of automake files are pretty generic: # src/Makefile.am bin_PROGRAMS = program program_SOURCES = main.cpp # Makefile.am SUBDIRS = src lib dist_doc_DATA = README # configure.ac AC_INIT([program], [1.0]) AM_INIT_AUTOMAKE([-Wall]) AC_PROG_CXX AC_CONFIG_HEADERS(

Determining Architecture In Makefile.am using Automake

一笑奈何 提交于 2020-01-04 13:16:25
问题 To see what I am trying to do see below: My question is how can I conditionally set AM_CPPFLAGS or my_lib_la_CPPFLAGS inside of my Makefile.am. Such that when configure is run the right CPPFLAGS are set? Currently I am doing something to the affect of: lib_xml_wrapper_la_CPPFLAGS = -I../../ UNAME_S = $(shell uname -s) UNAME_P = $(shell uname -p) ifeq ($(UNAME_S),Linux) lib_xml_wrapper_la_CPPFLAGS += -DLINUX ifeq ($(UNAME_P),x86_64) lib_xml_wrapper_la_CPPFLAGS += -D AMD64 endif ifeq ($(UNAME_P

why i failed to build autoconf with autoconf2.6x, its version is newer than 2.6 anyhow

狂风中的少年 提交于 2020-01-04 06:39:08
问题 my system is centos based. the reason i try to build autoconf is that someone told me i can try to build it in order to solve the other problem, you may find the motivation with this link why autogen.sh failed even with the correct autoconf? [mirror@home auto]$ cd autoconf/ [mirror@home autoconf]$ ls AUTHORS cfg.mk ChangeLog.3 COPYINGv3 lib man README-hacking bin ChangeLog.0 configure.ac doc m4 NEWS tests BUGS ChangeLog.1 COPYING GNUmakefile maint.mk README THANKS build-aux ChangeLog.2