1858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes#
2858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes# Copyright (C) 2006 The Android Open Source Project
3858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes#
4858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes# Licensed under the Apache License, Version 2.0 (the "License");
5858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes# you may not use this file except in compliance with the License.
6858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes# You may obtain a copy of the License at
7858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes#
8858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes#      http://www.apache.org/licenses/LICENSE-2.0
9858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes#
10858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes# Unless required by applicable law or agreed to in writing, software
11858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes# distributed under the License is distributed on an "AS IS" BASIS,
12858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes# See the License for the specific language governing permissions and
14858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes# limitations under the License.
15858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes#
16858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes
17858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott HughesLOCAL_PATH := $(call my-dir)
187c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes
194e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes#
204e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes# To update:
214e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes#
224e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes
2360b6d90b1f9d018f450462e57906b538071eec3cElliott Hughes#  git remote add strace git://git.code.sf.net/p/strace/code
244e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes#  git fetch strace
254e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes#  git merge strace/master
264e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes#  mm -j32
274e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes#  # (Make any necessary Android.mk changes and test the new strace.)
2860b6d90b1f9d018f450462e57906b538071eec3cElliott Hughes#  git push aosp HEAD:master  # Push directly, avoiding gerrit.
2960b6d90b1f9d018f450462e57906b538071eec3cElliott Hughes#  git push aosp HEAD:refs/for/master  # Push to gerrit.
304e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes#
314e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes#  # Now commit any necessary Android.mk changes like normal:
324e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes#  repo start post-sync .
334e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes#  git commit -a
344e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes#
354e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes
367c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes# -------------------------------------------------------------------------
377c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes
3834d6eabc451f16d5f168fc1595ee604f21bccc51The Android Open Source Projectinclude $(CLEAR_VARS)
3934d6eabc451f16d5f168fc1595ee604f21bccc51The Android Open Source Project
4015fc6a2add5cc636435b120075d2c27637528b11Elliott Hughesstrace_version := $(shell grep Version $(LOCAL_PATH)/strace.spec | cut -d " " -f 2)
41bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes
42bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott HughesLOCAL_SRC_FILES := \
435dec78d0c2663930cd1bbcecbbcee47f68bc52f3Elliott Hughes    aio.c \
44bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    bjm.c \
45bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    block.c \
46bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    count.c \
47bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    desc.c \
485dec78d0c2663930cd1bbcecbbcee47f68bc52f3Elliott Hughes    fanotify.c \
49bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    file.c \
505dec78d0c2663930cd1bbcecbbcee47f68bc52f3Elliott Hughes    inotify.c \
51bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    io.c \
52bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    ioctl.c \
535dec78d0c2663930cd1bbcecbbcee47f68bc52f3Elliott Hughes    ioprio.c \
54bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    ipc.c \
555dec78d0c2663930cd1bbcecbbcee47f68bc52f3Elliott Hughes    kexec.c \
565dec78d0c2663930cd1bbcecbbcee47f68bc52f3Elliott Hughes    keyctl.c \
5751505679672392bcbfb4a7d844a0131f8461aec4Elliott Hughes    ldt.c \
58bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    loop.c \
59bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    mem.c \
60bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    mtd.c \
61bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    net.c \
62bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    pathtrace.c \
63bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    process.c \
645dec78d0c2663930cd1bbcecbbcee47f68bc52f3Elliott Hughes    ptp.c \
65bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    quota.c \
665dec78d0c2663930cd1bbcecbbcee47f68bc52f3Elliott Hughes    reboot.c \
67bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    resource.c \
685dec78d0c2663930cd1bbcecbbcee47f68bc52f3Elliott Hughes    scsi.c \
69bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    signal.c \
70bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    sock.c \
71bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    strace.c \
72bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    stream.c \
73bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    syscall.c \
74bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    system.c \
75bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    term.c \
76bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    time.c \
77bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    util.c \
785dec78d0c2663930cd1bbcecbbcee47f68bc52f3Elliott Hughes    vsprintf.c \
7934d6eabc451f16d5f168fc1595ee604f21bccc51The Android Open Source Project
8034d6eabc451f16d5f168fc1595ee604f21bccc51The Android Open Source ProjectLOCAL_SHARED_LIBRARIES :=
8134d6eabc451f16d5f168fc1595ee604f21bccc51The Android Open Source Project
8215fc6a2add5cc636435b120075d2c27637528b11Elliott HughesLOCAL_CFLAGS := \
8315fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DGETGROUPS_T=gid_t \
8415fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_ASM_SIGCONTEXT_H=1 \
8515fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_PTRACE_EVENT_FORK=1 \
8615fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_PTRACE_EVENT_VFORK=1 \
8715fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_PTRACE_EVENT_CLONE=1 \
8815fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_PTRACE_EVENT_EXEC=1 \
8915fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_PTRACE_EVENT_VFORK_DONE=1 \
9015fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_PTRACE_EVENT_EXIT=1 \
9115fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_PTRACE_GETEVENTMSG=1 \
9215fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_PTRACE_GETSIGINFO=1 \
9315fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_PTRACE_O_TRACECLONE=1 \
9415fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_PTRACE_O_TRACEEXEC=1 \
9515fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_PTRACE_O_TRACEEXIT=1 \
9615fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_PTRACE_O_TRACEFORK=1 \
9715fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_PTRACE_O_TRACESYSGOOD=1 \
9815fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_PTRACE_O_TRACEVFORK=1 \
9915fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_PTRACE_SETOPTIONS=1 \
10015fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -UHAVE_DECL_IO_CMD_PWRITE \
10115fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -UHAVE_DECL_IO_CMD_PWRITEV \
10215fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -UHAVE_DECL_LO_FLAGS_AUTOCLEAR \
10315fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -UHAVE_DECL_LO_FLAGS_PARTSCAN \
10415fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_DECL_SYS_ERRLIST=1 \
105a7f55554b4b89cbab21a693c223c1a39641932ecElliott Hughes    -DHAVE_ELF_H=1 \
10615fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_FORK=1 \
10715fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_IF_INDEXTONAME=1 \
10815fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_INET_NTOP=1 \
10915fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_LINUX_CAPABILITY_H=1 \
11015fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_LINUX_ICMP_H=1 \
11115fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_LINUX_IF_PACKET_H=1 \
11215fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_LINUX_IN6_H=1 \
11315fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_LINUX_NETLINK_H=1 \
11415fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_LITTLE_ENDIAN_LONG_LONG=1 \
11515fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_LONG_LONG=1 \
11615fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_NETINET_TCP_H=1 \
11715fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_NETINET_UDP_H=1 \
11815fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_POLL_H=1 \
11915fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_PRCTL=1 \
12015fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_SENDMSG=1 \
12115fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_SIGACTION=1 \
12215fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_SIGINFO_T=1 \
12315fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_SIG_ATOMIC_T=1 \
12415fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_STATFS64=1 \
12515fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_STDBOOL_H=1 \
12615fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_STRERROR=1 \
1275dec78d0c2663930cd1bbcecbbcee47f68bc52f3Elliott Hughes    -DHAVE_STRUCT_FLOCK64=1 \
12815fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_STRUCT_MSGHDR_MSG_CONTROL=1 \
1294e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes    -DHAVE_STRUCT_SIGCONTEXT=1 \
1304e779b4c67380f09ecebc5ec9cd0f4beb9d786e7Elliott Hughes    -DHAVE_STRUCT_SIGEVENT__SIGEV_UN__PAD=1 \
13115fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID=1 \
13215fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_STRUCT_STAT_ST_BLKSIZE=1 \
13315fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_STRUCT_STAT_ST_BLOCKS=1 \
13415fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_STRUCT_STAT_ST_RDEV=1 \
13515fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_STRUCT_USER_DESC=1 \
13615fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_SYS_EPOLL_H=1 \
13715fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_SYS_IOCTL_H=1 \
13815fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_SYS_POLL_H=1 \
13915fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_SYS_REG_H=1 \
14015fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DHAVE_SYS_VFS_H=1 \
14115fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DMAJOR_IN_SYSMACROS \
14215fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DPACKAGE_NAME='"strace"' \
14315fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DVERSION='"$(strace_version)"' \
144556f9aede01e3512b96efe452d3488f88065a3f2Elliott Hughes    -DSIZEOF_OFF_T=SIZEOF_LONG \
14515fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DSIZEOF_LONG_LONG=8 \
14615fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -DSTDC_HEADERS=1 \
1475dec78d0c2663930cd1bbcecbbcee47f68bc52f3Elliott Hughes    -DSTRACE_KNOWS_ONLY_EABI=1 \
14815fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    -D_LFS64_LARGEFILE=1 \
14915fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes
15015fc6a2add5cc636435b120075d2c27637528b11Elliott HughesLOCAL_CFLAGS += -D_GNU_SOURCE=1 -D_POSIX_SOURCE=1
151bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes
1524ce18c8914f3c2b501abeae4c68bfad667a3fcc0Elliott HughesLOCAL_CFLAGS_32 += -DSIZEOF_LONG=4 -DSIZEOF_RLIM_T=4 -DHAVE_STAT64=1
153d6b039cc23d8da969290924a9379cbe10633c292Colin CrossLOCAL_CFLAGS_64 += -DSIZEOF_LONG=8 -DSIZEOF_RLIM_T=8
154d6b039cc23d8da969290924a9379cbe10633c292Colin Cross
155d6b039cc23d8da969290924a9379cbe10633c292Colin CrossLOCAL_CFLAGS_arm += -DARM=1
156d6b039cc23d8da969290924a9379cbe10633c292Colin CrossLOCAL_CFLAGS_arm += -DHAVE_STRUCT___OLD_KERNEL_STAT=1
157d6b039cc23d8da969290924a9379cbe10633c292Colin Cross
158d6b039cc23d8da969290924a9379cbe10633c292Colin CrossLOCAL_CFLAGS_arm64 += -DAARCH64=1
159d6b039cc23d8da969290924a9379cbe10633c292Colin Cross
160d6b039cc23d8da969290924a9379cbe10633c292Colin CrossLOCAL_CFLAGS_mips += -DMIPS=1
161d6b039cc23d8da969290924a9379cbe10633c292Colin CrossLOCAL_CFLAGS_mips += -DHAVE_ASM_SYSMIPS_H=1
162d6b039cc23d8da969290924a9379cbe10633c292Colin Cross
163d6b039cc23d8da969290924a9379cbe10633c292Colin CrossLOCAL_CFLAGS_x86 += -DI386=1
164d6b039cc23d8da969290924a9379cbe10633c292Colin CrossLOCAL_CFLAGS_x86 += -DHAVE_STRUCT___OLD_KERNEL_STAT=1
165d6b039cc23d8da969290924a9379cbe10633c292Colin Cross
1664ce18c8914f3c2b501abeae4c68bfad667a3fcc0Elliott HughesLOCAL_CFLAGS_x86_64 += -DX86_64=1
167a0b125c9afa56cc094f215fba1501aed5bbf9b66Lorenzo Colitti
168bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott HughesLOCAL_CFLAGS += \
16910bd42d0e743697d1b541eac35d7889f17d70ca6Elliott Hughes    -Wall \
170bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    -Wno-missing-field-initializers \
171bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    -Wno-unused-parameter \
172bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes    -Wno-sign-compare \
173f76f96e20f766e6bb91593885b1e800f8bc14a52Jeff Brown
17434d6eabc451f16d5f168fc1595ee604f21bccc51The Android Open Source ProjectLOCAL_C_INCLUDES := \
17515fc6a2add5cc636435b120075d2c27637528b11Elliott Hughes    $(LOCAL_PATH)/linux
17634d6eabc451f16d5f168fc1595ee604f21bccc51The Android Open Source Project
177d6b039cc23d8da969290924a9379cbe10633c292Colin CrossLOCAL_C_INCLUDES_arm := $(LOCAL_PATH)/linux/arm
178d6b039cc23d8da969290924a9379cbe10633c292Colin CrossLOCAL_C_INCLUDES_arm64 := $(LOCAL_PATH)/linux/aarch64
179d6b039cc23d8da969290924a9379cbe10633c292Colin CrossLOCAL_C_INCLUDES_mips := $(LOCAL_PATH)/linux/mips
1802cafa72cabf136b1ba42ef199b56de6dbdd71a10Duane SandLOCAL_C_INCLUDES_mips64 := $(LOCAL_PATH)/linux/mips
181d6b039cc23d8da969290924a9379cbe10633c292Colin CrossLOCAL_C_INCLUDES_x86 := $(LOCAL_PATH)/linux/i386
182d6b039cc23d8da969290924a9379cbe10633c292Colin CrossLOCAL_C_INCLUDES_x86_64 := $(LOCAL_PATH)/linux/x86_64
183d6b039cc23d8da969290924a9379cbe10633c292Colin Cross
18434d6eabc451f16d5f168fc1595ee604f21bccc51The Android Open Source ProjectLOCAL_MODULE := strace
18534d6eabc451f16d5f168fc1595ee604f21bccc51The Android Open Source Project
18634d6eabc451f16d5f168fc1595ee604f21bccc51The Android Open Source ProjectLOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
18734d6eabc451f16d5f168fc1595ee604f21bccc51The Android Open Source Project
18834d6eabc451f16d5f168fc1595ee604f21bccc51The Android Open Source ProjectLOCAL_MODULE_TAGS := debug
18934d6eabc451f16d5f168fc1595ee604f21bccc51The Android Open Source Project
190bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott HughesLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
191bb0c2d52fc596f5e21652486c0b6a0b3e3b7e4cbElliott Hughes
19234d6eabc451f16d5f168fc1595ee604f21bccc51The Android Open Source Projectinclude $(BUILD_EXECUTABLE)
1937c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes
194858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughes
1957c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes# -------------------------------------------------------------------------
1967c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes
1977c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes.PHONY: update-ioctls
1987c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughesupdate-ioctls:
1997c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes	# Build the generated .h files needed by ioctlsort from the current bionic uapi headers.
2007c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes	cd external/strace; ./linux/ioctlent.sh ../../bionic/libc/kernel/uapi/
2017c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes	# Build the ioctlsort tool.
2027c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes	ONE_SHOT_MAKEFILE=external/strace/Android.mk make -f build/core/main.mk $(TARGET_OUT_EXECUTABLES)/ioctlsort
2037c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes	# Remove the generated .h files now we've built ioctlsort.
2047c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes	rm external/strace/ioctls.h external/strace/ioctldefs.h
2057c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes	# Run the ioctlsort tool on the target to generate the one file we do want to check in.
2067c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes	adb sync
2077c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes	adb shell ioctlsort | tr -d '\r' > external/strace/linux/ioctlent.h
2087c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes	# Rebuild strace with the new "ioctlent.h".
2097c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes	ONE_SHOT_MAKEFILE=external/strace/Android.mk make -f build/core/main.mk
2107c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes
2117c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes# We don't build ioctlsort unless really necessary, because we don't check
2127c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes# in the temporary files needed to build it. This tool is only necessary
2137c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes# when updating strace's list of ioctls.
21416488d563909b0a6e151da77a14e3f742b68f272Elliott Hughesifneq (,$(filter $(TARGET_OUT_EXECUTABLES)/ioctlsort,$(MAKECMDGOALS)))
2157c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughesinclude $(CLEAR_VARS)
2167c5383286e1ab88ef2b871ca02286fcddc232734Elliott HughesLOCAL_SRC_FILES := linux/ioctlsort.c
2177c5383286e1ab88ef2b871ca02286fcddc232734Elliott HughesLOCAL_CFLAGS += -include asm/types.h -include linux/ashmem.h
2187c5383286e1ab88ef2b871ca02286fcddc232734Elliott HughesLOCAL_CFLAGS += -Wno-unused-parameter
2197c5383286e1ab88ef2b871ca02286fcddc232734Elliott HughesLOCAL_MODULE := ioctlsort
2207c5383286e1ab88ef2b871ca02286fcddc232734Elliott HughesLOCAL_MODULE_TAGS := optional
2217c5383286e1ab88ef2b871ca02286fcddc232734Elliott HughesLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
2227c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughesinclude $(BUILD_EXECUTABLE)
2237c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughesendif
2247c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes
2257c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes# -------------------------------------------------------------------------
2267c5383286e1ab88ef2b871ca02286fcddc232734Elliott Hughes
227858a5c77bfa0aef527442d66432ab217b2e9beb8Elliott Hughesinclude $(LOCAL_PATH)/test/Android.mk
228