forked from aosp-mirror/platform_system_core
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a configure script and support builddir != srcddir
Improve the non-Android Makefiles for adb to support a config.mk generated by the generated configure script, and also to support a builddir != srcdir setup if configure is run from a different directory. This allows the project to be built by a generic build system, see: https://people.gnome.org/~walters/build-api/build-api.md
- Loading branch information
Showing
7 changed files
with
196 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,53 @@ | ||
top_srcdir ?= . | ||
VPATH = $(top_srcdir) | ||
include $(top_srcdir)/include.mk | ||
|
||
SUBDIRS= \ | ||
adb \ | ||
adb/daemon \ | ||
base \ | ||
libcrypto_utils \ | ||
libcutils | ||
|
||
all: adb/adbd adbd.service | ||
|
||
libcutils/libcutils.a: libcutils/*.c libcutils/*.cpp | ||
make -C libcutils | ||
makefiles: | ||
@ts=$(top_srcdir); \ | ||
[ "$${ts#/}" = "$$ts" ] && ts=../$$ts; \ | ||
if [ "$(top_srcdir)" != "." ] ; then \ | ||
for d in $(SUBDIRS) ; do \ | ||
mkdir -p $$d ; \ | ||
if [ -e "$(top_srcdir)/$$d/Makefile" ] ; then \ | ||
echo "top_srcdir=$$ts" > $$d/Makefile; \ | ||
echo "top_builddir=.." >> $$d/Makefile; \ | ||
echo "include \$$(top_srcdir)/$$d/Makefile" >> $$d/Makefile; \ | ||
fi \ | ||
done ; \ | ||
fi | ||
|
||
base/libbase.a: base/*.cpp | ||
make -C base | ||
libcutils/libcutils.a: subdirs $(top_srcdir)/libcutils/*.c $(top_srcdir)/libcutils/*.cpp | ||
$(MAKE) -C libcutils | ||
|
||
libcrypto_utils/libcrypto_utils.a: libcrypto_utils/android_pubkey.c | ||
make -C libcrypto_utils | ||
base/libbase.a: subdirs $(top_srcdir)/base/*.cpp | ||
$(MAKE) -C base | ||
|
||
adb/adbd adb/xdg-adbd: libcutils/libcutils.a base/libbase.a libcrypto_utils/libcrypto_utils.a adb/*.cpp adb/xdg-adbd.c | ||
make -C adb | ||
libcrypto_utils/libcrypto_utils.a: subdirs libcrypto_utils/android_pubkey.c | ||
$(MAKE) -C libcrypto_utils | ||
|
||
clean: | ||
make -C libcutils clean | ||
make -C base clean | ||
make -C libcrypto_utils clean | ||
make -C adb clean | ||
adb/adbd adb/xdg-adbd: subdirs libcutils/libcutils.a base/libbase.a libcrypto_utils/libcrypto_utils.a $(top_srcdir)/adb/*.cpp adb/xdg-adbd.c | ||
$(MAKE) -C adb | ||
|
||
clean: subdirs | ||
$(MAKE) -C libcutils clean | ||
$(MAKE) -C base clean | ||
$(MAKE) -C libcrypto_utils clean | ||
$(MAKE) -C adb clean | ||
|
||
install: all | ||
install -d -m 0755 $(DESTDIR)/$(PREFIX)/sbin | ||
install -D -m 0755 adb/adbd $(DESTDIR)/$(PREFIX)/sbin/ | ||
install -D -m 0755 adb/xdg-adbd $(DESTDIR)/$(PREFIX)/sbin/ | ||
install -d -m 0755 $(DESTDIR)/$(PREFIX)/lib/systemd/system/ | ||
install -D -m 0755 adbd.service $(DESTDIR)/$(PREFIX)/lib/systemd/system/ | ||
install -d -m 0755 $(DESTDIR)$(sbindir) | ||
install -D -m 0755 adb/adbd $(DESTDIR)$(sbindir) | ||
install -D -m 0755 adb/xdg-adbd $(DESTDIR)$(sbindir) | ||
install -d -m 0755 $(DESTDIR)$(prefix)/lib/systemd/system/ | ||
install -D -m 0755 $(top_srcdir)/adbd.service $(DESTDIR)$(prefix)/lib/systemd/system/ | ||
|
||
.PHONY: subdirs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#!/bin/sh | ||
|
||
# This script provides basic compatibility with automake configure scripts | ||
# for use in automated build systems. See: | ||
# | ||
# https://people.gnome.org/~walters/docs/build-api.txt | ||
# | ||
|
||
print_help() { | ||
echo "--prefix=DIR Install files in DIR (default /usr)" | ||
echo "--libdir=DIR Install library files in DIR/tgt (default PREFIX/lib)" | ||
echo "--sysconfdir=DIR Install configuration files in DIR (default /etc)" | ||
echo "--datadir=DIR Install data files in DIR (default $PREFIX/share)" | ||
echo "--mandir=DIR Install configuration files in DIR (default DATADIR/man)" | ||
echo "--docdir=DIR Install documentation files in DIR (default DATADIR/doc/tgt)" | ||
echo "--sbindir=DIR Install binaries in DIR (default DATADIR/sbin)" | ||
echo "--disable-man Disable building and installing man pages" | ||
} | ||
|
||
top_srcdir=$(dirname $0) | ||
|
||
prefix=/usr | ||
exec_prefix='$(prefix)' | ||
bindir='$(prefix)/bin' | ||
sbindir='$(exec_prefix)/sbin' | ||
datadir='$(prefix)/share' | ||
mandir='$(datadir)/man' | ||
sysconfdir='$(prefix)/etc' | ||
CFLAGS='-O2 -g' | ||
CXXFLAGS='-O2 -g' | ||
|
||
while [ $# '>' 0 ] ; do | ||
option=`expr "$1" : '\([^=]*\)='` | ||
optarg= | ||
consume_next=false | ||
if [ x$option != x ]; then | ||
optarg=`expr "$1" : '[^=]*=\(.*\)'` | ||
shift | ||
else | ||
option=$1 | ||
shift | ||
if expr "$option" : '-' > /dev/null ; then | ||
consume_next=true | ||
optarg=$1 | ||
fi | ||
fi | ||
|
||
case $option in | ||
--prefix) | ||
prefix=$optarg | ||
;; | ||
--exec_prefix) | ||
exec_prefix=$optarg | ||
;; | ||
--sysconfdir) | ||
sysconfdir=$optarg | ||
;; | ||
--mandir) | ||
mandir=$optarg | ||
;; | ||
--datadir) | ||
docdir=$optarg | ||
;; | ||
--sbindir) | ||
mandir=$optarg | ||
;; | ||
CFLAGS) | ||
CFLAGS=$optarg | ||
;; | ||
CXXFLAGS) | ||
CXXFLAGS=$optarg | ||
;; | ||
--with-*|--without-*|--enable-*|--disable-*) | ||
consume_next=false | ||
;; | ||
--help) | ||
print_help | ||
exit | ||
;; | ||
esac | ||
|
||
if $consume_next ; then | ||
shift | ||
fi | ||
done | ||
|
||
cat > config.mk <<EOF | ||
prefix = $prefix | ||
exec_prefix = $exec_prefix | ||
sbindir = $sbindir | ||
bindir = $bindir | ||
datadir = $datadir | ||
mandir = $mandir | ||
sysconfdir = $sysconfdir | ||
OPT_CFLAGS = $CFLAGS | ||
OPT_CXXFLAGS = $CXXFLAGS | ||
EOF | ||
|
||
if [ "$(pwd)" != "$(cd $top_srcdir && pwd)" ] ; then | ||
cat > Makefile <<EOF | ||
top_srcdir = $top_srcdir | ||
include \$(top_srcdir)/Makefile | ||
EOF | ||
fi | ||
|
||
make makefiles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
top_builddir ?= $(top_srcdir) | ||
-include $(top_builddir)/config.mk | ||
|
||
prefix ?= /usr | ||
exec_prefix ?= $(prefix) | ||
bindir ?= $(prefix)/bin | ||
sbindir ?= $(exec_prefix)/sbin | ||
datadir ?= $(prefix)/share | ||
mandir ?= $(datadir)/man | ||
sysconfdir ?= $(prefix)/etc | ||
OPT_CFLAGS ?= -O2 -g | ||
OPT_CXXFLAGS ?= -O2 -g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters