blob: 2fb38f0ff188eb555a60551d75d5673c4ce63a1d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
- hello world mini Autotools tutorial
there's mainly 2 parts: 1st is to write "configure.ac" and 2nd write Makefile.am
$ autoscan
$ mv configure.scan configure.ac
$ aclocal # Set up an m4 environment
$ autoconf # Generate configure from configure.ac
$ autoheader
$ touch NEWS README AUTHORS Changelog
$ automake --add-missing # Generate Makefile.in from Makefile.am
$ ./configure # Generate Makefile from Makefile.in
$ make distcheck # Use Makefile to build and test a tarball to distribute
$ make
$ make install
configure.ac
AC_INIT([helloworld], [0.1], [kylek389@gmail.com])
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Makefile.am
AUTOMAKE_OPTIONS = foreign
bin_PROGRAMS = helloworld
helloworld_SOURCES = helloworld.c
- misc
config.h -- you can include "config.h" in your .c code and use constants defined in config.h to write portable code
ifnames. -- use this command to list what 'constants' have be used from config.h in *.c files of current project
2 awesome tutorials:
-> https://robots.thoughtbot.com/the-magic-behind-configure-make-make-install
-> http://markuskimius.wikidot.com/programming:tut:autotools
|