GNU Automake

automakeはMakefile.amからMakefile.inを生成する。
Makefileはビルドやインストールなどの手順を記述したmakeコマンド用のスクリプトである。

Makefile.am
bin_PROGRAMS = okoge
okoge_SOURCES = main.c
試す

以下をbootstarapという名前でスクリプトにしておくと便利。

#!/bin/sh

set -x
aclocal -I config
autoheader
automake --foreign --add-missing --copy
autoconf

aclocalはautoheader / autoconfが使用するマクロのための情報を収集するコマンドである。
autoheaderはconfig.h.inを作る。
automakeはMakefile.amからMakefile.inを作る。
autoconfはconfigureを作る。

./bootstrap
./configure
make all

./configureで、config.hとMakefileを作る。
make allで、実際にコンパイルされる。

サブディレクトリに分ける

ここが参考になった。
Automake‚Åmake‚·‚é

参考

GNU Autoconf/Automake/Libtool

GNU Autoconf/Automake/Libtool