Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use autoscan and automake in linux to generate makefile automatically by makefile.am

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to use autoscan and automake in linux to automatically generate makefile by makefile.am", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use autoscan and automake in linux to automatically generate makefile by makefile.am" this article.

How to use autoconf and automake tools to help us automatically generate Makefile in line with free software conventions, so that like common GNU programs, as long as you use ". / configure", "make", "make instal", you can install the program into the Linux system.

* before you start using autoconf and automake, make sure that the following software of GNU is installed on your system:

1. Automake

2. Autoconf

3. M4

4. Perl

5. If you need to generate a shared library (shared library), you also need GNU Libtool.

* before introducing the method, you should write down several steps of autoconf and automake. The steps are explained as follows:

1. Generate the configure.scan file from your source file through the autoscanf command, and then modify

Configure.scan file and renamed to configure.in

2. Generate aclocal.m4 by aclocal command

3. Generate configure by autoconf command

Note: very important!

If you go straight to step 4 here:

Automake-- add-missing: an error occurs later: configure.in:8:required file

`. / config.h.in' not found

Immediately after. / configure, config.status: error: cannot find input file:

Config.h

Solution: execute autoheader before automake-add-missing to ok, general online information

Few people mention this step, and everyone turns around, all of which will lead to mistakes.

4. Edit a Makefile.am file and generate it by the automake (automake-- add-missing) command

Makefile.in file

5. / configure command generates Makefile (described later)

Practice: the structure of my source program is as follows: a total of two directories: viaencode/, videolib/

There are two source files and one makefile.am file under viaencode/: encodeapi.c, viaenc.c, Makefile.am

There are four header files under videolib/: MP4EncApi.h, hw_lib.h, ViaApi.h, itu.h, and six .a library files: libext_device_ctrl.a, libhwdec.a, libhwenc.a, libitu.a, libuserdev.a, and libvia.a. The generated target program viaenc should be downloaded to the open board to run.

Follow these steps to generate Makefile automatically:

1. Enter the viaencode/ directory and run the autoscan command as follows:

# cd viaencode/

# autoscan

2. Ls will find that there is an extra configure.scan file. Modify this file by adding AM_INIT_AUTOMAKE (viaenc, 1. 0) after the AC_ int macro, where hello is your software name and 1. 0 is the version number, that is, your source code compilation will generate a software viaenc-1.0 version. " Then complete the last line of the AC_OUTPUT macro in the configure.scan file into AC_OUTPUT (Makefile), indicating that autoconf and automake will eventually generate a Makefile file. "this will make an error, because there is a sentence AC_CONFIG_FILES ([Makefile]) before, so I haven't changed. Finally, the configure.scan file is renamed to configure.in.

3. Run the aclocal command and ls will find an extra aclocal.m4 file.

Then run the autoconf command, and ls will find that an executable configure command has been generated.

5. Implement autoheader, which has been mentioned earlier.

6. Edit a Makefile.am file. The contents of the file are as follows:

Bin_PROGRAMS = viaenc

Viaenc_SOURCES = viaenc.c encodeapi.c

AM_CFLAGS =-I../videolib

LDADD =-L../videolib-lvia-litu-lhwdec-lext_device_ctrl-lhwenc-lpthread-luserdev

7. Run the automake-add-missing command. The screen prompts are as follows:

Automake: configure.in: installing `. / install-sh'

Automake: configure.in: installing `. / mkinstalldirs'

Automake: configure.in: installing `. / missing'

8, run the configure command to generate a Makefile file, enter the. / configure command 9, because the application is to be downloaded to the development version to run, so you must modify the cross-compilation tool. Modify the CC= gcc in Makefile to point to your own cross-compilation tool, CC=/usr/local/arm/gcc-3.4.4-glibc-2.3.6/bin/arm-linux-gcc. Otherwise, it will go wrong!

The biggest advantage of using autoconf and automake is that after your program is released as a source program, everyone else only needs to type. / configure in turn, and the make,make install command can install your program and run it on your own computer. All UNIX/Linux that conform to the GNU standard do not need to modify any characters in the Makefile.

The above is all the contents of the article "how to use autoscan and automake in linux to generate makefile automatically from makefile.am". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report