自动生成Makefile文件模板

Step by Step

1, autoscan

2, move configure.scan to configure.ac, and vim configure.ac like this:

AM_INIT_AUTOMAKE(myprojectname , version)

AC_OUTPUT(Makefile  subdir/Makefile subdir1/Makefile)

AC_PROG_RANLIB

3, aclocal : a perl script

4, autoconf -fvi

5, make Makefile.am, as:

bin_PROGRAMS=myprogram
SUBDIRS=sub1

myprogram_SOURCES= \
a.cpp \
b.cpp

EXTRA_DIST= \
a.h \
b.h

myprogram_LDADD = libsub1.a

myprogram_LDFLAGS = -lpthread -lglib-2.0 -L/usr/bin $(all_libraries)

AM_CXXFLAGS = -D_LINUX

INCLUDES=-IPassport -Isub1/ -I/usr/include/glib-2.0 \
-I/usr/lib/glib-2.0/include $(all_includes)

6, autoheader declare config.h.in

7, automake --add-missing

8, ./configure

9, make

10, example:

template.tar.gz

you can run the script name of rmlocal, and try it .

author:cnangel


Monthly Archives

Pages

Powered by Movable Type 7.7.2

About this Entry

This page contains a single entry by Cnangel published on March 9, 2008 10:13 AM.

和何伟平老师的一番谈话 was the previous entry in this blog.

介绍一款目录对比工具——Meld is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.