From 5b7562f2de7374e1e6d47cfc37120a2d9cd243f1 Mon Sep 17 00:00:00 2001 From: Trevor Woerner Date: Mon, 20 Mar 2017 02:12:23 -0400 Subject: [PATCH] update the build system to use autotools The autotool system provides a high-level way of specifying what to build, and then generates Makefile templates based on these requirements as well as a way of generating Makefiles at build time based on what it finds at build time (i.e. specifics about the system on which it is being built), and configuration options set by the user at build time. The nice thing about autotools is that it better encapsulates distro-specific "gotchas" that make it hard to create a Makefile by hand which will work on a wide range of different versions of various UNIX distributions. It also includes built-in support for out-of-tree build (VPATH), cross-development, and DESTDIR installs. These generated Makefiles automatically include support for a wide range of 'make' targets such as: make, make clean, make install, make uninstall, make check, make distclean, make dist, make strip, make distcheck, etc. These targets make it easier to follow the "Makefile Conventions" of "The Release Process" from the "GNU Coding Standards" (https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html). Signed-off-by: Trevor Woerner --- .gitignore | 11 +++++++++++ Makefile | 24 ------------------------ Makefile.am | 20 ++++++++++++++++++++ Readme.txt | 4 +++- cfg/.gitignore | 6 ++++++ cfg/Makefile.am | 6 ++++++ configure.ac | 24 ++++++++++++++++++++++++ 7 files changed, 70 insertions(+), 25 deletions(-) create mode 100644 .gitignore delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100644 cfg/.gitignore create mode 100644 cfg/Makefile.am create mode 100644 configure.ac diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..29cef09 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +*.o +.deps +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.log +config.status +configure +rkdeveloptool +rkdeveloptool*bz2 diff --git a/Makefile b/Makefile deleted file mode 100644 index d7b3444..0000000 --- a/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# Simple Makefile for RK Flash Tool - -CC = g++ -LD = $(CC) -CXXFLAGS= -O2 -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -I/usr/include/libusb-1.0 -LDFLAGS = -L/usr/lib -Wl,-Bstatic -lusb-1.0 -Wl,-Bdynamic -ludev -lrt -lpthread - - -PROGS = $(patsubst %.cpp,%.o, $(wildcard *.cpp)) - -rkdeveloptool: $(PROGS) - $(CC) $(CXXFLAGS) $^ -o rkdeveloptool $(LDFLAGS) - -install: $(PROGS) - install -d -m 0755 /usr/local/bin - install -m 0755 ./rkdeveloptool /usr/local/bin - -clean: - rm $(PROGS) ./rkdeveloptool - -uninstall: - cd /usr/local/bin && rm -f ./rkdeveloptool - - diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..47787c1 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,20 @@ +## Copyright (C) 2017 Trevor Woerner + +SUBDIRS = +DIST_SUBDIRS = cfg + +AM_CPPFLAGS = -Wall -Werror -Wextra -Wreturn-type -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE $(LIBUSB1_CFLAGS) + +bin_PROGRAMS = rkdeveloptool +rkdeveloptool_SOURCES = main.cpp \ + crc.cpp DefineHeader.h Endian.h DefineHeader.h Property.hpp \ + RKBoot.cpp RKBoot.h \ + RKComm.cpp RKComm.h \ + RKDevice.cpp RKDevice.h \ + RKImage.cpp RKImage.h \ + RKLog.cpp RKLog.h \ + RKScan.cpp RKScan.h +rkdeveloptool_LDADD = $(LIBUSB1_LIBS) + +clean-local:: + $(RM) -fr log diff --git a/Readme.txt b/Readme.txt index 6c4c041..80a3191 100644 --- a/Readme.txt +++ b/Readme.txt @@ -4,7 +4,9 @@ compile and install 1 install libusb and libudev sudo apt-get install libudev-dev libusb-1.0-0-dev 2 go into root of rkdeveloptool -3 make && make install +3 autoreconf -i +4 ./configure +5 make rkdeveloptool usage,input "rkdeveloptool -h" to see diff --git a/cfg/.gitignore b/cfg/.gitignore new file mode 100644 index 0000000..09f2a98 --- /dev/null +++ b/cfg/.gitignore @@ -0,0 +1,6 @@ +compile +config* +depcomp +install* +missing +stamp* diff --git a/cfg/Makefile.am b/cfg/Makefile.am new file mode 100644 index 0000000..ef8fb97 --- /dev/null +++ b/cfg/Makefile.am @@ -0,0 +1,6 @@ +## Copyright (C) 2017 Trevor Woerner + +######################## +# cfg/Makefile.am +######################## +SUBDIRS = diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..44f4c1f --- /dev/null +++ b/configure.ac @@ -0,0 +1,24 @@ +dnl Copyright (C) 2017 Trevor Woerner + +AC_INIT([Rockchip rkdeveloptool], 1.0, [Eddie Cai ], rkdeveloptool) +AC_PREREQ([2.68]) +AC_CONFIG_SRCDIR(main.cpp) +AC_CONFIG_AUX_DIR(cfg) +AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-bzip2 1.9]) +AM_CONFIG_HEADER(cfg/config.h) + +SUBDIRS="" + +AC_PROG_CPP +AC_PROG_CXX +AC_PROG_CXXCPP +AC_PROG_MAKE_SET +AC_PROG_INSTALL +AC_PROG_LN_S + +PKG_CHECK_MODULES(LIBUSB1,libusb-1.0) + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([cfg/Makefile]) + +AC_OUTPUT