1) Create sources, “Makefile.am”
2) `autoscan`:create configure.scan
3) Rename “configure.scan” to “configure.ac”
4) `autoheader`:create config.h.in for automake
5) Add AM_INIT_AUTOMAKE to “configure.ac”, just after AC_INIT()
6) `aclocal`:create necessary macros in aclocal.m4 for automake.
7) `automake --add-missing --copy`: create Makefile.in from Makefile.am
8) `autoconf`:create configure
9) `./configure`:check and create Makefile
10) `make`
11) `make install`
if you modify your source...
1) Run `autoscan` again
2) Compare configure.scan with configure.ac
* Update configure.ac
3) Run `autoreconf`
***********************
# Makefile.am for hello.c
bin_PROGRAMS=hello
hello_SOURCES=hello.c
***********************
To simplify it:
===============
1) c/cc files, Makefile.am
2) autoscan => mv configure.scan configure.ac => add Add AM_INIT_AUTOMAKE after AC_INIT
3) autoheader
4) aclocal
5) automake
6) autoconf <=> autoscan,(compare configure.ac),autoreconf
7) ./configure && make && make install
Simplest 'make'
=====================
Hello.c:
#include
Makefile:
int main(int argc, char* argv[])
{
printf("Hello, world!\n");
return 0;
}
# Makefile: A standard Makefile for hello.c
Run: make, to create executable bin file.
all: hello
clean: rm -f hello
2 comments:
Excellent post, and very concise.
Thanks!
nice share!! Thanks!
Post a Comment