blob: d1b6114b09128e7554c3de610573ac4775f57c0c [file] [log] [blame]
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08001LOCAL_PATH:= $(call my-dir)
Elliott Hughes5054c0d2014-07-22 10:46:15 -07002
3common_cflags := \
Andreas Gampe3294ad12015-07-30 11:46:30 -07004 -Werror -Wno-unused-parameter -Wno-unused-const-variable \
Elliott Hughes5054c0d2014-07-22 10:46:15 -07005 -include bsd-compatibility.h \
6
Elliott Hughesfd4c6b02014-07-22 17:20:15 -07007include $(CLEAR_VARS)
8
9BSD_TOOLS := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070010 dd \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070011
12OUR_TOOLS := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070013 getevent \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070014 newfs_msdos \
Stephen Smalley8290d102012-01-13 08:53:56 -050015
Tom Cherryc73497e2018-01-02 11:50:16 -080016OUR_CPP_TOOLS := \
17 getprop \
18
19ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS) $(OUR_CPP_TOOLS)
Jeff Sharkey57df14c2012-07-13 16:25:33 -070020
21LOCAL_SRC_FILES := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070022 toolbox.c \
Elliott Hughesd20218e2015-02-04 18:50:14 -080023 $(patsubst %,%.c,$(OUR_TOOLS)) \
Tom Cherryc73497e2018-01-02 11:50:16 -080024 $(patsubst %,%.cpp,$(OUR_CPP_TOOLS)) \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080025
Elliott Hughes5054c0d2014-07-22 10:46:15 -070026LOCAL_CFLAGS += $(common_cflags)
Tom Cherryc73497e2018-01-02 11:50:16 -080027LOCAL_CPPFLAGS += -std=gnu++1z
Dan Willemsenee2da032016-05-25 13:19:49 -070028LOCAL_C_INCLUDES += $(LOCAL_PATH)/upstream-netbsd/include/
Elliott Hughesccecf142014-01-16 10:53:11 -080029
Kenny Rootb83c0982012-10-10 11:26:33 -070030LOCAL_SHARED_LIBRARIES := \
Tom Cherryc73497e2018-01-02 11:50:16 -080031 libbase \
Elliott Hughes7fc47122014-06-07 21:53:04 -070032 libcutils \
Elliott Hughes7fc47122014-06-07 21:53:04 -070033
Tom Cherryc73497e2018-01-02 11:50:16 -080034LOCAL_STATIC_LIBRARIES := libpropertyinfoparser
35
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070036LOCAL_WHOLE_STATIC_LIBRARIES := $(patsubst %,libtoolbox_%,$(BSD_TOOLS))
Elliott Hughes5054c0d2014-07-22 10:46:15 -070037
Jeff Sharkey57df14c2012-07-13 16:25:33 -070038LOCAL_MODULE := toolbox
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080039
Ying Wang7d45be02014-11-24 12:40:32 -080040# Install the symlinks.
41LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toolbox $(TARGET_OUT)/bin/$(t);)
42
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080043# Including this will define $(intermediates).
44#
45include $(BUILD_EXECUTABLE)
46
47$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h
48
49TOOLS_H := $(intermediates)/tools.h
Elliott Hughesad2c07e2016-04-11 13:25:25 -070050$(TOOLS_H): PRIVATE_TOOLS := toolbox $(ALL_TOOLS)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080051$(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done
52$(TOOLS_H): $(LOCAL_PATH)/Android.mk
53$(TOOLS_H):
54 $(transform-generated-source)
55
Elliott Hughesc7f3c5c2015-03-25 16:40:13 -070056$(LOCAL_PATH)/getevent.c: $(intermediates)/input.h-labels.h
57
Elliott Hughesb22b9982016-06-29 14:12:29 -070058UAPI_INPUT_EVENT_CODES_H := bionic/libc/kernel/uapi/linux/input.h bionic/libc/kernel/uapi/linux/input-event-codes.h
Elliott Hughesc7f3c5c2015-03-25 16:40:13 -070059INPUT_H_LABELS_H := $(intermediates)/input.h-labels.h
60$(INPUT_H_LABELS_H): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
Elliott Hughesbd02a472016-02-08 14:09:10 -080061# The PRIVATE_CUSTOM_TOOL line uses = to evaluate the output path late.
62# We copy the input path so it can't be accidentally modified later.
63$(INPUT_H_LABELS_H): PRIVATE_UAPI_INPUT_EVENT_CODES_H := $(UAPI_INPUT_EVENT_CODES_H)
64$(INPUT_H_LABELS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/generate-input.h-labels.py $(PRIVATE_UAPI_INPUT_EVENT_CODES_H) > $@
65# The dependency line though gets evaluated now, so the PRIVATE_ copy doesn't exist yet,
66# and the original can't yet have been modified, so this is both sufficient and necessary.
67$(INPUT_H_LABELS_H): $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/generate-input.h-labels.py $(UAPI_INPUT_EVENT_CODES_H)
Elliott Hughesc7f3c5c2015-03-25 16:40:13 -070068$(INPUT_H_LABELS_H):
69 $(transform-generated-source)
Chris Fries4a166462017-11-02 10:03:10 -050070
71# We only want 'r' on userdebug and eng builds.
72include $(CLEAR_VARS)
73LOCAL_SRC_FILES := r.c
74LOCAL_CFLAGS += $(common_cflags)
75LOCAL_C_INCLUDES += $(LOCAL_PATH)/upstream-netbsd/include/
76LOCAL_MODULE := r
77LOCAL_MODULE_TAGS := debug
78include $(BUILD_EXECUTABLE)