Add autotools support

Remove previous hardcoded GNUmakefile and replace with autoconf/automake
generated configure script and Makefile.

Signed-off-by: Allen Martin <amartin@nvidia.com>
Change-Id: I48d3f6f20423109dc662418b92900876a8f8d1da
Reviewed-on: http://git-master/r/217547
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
Allen Martin 2013-04-08 16:25:54 -07:00
parent 480901aba3
commit 624cec685c
5 changed files with 108 additions and 74 deletions

5
Makefile.am Normal file
View File

@ -0,0 +1,5 @@
AUTOMAKE_OPTIONS = foreign
SUBDIRS = src
distclean-local:
rm -rf autom4te.cache

5
autogen.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh -e
autoreconf --install --symlink
./configure $@

38
configure.ac Normal file
View File

@ -0,0 +1,38 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.67])
AC_INIT([cbootimage], [1.0], [pchiu@nvidia.com])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/cbootimage.c])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
PKG_PROG_PKG_CONFIG
# Checks for libraries.
AC_CHECK_LIB(m, log2)
# Checks for header files.
AC_CHECK_HEADERS([stdio.h string.h ctype.h sys/stat.h getopt.h stdlib.h assert.h errno.h sys/types.h math.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SSIZE_T
AC_HEADER_STDBOOL
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MALLOC
AC_CHECK_FUNCS([memset])
AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT

View File

@ -1,74 +0,0 @@
# Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
TARGETS = cbootimage bct_dump
CC = gcc
CFLAGS = -Wall -O -lm
all: $(TARGETS)
#
# Build the cbootimage tool.
#
CBOOTIMAGE_C_FILES := cbootimage.c
CBOOTIMAGE_C_FILES += data_layout.c
CBOOTIMAGE_C_FILES += set.c
CBOOTIMAGE_C_FILES += crypto.c
CBOOTIMAGE_C_FILES += aes_ref.c
CBOOTIMAGE_C_FILES += context.c
CBOOTIMAGE_C_FILES += parse.c
CBOOTIMAGE_C_FILES += t114/parse_t114.c
CBOOTIMAGE_C_FILES += t30/parse_t30.c
CBOOTIMAGE_C_FILES += t20/parse_t20.c
CBOOTIMAGE_C_FILES += t114/nvbctlib_t114.c
CBOOTIMAGE_C_FILES += t30/nvbctlib_t30.c
CBOOTIMAGE_C_FILES += t20/nvbctlib_t20.c
CBOOTIMAGE_OBJS := $(patsubst %.c,%.o,$(CBOOTIMAGE_C_FILES))
cbootimage: $(CBOOTIMAGE_OBJS)
$(CC) -o $@ $^ $(CFLAGS)
#
# Build the bct_dump tool. This tool generates a human readable version of
# the given BCT file.
#
BCT_DUMP_C_FILES := bct_dump.c
BCT_DUMP_C_FILES += data_layout.c
BCT_DUMP_C_FILES += set.c
BCT_DUMP_C_FILES += crypto.c
BCT_DUMP_C_FILES += aes_ref.c
BCT_DUMP_C_FILES += context.c
BCT_DUMP_C_FILES += parse.c
BCT_DUMP_C_FILES += t114/parse_t114.c
BCT_DUMP_C_FILES += t30/parse_t30.c
BCT_DUMP_C_FILES += t20/parse_t20.c
BCT_DUMP_C_FILES += t114/nvbctlib_t114.c
BCT_DUMP_C_FILES += t30/nvbctlib_t30.c
BCT_DUMP_C_FILES += t20/nvbctlib_t20.c
BCT_DUMP_OBJS := $(patsubst %.c,%.o,$(BCT_DUMP_C_FILES))
bct_dump: $(BCT_DUMP_OBJS)
$(CC) -o $@ $^ $(CFLAGS)
#
# Remove built targets, object files and temporary editor files.
#
clean:
rm -f $(CBOOTIMAGE_OBJS) $(BCT_DUMP_OBJS) *~ $(TARGETS)
install: cbootimage bct_dump
install -D -m 755 cbootimage $(DESTDIR)/usr/bin
install -D -m 755 bct_dump $(DESTDIR)/usr/bin

60
src/Makefile.am Normal file
View File

@ -0,0 +1,60 @@
AM_CFLAGS = -Wall -std=c99
bin_PROGRAMS = cbootimage bct_dump
cbootimage_SOURCES = \
cbootimage.c \
data_layout.c \
set.c \
crypto.c \
aes_ref.c \
context.c \
parse.c \
t114/parse_t114.c \
t30/parse_t30.c \
t20/parse_t20.c \
t114/nvbctlib_t114.c \
t30/nvbctlib_t30.c \
t20/nvbctlib_t20.c \
cbootimage.h \
context.h \
crypto.h \
data_layout.h \
nvaes_ref.h \
parse.h \
set.h \
t20/nvboot_bct_t20.h \
t20/nvboot_sdram_param_t20.h \
t30/nvboot_bct_t30.h \
t30/nvboot_sdram_param_t30.h \
t114/nvboot_bct_t114.h \
t114/nvboot_sdram_param_t114.h
cbootimage_LDADD = -lm
bct_dump_SOURCES = \
bct_dump.c \
data_layout.c \
set.c \
crypto.c \
aes_ref.c \
context.c \
parse.c \
t114/parse_t114.c \
t30/parse_t30.c \
t20/parse_t20.c \
t114/nvbctlib_t114.c \
t30/nvbctlib_t30.c \
t20/nvbctlib_t20.c \
cbootimage.h \
context.h \
crypto.h \
data_layout.h \
nvaes_ref.h \
parse.h \
set.h \
t20/nvboot_bct_t20.h \
t20/nvboot_sdram_param_t20.h \
t30/nvboot_bct_t30.h \
t30/nvboot_sdram_param_t30.h \
t114/nvboot_bct_t114.h \
t114/nvboot_sdram_param_t114.h