automake生成makefile文件
1、编译参考
参考链接:https://blog.csdn.net/lee244868149/article/details/42241061(里面存在部分问题,所以参考后面的部分)
链接:(编译文件的生成和文件的修改参考)https://blog.csdn.net/vevenlcf/article/details/9411109?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522160242248819724848341667%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=160242248819724848341667&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2blogfirst_rank_v2~rank_blog_default-2-9411109.pc_v2_rank_blog_default&utm_term=automake&spm=1018.2118.3001.4187
步骤:
1、执行 autoscan
2、 编辑configure.scan
#vim configure.scan
1 # -- Autoconf --
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ([2.69])
5 #AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
6
7 #####1
8 #AC_CONFIG_SRCDIR([hello.c])
9
10 #####2
11 #AC_INIT([hello.c])
12 #AM_INIT_AUTOMAKE(helloworld, 1.0)
13
14 #####3
15 AC_INIT(hello,1.0)
16 AM_INIT_AUTOMAKE(hello,1.0)
17 AC_CONFIG_SRCDIR([hello.c])
18
19 AC_CONFIG_HEADER([config.h])
20
21
22 # Checks for programs.
23 AC_PROG_CC
24
25 # Checks for libraries.
26
27 # Checks for header files.
28
29 # Checks for typedefs, structures, and compiler characteristics.
30
31 # Checks for library functions.
32
33 AC_OUTPUT(Makefile)
然后将文件改名:执行
mv configure.scan configure.in
cp configure.in configure.ac
3、执行命令
然后执行:
#aclocal
#autoconf
autoheader
4、 automake
编辑 Makefile.am文件
#vim Makefile.am
1 AUTOMAKE_OPTIONS=foreign
2 bin_PROGRAMS=hello
3 hello_SOURCES=hello.c
4 # LIBS += -lm -lz -lmysqlclient_r]
执行:生成Makefile
#automake -–add-missing
5、 #./configure
6、# make