在test目录上新建src和include目录,源文件中src目录下,头文件在include目录。在src目录新建Makefile.am文件,编写Makefile.am,如下:
AUTOMAKE_OPTIONS = foreign
INCLUDES= -I../include
bin_PROGRAMS = main
radio_SOURCES = main.c \
keyboard.c \
lcd.c \
setup.c \
storage.c
保存退出。
返回test目录,再新建Makefile.am文件,编写Makefile.am,如下:
SUBDIRS = src
保存退出。
执行
autoscan
生成configure.scan文件 ,如:
autoscan.log configure.scan include Makefile.am src
编辑configure.scan文件,如:
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT(radio,1.0.0,[wenzel@163.com])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/make.c])
AC_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
#AC_PROG_RANLIB
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/time.h termios.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MALLOC
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([bzero memset strcasecmp strchr strrchr])
#AC_CONFIG_FILES([Makefile
# src/Makefile])
AC_OUTPUT(Makefile src/Makefile)
保存退出,改名为:mv configure.scan configure.in
执行:
touch NEWS README AUTHORS ChangeLog
再执行:
autoreconf -fvi
最后,可以执行:
./configure
配置为ARM平台:
./configure --host=arm --target=arm CC=arm-linux-gcc
就可以编译了,如:
make
make install
make clean
make distclean
阅读(1554) | 评论(0) | 转发(0) |