The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | LOCAL_PATH:= $(call my-dir) |
Elliott Hughes | 5054c0d | 2014-07-22 10:46:15 -0700 | [diff] [blame] | 2 | |
| 3 | common_cflags := \ |
Andreas Gampe | 3294ad1 | 2015-07-30 11:46:30 -0700 | [diff] [blame] | 4 | -Werror -Wno-unused-parameter -Wno-unused-const-variable \ |
Elliott Hughes | 5054c0d | 2014-07-22 10:46:15 -0700 | [diff] [blame] | 5 | -include bsd-compatibility.h \ |
| 6 | |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 7 | include $(CLEAR_VARS) |
| 8 | |
| 9 | BSD_TOOLS := \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 10 | dd \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 11 | |
| 12 | OUR_TOOLS := \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 13 | getevent \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 14 | newfs_msdos \ |
Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 15 | |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 16 | ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS) |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 17 | |
| 18 | LOCAL_SRC_FILES := \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 19 | toolbox.c \ |
Elliott Hughes | d20218e | 2015-02-04 18:50:14 -0800 | [diff] [blame] | 20 | $(patsubst %,%.c,$(OUR_TOOLS)) \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 21 | |
Elliott Hughes | 5054c0d | 2014-07-22 10:46:15 -0700 | [diff] [blame] | 22 | LOCAL_CFLAGS += $(common_cflags) |
Dan Willemsen | ee2da03 | 2016-05-25 13:19:49 -0700 | [diff] [blame] | 23 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/upstream-netbsd/include/ |
Elliott Hughes | ccecf14 | 2014-01-16 10:53:11 -0800 | [diff] [blame] | 24 | |
Kenny Root | b83c098 | 2012-10-10 11:26:33 -0700 | [diff] [blame] | 25 | LOCAL_SHARED_LIBRARIES := \ |
Elliott Hughes | 7fc4712 | 2014-06-07 21:53:04 -0700 | [diff] [blame] | 26 | libcutils \ |
Elliott Hughes | 7fc4712 | 2014-06-07 21:53:04 -0700 | [diff] [blame] | 27 | |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 28 | LOCAL_WHOLE_STATIC_LIBRARIES := $(patsubst %,libtoolbox_%,$(BSD_TOOLS)) |
Elliott Hughes | 5054c0d | 2014-07-22 10:46:15 -0700 | [diff] [blame] | 29 | |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 30 | LOCAL_MODULE := toolbox |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 31 | |
Ying Wang | 7d45be0 | 2014-11-24 12:40:32 -0800 | [diff] [blame] | 32 | # Install the symlinks. |
| 33 | LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toolbox $(TARGET_OUT)/bin/$(t);) |
| 34 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 35 | # Including this will define $(intermediates). |
| 36 | # |
| 37 | include $(BUILD_EXECUTABLE) |
| 38 | |
| 39 | $(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h |
| 40 | |
| 41 | TOOLS_H := $(intermediates)/tools.h |
Elliott Hughes | ad2c07e | 2016-04-11 13:25:25 -0700 | [diff] [blame] | 42 | $(TOOLS_H): PRIVATE_TOOLS := toolbox $(ALL_TOOLS) |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 43 | $(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done |
| 44 | $(TOOLS_H): $(LOCAL_PATH)/Android.mk |
| 45 | $(TOOLS_H): |
| 46 | $(transform-generated-source) |
| 47 | |
Elliott Hughes | c7f3c5c | 2015-03-25 16:40:13 -0700 | [diff] [blame] | 48 | $(LOCAL_PATH)/getevent.c: $(intermediates)/input.h-labels.h |
| 49 | |
Elliott Hughes | b22b998 | 2016-06-29 14:12:29 -0700 | [diff] [blame] | 50 | UAPI_INPUT_EVENT_CODES_H := bionic/libc/kernel/uapi/linux/input.h bionic/libc/kernel/uapi/linux/input-event-codes.h |
Elliott Hughes | c7f3c5c | 2015-03-25 16:40:13 -0700 | [diff] [blame] | 51 | INPUT_H_LABELS_H := $(intermediates)/input.h-labels.h |
| 52 | $(INPUT_H_LABELS_H): PRIVATE_LOCAL_PATH := $(LOCAL_PATH) |
Elliott Hughes | bd02a47 | 2016-02-08 14:09:10 -0800 | [diff] [blame] | 53 | # The PRIVATE_CUSTOM_TOOL line uses = to evaluate the output path late. |
| 54 | # We copy the input path so it can't be accidentally modified later. |
| 55 | $(INPUT_H_LABELS_H): PRIVATE_UAPI_INPUT_EVENT_CODES_H := $(UAPI_INPUT_EVENT_CODES_H) |
| 56 | $(INPUT_H_LABELS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/generate-input.h-labels.py $(PRIVATE_UAPI_INPUT_EVENT_CODES_H) > $@ |
| 57 | # The dependency line though gets evaluated now, so the PRIVATE_ copy doesn't exist yet, |
| 58 | # and the original can't yet have been modified, so this is both sufficient and necessary. |
| 59 | $(INPUT_H_LABELS_H): $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/generate-input.h-labels.py $(UAPI_INPUT_EVENT_CODES_H) |
Elliott Hughes | c7f3c5c | 2015-03-25 16:40:13 -0700 | [diff] [blame] | 60 | $(INPUT_H_LABELS_H): |
| 61 | $(transform-generated-source) |