Home | History | Annotate | Download | only in toolbox
      1 LOCAL_PATH:= $(call my-dir)
      2 
      3 
      4 common_cflags := \
      5     -Werror -Wno-unused-parameter -Wno-unused-const-variable \
      6     -include bsd-compatibility.h \
      7 
      8 
      9 include $(CLEAR_VARS)
     10 LOCAL_SRC_FILES := \
     11     upstream-netbsd/bin/dd/args.c \
     12     upstream-netbsd/bin/dd/conv.c \
     13     upstream-netbsd/bin/dd/dd.c \
     14     upstream-netbsd/bin/dd/dd_hostops.c \
     15     upstream-netbsd/bin/dd/misc.c \
     16     upstream-netbsd/bin/dd/position.c \
     17     upstream-netbsd/lib/libc/gen/getbsize.c \
     18     upstream-netbsd/lib/libc/gen/humanize_number.c \
     19     upstream-netbsd/lib/libc/stdlib/strsuftoll.c \
     20     upstream-netbsd/lib/libc/string/swab.c \
     21     upstream-netbsd/lib/libutil/raise_default_signal.c
     22 LOCAL_CFLAGS += $(common_cflags) -Dmain=dd_main -DNO_CONV
     23 LOCAL_C_INCLUDES += $(LOCAL_PATH)/upstream-netbsd/include/
     24 LOCAL_MODULE := libtoolbox_dd
     25 include $(BUILD_STATIC_LIBRARY)
     26 
     27 
     28 include $(CLEAR_VARS)
     29 
     30 BSD_TOOLS := \
     31     dd \
     32 
     33 OUR_TOOLS := \
     34     getevent \
     35     newfs_msdos \
     36 
     37 ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS)
     38 
     39 LOCAL_SRC_FILES := \
     40     toolbox.c \
     41     $(patsubst %,%.c,$(OUR_TOOLS)) \
     42 
     43 LOCAL_CFLAGS += $(common_cflags)
     44 LOCAL_C_INCLUDES += $(LOCAL_PATH)/upstream-netbsd/include/
     45 
     46 LOCAL_SHARED_LIBRARIES := \
     47     libcutils \
     48 
     49 LOCAL_WHOLE_STATIC_LIBRARIES := $(patsubst %,libtoolbox_%,$(BSD_TOOLS))
     50 
     51 LOCAL_MODULE := toolbox
     52 
     53 # Install the symlinks.
     54 LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toolbox $(TARGET_OUT)/bin/$(t);)
     55 
     56 # Including this will define $(intermediates).
     57 #
     58 include $(BUILD_EXECUTABLE)
     59 
     60 $(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h
     61 
     62 TOOLS_H := $(intermediates)/tools.h
     63 $(TOOLS_H): PRIVATE_TOOLS := toolbox $(ALL_TOOLS)
     64 $(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done
     65 $(TOOLS_H): $(LOCAL_PATH)/Android.mk
     66 $(TOOLS_H):
     67 	$(transform-generated-source)
     68 
     69 $(LOCAL_PATH)/getevent.c: $(intermediates)/input.h-labels.h
     70 
     71 UAPI_INPUT_EVENT_CODES_H := bionic/libc/kernel/uapi/linux/input.h bionic/libc/kernel/uapi/linux/input-event-codes.h
     72 INPUT_H_LABELS_H := $(intermediates)/input.h-labels.h
     73 $(INPUT_H_LABELS_H): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
     74 # The PRIVATE_CUSTOM_TOOL line uses = to evaluate the output path late.
     75 # We copy the input path so it can't be accidentally modified later.
     76 $(INPUT_H_LABELS_H): PRIVATE_UAPI_INPUT_EVENT_CODES_H := $(UAPI_INPUT_EVENT_CODES_H)
     77 $(INPUT_H_LABELS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/generate-input.h-labels.py $(PRIVATE_UAPI_INPUT_EVENT_CODES_H) > $@
     78 # The dependency line though gets evaluated now, so the PRIVATE_ copy doesn't exist yet,
     79 # and the original can't yet have been modified, so this is both sufficient and necessary.
     80 $(INPUT_H_LABELS_H): $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/generate-input.h-labels.py $(UAPI_INPUT_EVENT_CODES_H)
     81 $(INPUT_H_LABELS_H):
     82 	$(transform-generated-source)
     83 
     84 
     85 # We build BSD grep separately, so it can provide egrep and fgrep too.
     86 include $(CLEAR_VARS)
     87 LOCAL_SRC_FILES := \
     88     upstream-netbsd/usr.bin/grep/fastgrep.c \
     89     upstream-netbsd/usr.bin/grep/file.c \
     90     upstream-netbsd/usr.bin/grep/grep.c \
     91     upstream-netbsd/usr.bin/grep/queue.c \
     92     upstream-netbsd/usr.bin/grep/util.c
     93 LOCAL_CFLAGS += $(common_cflags)
     94 LOCAL_C_INCLUDES += $(LOCAL_PATH)/upstream-netbsd/include/
     95 LOCAL_MODULE := grep
     96 LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,egrep fgrep,ln -sf grep $(TARGET_OUT)/bin/$(t);)
     97 include $(BUILD_EXECUTABLE)
     98