blob: aa755ed7f3751f60865bbc6a0b2ef9d650ffaa19 [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
Elliott Hughesfd4c6b02014-07-22 17:20:15 -07003
Elliott Hughes5054c0d2014-07-22 10:46:15 -07004common_cflags := \
Andreas Gampe3294ad12015-07-30 11:46:30 -07005 -Werror -Wno-unused-parameter -Wno-unused-const-variable \
Elliott Hughes5054c0d2014-07-22 10:46:15 -07006 -include bsd-compatibility.h \
7
Elliott Hughesfd4c6b02014-07-22 17:20:15 -07008
9include $(CLEAR_VARS)
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070010LOCAL_SRC_FILES := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070011 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 \
Elliott Hughesd20218e2015-02-04 18:50:14 -080016 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
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070022LOCAL_CFLAGS += $(common_cflags) -Dmain=dd_main -DNO_CONV
Dan Willemsenee2da032016-05-25 13:19:49 -070023LOCAL_C_INCLUDES += $(LOCAL_PATH)/upstream-netbsd/include/
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070024LOCAL_MODULE := libtoolbox_dd
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070025include $(BUILD_STATIC_LIBRARY)
26
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070027
28include $(CLEAR_VARS)
29
30BSD_TOOLS := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070031 dd \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070032
33OUR_TOOLS := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070034 getevent \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070035 newfs_msdos \
Stephen Smalley8290d102012-01-13 08:53:56 -050036
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070037ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS)
Jeff Sharkey57df14c2012-07-13 16:25:33 -070038
39LOCAL_SRC_FILES := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070040 toolbox.c \
Elliott Hughesd20218e2015-02-04 18:50:14 -080041 $(patsubst %,%.c,$(OUR_TOOLS)) \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080042
Elliott Hughes5054c0d2014-07-22 10:46:15 -070043LOCAL_CFLAGS += $(common_cflags)
Dan Willemsenee2da032016-05-25 13:19:49 -070044LOCAL_C_INCLUDES += $(LOCAL_PATH)/upstream-netbsd/include/
Elliott Hughesccecf142014-01-16 10:53:11 -080045
Kenny Rootb83c0982012-10-10 11:26:33 -070046LOCAL_SHARED_LIBRARIES := \
Elliott Hughes7fc47122014-06-07 21:53:04 -070047 libcutils \
Elliott Hughes7fc47122014-06-07 21:53:04 -070048
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070049LOCAL_WHOLE_STATIC_LIBRARIES := $(patsubst %,libtoolbox_%,$(BSD_TOOLS))
Elliott Hughes5054c0d2014-07-22 10:46:15 -070050
Jeff Sharkey57df14c2012-07-13 16:25:33 -070051LOCAL_MODULE := toolbox
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080052
Ying Wang7d45be02014-11-24 12:40:32 -080053# Install the symlinks.
54LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toolbox $(TARGET_OUT)/bin/$(t);)
55
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080056# Including this will define $(intermediates).
57#
58include $(BUILD_EXECUTABLE)
59
60$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h
61
62TOOLS_H := $(intermediates)/tools.h
Elliott Hughesad2c07e2016-04-11 13:25:25 -070063$(TOOLS_H): PRIVATE_TOOLS := toolbox $(ALL_TOOLS)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080064$(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
Elliott Hughesc7f3c5c2015-03-25 16:40:13 -070069$(LOCAL_PATH)/getevent.c: $(intermediates)/input.h-labels.h
70
Elliott Hughesb22b9982016-06-29 14:12:29 -070071UAPI_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 -070072INPUT_H_LABELS_H := $(intermediates)/input.h-labels.h
73$(INPUT_H_LABELS_H): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
Elliott Hughesbd02a472016-02-08 14:09:10 -080074# 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)
Elliott Hughesc7f3c5c2015-03-25 16:40:13 -070081$(INPUT_H_LABELS_H):
82 $(transform-generated-source)
Elliott Hughes660e7502014-08-28 20:44:20 -070083
Elliott Hughesd20218e2015-02-04 18:50:14 -080084
85# We build BSD grep separately, so it can provide egrep and fgrep too.
86include $(CLEAR_VARS)
87LOCAL_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
93LOCAL_CFLAGS += $(common_cflags)
Dan Willemsenee2da032016-05-25 13:19:49 -070094LOCAL_C_INCLUDES += $(LOCAL_PATH)/upstream-netbsd/include/
Elliott Hughesd20218e2015-02-04 18:50:14 -080095LOCAL_MODULE := grep
96LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,egrep fgrep,ln -sf grep $(TARGET_OUT)/bin/$(t);)
97include $(BUILD_EXECUTABLE)
Elliott Hughes455567f2017-04-10 10:56:40 -070098
99
100# We build gzip separately, so it can provide gunzip and zcat too.
101include $(CLEAR_VARS)
102LOCAL_MODULE := gzip
103LOCAL_SRC_FILES := gzip.c
104LOCAL_CFLAGS += -Wall -Werror
105LOCAL_SHARED_LIBRARIES += libz
106LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,gunzip zcat,ln -sf gzip $(TARGET_OUT)/bin/$(t);)
107include $(BUILD_EXECUTABLE)