X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=Android.mk;h=f00bd772c5f1725c5d5313e090004ef84e0b1691;hb=d68bb2ea86444f0b3131ad0641e2e780456580c4;hp=8c112ced5a1dcd74a7b0de80abf572e9f1b595a2;hpb=545322e487d010f921adc23f64da1a188728fd36;p=android-x86%2Fexternal-toybox.git diff --git a/Android.mk b/Android.mk index 8c112ced..f00bd772 100644 --- a/Android.mk +++ b/Android.mk @@ -16,6 +16,24 @@ LOCAL_PATH := $(call my-dir) +common_cflags := \ + -std=c99 \ + -Os \ + -Wno-char-subscripts \ + -Wno-sign-compare \ + -Wno-string-plus-int \ + -Wno-uninitialized \ + -Wno-unused-parameter \ + -funsigned-char \ + -ffunction-sections -fdata-sections \ + -fno-asynchronous-unwind-tables \ + +toybox_upstream_version := $(shell awk 'match($$0, /TOYBOX_VERSION.*"(.*)"/, ary) {print ary[1]}' $(LOCAL_PATH)/main.c) +toybox_sha := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null) + +toybox_version := $(toybox_upstream_version)-$(toybox_sha)-android +common_cflags += -DTOYBOX_VERSION='"$(toybox_version)"' + # # To update: # @@ -57,6 +75,7 @@ LOCAL_SRC_FILES := \ lib/linestack.c \ lib/llist.c \ lib/net.c \ + lib/password.c \ lib/portability.c \ lib/xwrap.c \ main.c \ @@ -101,6 +120,7 @@ LOCAL_SRC_FILES := \ toys/other/losetup.c \ toys/other/lsattr.c \ toys/other/lsmod.c \ + toys/other/lspci.c \ toys/other/lsusb.c \ toys/other/makedevs.c \ toys/other/mkswap.c \ @@ -113,8 +133,10 @@ LOCAL_SRC_FILES := \ toys/other/pmap.c \ toys/other/printenv.c \ toys/other/pwdx.c \ + toys/other/readahead.c \ toys/other/readlink.c \ toys/other/realpath.c \ + toys/other/reset.c \ toys/other/rev.c \ toys/other/rfkill.c \ toys/other/rmmod.c \ @@ -135,15 +157,26 @@ LOCAL_SRC_FILES := \ toys/other/which.c \ toys/other/xxd.c \ toys/other/yes.c \ + toys/pending/arp.c \ toys/pending/dd.c \ + toys/pending/diff.c \ toys/pending/expr.c \ + toys/pending/fdisk.c \ + toys/pending/file.c \ + toys/pending/ftpget.c \ + toys/pending/host.c \ toys/pending/lsof.c \ toys/pending/more.c \ toys/pending/netstat.c \ + toys/pending/resize.c \ toys/pending/route.c \ toys/pending/tar.c \ + toys/pending/telnet.c \ + toys/pending/test.c \ toys/pending/tr.c \ toys/pending/traceroute.c \ + toys/pending/watch.c \ + toys/pending/xzcat.c \ toys/posix/basename.c \ toys/posix/cal.c \ toys/posix/cat.c \ @@ -195,177 +228,94 @@ LOCAL_SRC_FILES := \ toys/posix/touch.c \ toys/posix/true.c \ toys/posix/tty.c \ + toys/posix/ulimit.c \ toys/posix/uname.c \ toys/posix/uniq.c \ toys/posix/wc.c \ - toys/posix/xargs.c \ + toys/posix/xargs.c -LOCAL_CFLAGS += \ - -std=c99 \ - -Os \ - -Wno-char-subscripts \ - -Wno-sign-compare \ - -Wno-string-plus-int \ - -Wno-uninitialized \ - -Wno-unused-parameter \ - -funsigned-char \ - -ffunction-sections -fdata-sections \ - -fno-asynchronous-unwind-tables \ +LOCAL_CFLAGS := $(common_cflags) +LOCAL_CLANG := true -toybox_upstream_version := $(shell awk 'match($$0, /TOYBOX_VERSION.*"(.*)"/, ary) {print ary[1]}' $(LOCAL_PATH)/main.c) -toybox_sha := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null) +# This doesn't actually prevent us from dragging in libc++ at runtime +# because libnetd_client.so is C++. +LOCAL_CXX_STL := none -toybox_version := $(toybox_upstream_version)-$(toybox_sha)-android -LOCAL_CFLAGS += -DTOYBOX_VERSION='"$(toybox_version)"' +LOCAL_C_INCLUDES += bionic/libc/dns/include + +LOCAL_MODULE := libtoybox + +include $(BUILD_STATIC_LIBRARY) + +# Host binary to enumerate the toys +include $(CLEAR_VARS) +LOCAL_SRC_FILES := scripts/install.c +LOCAL_MODULE_TAGS := optional +LOCAL_CFLAGS := $(common_cflags) LOCAL_CLANG := true +LOCAL_MODULE := toybox-instlist +include $(BUILD_HOST_EXECUTABLE) -LOCAL_SHARED_LIBRARIES := libcutils libselinux -# This doesn't actually prevent us from dragging in libc++ at runtime -# because libnetd_client.so is C++. +include $(CLEAR_VARS) +LOCAL_SRC_FILES := main.c +LOCAL_STATIC_LIBRARIES := libtoybox +LOCAL_SHARED_LIBRARIES := libcutils libselinux +LOCAL_CFLAGS := $(common_cflags) LOCAL_CXX_STL := none - +LOCAL_CLANG := true LOCAL_MODULE := toybox -# dupes: dd -# useless?: freeramdisk fsfreeze install makedevs mkfifo nbd-client -# partprobe pivot_root pwdx rev rfkill switch_root vconfig -# prefer BSD netcat instead?: nc netcat -# prefer efs2progs instead?: blkid chattr lsattr +# for dumping the list of toys +TOYBOX_INSTLIST := $(HOST_OUT_EXECUTABLES)/toybox-instlist +LOCAL_ADDITIONAL_DEPENDENCIES := toybox_links -ALL_TOOLS := \ - acpi \ - base64 \ - basename \ - blockdev \ - bzcat \ - cal \ - cat \ - chcon \ - chgrp \ - chmod \ - chown \ - chroot \ - cksum \ - clear \ - comm \ - cmp \ - cp \ - cpio \ - cut \ - date \ - df \ - dirname \ - dmesg \ - dos2unix \ - du \ - echo \ - env \ - expand \ - expr \ - fallocate \ - false \ - find \ - flock \ - free \ - getenforce \ - getprop \ - groups \ - head \ - hostname \ - hwclock \ - id \ - ifconfig \ - inotifyd \ - insmod \ - ionice \ - iorenice \ - kill \ - killall \ - load_policy \ - ln \ - logname \ - losetup \ - ls \ - lsmod \ - lsof \ - lsusb \ - md5sum \ - mkdir \ - mknod \ - mkswap \ - mktemp \ - modinfo \ - more \ - mount \ - mountpoint \ - mv \ - netstat \ - nice \ - nl \ - nohup \ - od \ - paste \ - patch \ - pgrep \ - pidof \ - pkill \ - pmap \ - printenv \ - printf \ - pwd \ - readlink \ - realpath \ - renice \ - restorecon \ - rm \ - rmdir \ - rmmod \ - route \ - runcon \ - sed \ - seq \ - setenforce \ - setprop \ - setsid \ - sha1sum \ - sleep \ - sort \ - split \ - stat \ - strings \ - swapoff \ - swapon \ - sync \ - sysctl \ - tac \ - tail \ - tar \ - taskset \ - tee \ - time \ - timeout \ - touch \ - tr \ - true \ - truncate \ - tty \ - umount \ - uname \ - uniq \ - unix2dos \ - uptime \ - usleep \ - vmstat \ - wc \ - which \ - whoami \ - xargs \ - xxd \ - yes \ +# we still want a link for ls/ps, but the toolbox version needs to +# stick around for compatibility reasons, for now. +TOYS_FOR_XBIN := ls ps -# Install the symlinks. -LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);) +# skip links for these toys in the system image, they already have +# a full-blown counterpart. we still want them for the recovery +# image though. +TOYS_WITHOUT_LINKS := blkid + +include $(BUILD_EXECUTABLE) +toybox_links: $(TOYBOX_INSTLIST) toybox +toybox_links: TOY_LIST=$(shell $(TOYBOX_INSTLIST)) +toybox_links: TOYBOX_BINARY := $(TARGET_OUT)/bin/toybox +toybox_links: + @echo -e ${CL_CYN}"Generate Toybox links:"${CL_RST} $(TOY_LIST) + @mkdir -p $(TARGET_OUT)/bin + @mkdir -p $(TARGET_OUT)/xbin + $(hide) $(foreach t,$(filter-out $(TOYS_FOR_XBIN) $(TOYS_WITHOUT_LINKS),$(TOY_LIST)),ln -sf toybox $(TARGET_OUT_EXECUTABLES)/$(t);) + $(hide) $(foreach t,$(TOYS_FOR_XBIN),ln -sf /system/bin/toybox $(TARGET_OUT_OPTIONAL_EXECUTABLES)/$(t);) + + +# This is used by the recovery system +include $(CLEAR_VARS) +LOCAL_SRC_FILES := main.c +LOCAL_WHOLE_STATIC_LIBRARIES := libtoybox +LOCAL_CFLAGS := $(common_cflags) +LOCAL_CFLAGS += -Dmain=toybox_driver +LOCAL_CXX_STL := none +LOCAL_CLANG := true +LOCAL_MODULE := libtoybox_driver +include $(BUILD_STATIC_LIBRARY) + +# static executable for use in limited environments +include $(CLEAR_VARS) +LOCAL_SRC_FILES := main.c +LOCAL_CFLAGS := $(common_cflags) +LOCAL_CXX_STL := none +LOCAL_CLANG := true +LOCAL_UNSTRIPPED_PATH := $(PRODUCT_OUT)/symbols/utilities +LOCAL_MODULE := toybox_static +LOCAL_MODULE_CLASS := UTILITY_EXECUTABLES +LOCAL_MODULE_PATH := $(PRODUCT_OUT)/utilities +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_STEM := toybox +LOCAL_STATIC_LIBRARIES := libc libtoybox libcutils libselinux libmincrypt +LOCAL_FORCE_STATIC_EXECUTABLE := true include $(BUILD_EXECUTABLE)