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 <twoerner@gmail.com>
This commit is contained in:
Trevor Woerner 2017-03-20 02:12:23 -04:00
parent 9908df895e
commit 5b7562f2de
7 changed files with 70 additions and 25 deletions

11
.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
*.o
.deps
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.log
config.status
configure
rkdeveloptool
rkdeveloptool*bz2

View File

@ -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

20
Makefile.am Normal file
View File

@ -0,0 +1,20 @@
## Copyright (C) 2017 Trevor Woerner <twoerner@gmail.com>
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

View File

@ -4,7 +4,9 @@ compile and install
1 install libusb and libudev 1 install libusb and libudev
sudo apt-get install libudev-dev libusb-1.0-0-dev sudo apt-get install libudev-dev libusb-1.0-0-dev
2 go into root of rkdeveloptool 2 go into root of rkdeveloptool
3 make && make install 3 autoreconf -i
4 ./configure
5 make
rkdeveloptool usage,input "rkdeveloptool -h" to see rkdeveloptool usage,input "rkdeveloptool -h" to see

6
cfg/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
compile
config*
depcomp
install*
missing
stamp*

6
cfg/Makefile.am Normal file
View File

@ -0,0 +1,6 @@
## Copyright (C) 2017 Trevor Woerner <twoerner@gmail.com>
########################
# cfg/Makefile.am
########################
SUBDIRS =

24
configure.ac Normal file
View File

@ -0,0 +1,24 @@
dnl Copyright (C) 2017 Trevor Woerner <twoerner@gmail.com>
AC_INIT([Rockchip rkdeveloptool], 1.0, [Eddie Cai <eddie.cai.linux@gmail.com>], 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