So let us position in ~/autohello.
~/autohello$ autoreconf --install configure.ac:28: installing './compile' configure.ac:16: installing './install-sh' configure.ac:16: installing './missing' src/Makefile.am: installing './depcomp' ~/autohello$
~/autohello$ ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking stdio.h usability... yes checking stdio.h presence... yes checking for stdio.h... yes checking for stdlib.h... (cached) yes checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating src/Makefile config.status: creating src/autohello-version.h config.status: creating config.h config.status: executing depfiles commands ~autohello$
Now after that configuration has been done, we can call make to compile the software, then run it.
~/autohello$ make make all-recursive make[1]: entrant dans le répertoire « /home/cch/autohello » Making all in src make[2]: entrant dans le répertoire « /home/cch/autohello/src » gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -D_GNU_SOURCE -g -O2 -MT autohello.o -MD -MP -MF .deps/autohello.Tpo -c -o autohello.o autohello.c mv -f .deps/autohello.Tpo .deps/autohello.Po gcc -g -O2 -o autohello autohello.o make[2]: quittant le répertoire « /home/cch/autohello/src » make[2]: entrant dans le répertoire « /home/cch/autohello » make[2]: quittant le répertoire « /home/cch/autohello » make[1]: quittant le répertoire « /home/cch/autohello » ~/autohello$ cd src ~/autohello/src$ ./autohello Hello world version 1.0.0 ~/autohello/src$
Now we can install the program and run the installed version :
~/autohello/src$ sudo make install [sudo] password for cch: make[1]: entrant dans le répertoire « /home/cch/autohello/src » test -z "/usr/local/bin" || /bin/mkdir -p "/usr/local/bin" /usr/bin/install -c autohello '/usr/local/bin' make[1]: Rien à faire pour « install-data-am ». make[1]: quittant le répertoire « /home/cch/autohello/src » ~/autohello/src$ autohello Hello world version 1.0.0 ~/autohello/src$
Now that the program is OK, we can prepare its distribution through a standardized archive. We just have to call make dist-bzip2 and the archive is built by the top level Makefile.
~/autohello$ make dist-bzip2 if test -d "autohello-1.0.0"; then find "autohello-1.0.0" -type d ! -perm -200 -exec chmod u+w {} ';' && rm -rf "autohello-1.0.0" || { sleep 5 && rm -rf "autohello-1.0.0"; }; else :; fi test -d "autohello-1.0.0" || mkdir "autohello-1.0.0" (cd src && make top_distdir=../autohello-1.0.0 distdir=../autohello-1.0.0/src \ am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir) make[1]: entrant dans le répertoire « /home/cch/autohello/src » make[1]: quittant le répertoire « /home/cch/autohello/src » test -n "" \ || find "autohello-1.0.0" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec /bin/sh /home/cch/autohello/install-sh -c -m a+r {} {} \; \ || chmod -R a+r "autohello-1.0.0" tardir=autohello-1.0.0 && ${TAR-tar} chof - "$tardir" | BZIP2=${BZIP2--9} bzip2 -c >autohello-1.0.0.tar.bz2 if test -d "autohello-1.0.0"; then find "autohello-1.0.0" -type d ! -perm -200 -exec chmod u+w {} ';' && rm -rf "autohello-1.0.0" || { sleep 5 && rm -rf "autohello-1.0.0"; }; else :; fi ~/autohello$ ls aclocal.m4 config.h config.status depcomp Makefile.am src autohello-1.0.0.tar.bz2 config.h.in configure install-sh Makefile.in stamp-h1 autom4te.cache config.log configure.ac Makefile missing ~/autohello$
If you want to try this tutorial, you can download the files : autohello 1.0.0 archive.
In the next article we will add configuration option and see what appends if we change one of the templates.
CIO Systèmes Embarqués – 1 Rue de la Presse, 42 000 Saint-Étienne – contact@ciose.fr – 04 77 93 34 32
CIO Systèmes Embarqués est le nom commercial de la SAS CIO Informatique Industrielle
CIO Informatique Industrielle © 1991-2020 v3.0