اِشکال CMake این است که باید روی سیستم هدف نیز نصب شود!!!... خب! نصبش کن!
Make sure the following tools are available on the system...
tar
make
aclocal
autoconf
automake
// configure.ac
AC_INIT([helloworld], [0.1], [mohammad@nouri.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
وردهای جادوئی (Magic Incantation) ...یک Invocation همه منظوره!!!... |
|
aclocal |
# Set up an m4 environment |
autoconf |
# Generate configure from configure.ac |
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 |
|
|
./configure |
# Generate Makefile from Makefile.in # بررسی سیستم برای وجود برنامه ها، کتابخانه ها و توابع مورد نیاز ... |
make |
# Use Makefile to build the program # کامپایل برنامه |
make install |
# Use Makefile to install the program |
پروژه ای متشکل از چندین پروژه (پوشه های دیگر...)
1- پروژه ها را در پوشه پروژه اصلی ادغام (کپی) می کنیم. پوشه های پروژه ها را در پوشه اصلی قرار می دهیم...
configure.ac: AC_CONFIG_SUBDIRS([Subdir1])
...
Makefile.am: SUBDIRS=subdir1
2- ایجاد کتابخانه هر یک از پروژه ها
package_directory
|
|--include
| `--hello.hxx world.hxx
|
|--lib
| |--hello.cxx world.cxx
| `--Makefile.am
|
|--src
| |--main.cxx
| `--Makefile.am
|
|--configure.ac: ..AC_CONFIG_FILES([lib/Makefile src/Makefile Makefile])..
|--Makefile.am: SUBDIRS=lib src # processed in this order !
`--README, NEWS, INSTALL, ChangeLog, AUTHORS, COPYING
$ touch NEWS README ChangeLog AUTHORS
There are two kinds of libraries:
- static libraries (*.a)... Archived Object Files
- dynamic libraries (*.so)... Shared Objects Files
There are differences in the handling of dynamic libraries from one system to another. Some systems even DO NOT support dynamic libraries.!!!.???.