summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Martin <amartin@nvidia.com>2013-04-08 16:25:54 -0700
committerAllen Martin <amartin@nvidia.com>2013-04-09 11:18:26 -0700
commit624cec685c0e5988513663174b3b5fe14fcfaadb (patch)
tree93091ae6aeffab85342fbfea615174a63ad6a264
parent480901aba3b4bf1ac339477d9a84f0d08f9a53cd (diff)
downloadnvidia-cbootimage-624cec685c0e5988513663174b3b5fe14fcfaadb.tar.gz
Add autotools supportv1.0
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>
-rw-r--r--Makefile.am5
-rwxr-xr-xautogen.sh5
-rw-r--r--configure.ac38
-rw-r--r--src/GNUmakefile74
-rw-r--r--src/Makefile.am60
5 files changed, 108 insertions, 74 deletions
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..d35ae37
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,5 @@
+AUTOMAKE_OPTIONS = foreign
+SUBDIRS = src
+
+distclean-local:
+ rm -rf autom4te.cache
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..e925023
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,5 @@
+#!/bin/sh -e
+
+autoreconf --install --symlink
+./configure $@
+
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..d82c172
--- /dev/null
+++ b/configure.ac
@@ -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
diff --git a/src/GNUmakefile b/src/GNUmakefile
deleted file mode 100644
index eb0b6b9..0000000
--- a/src/GNUmakefile
+++ /dev/null
@@ -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
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..6fcc0d8
--- /dev/null
+++ b/src/Makefile.am
@@ -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