summaryrefslogtreecommitdiff
path: root/cross/ndk-build/Makefile.in
blob: 8ba2d356f270eedab10811c1009711f22fc3325e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
### @configure_input@

# Copyright 2023-2024 Free Software Foundation, Inc.

# This file is part of GNU Emacs.

# GNU Emacs is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# GNU Emacs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.

# ndk-build works by including a bunch of Makefiles which set
# variables, and then having those Makefiles include another makefile
# which actually builds targets.

              srcdir = @srcdir@

# This is a list of Android.mk files which provide targets.
NDK_BUILD_ANDROID_MK = @NDK_BUILD_ANDROID_MK@
      NDK_BUILD_ARCH = @NDK_BUILD_ARCH@
       NDK_BUILD_ABI = @NDK_BUILD_ABI@
       NDK_BUILD_SDK = @NDK_BUILD_SDK@
        NDK_BUILD_CC = @NDK_BUILD_CC@
       NDK_BUILD_CXX = @NDK_BUILD_CXX@
        NDK_BUILD_AR = @NDK_BUILD_AR@
      NDK_BUILD_NASM = @NDK_BUILD_NASM@
    NDK_BUILD_CFLAGS = @NDK_BUILD_CFLAGS@

# This is a list of targets to build.
   NDK_BUILD_MODULES = @NDK_BUILD_MODULES@

# This is set by the Android in tree build system and is used by some
# libraries to look for the NDK.  Its value is unimportant.
	    NDK_ROOT = /tmp/

# Finally, here are rules common to Emacs.
.PHONY: all
all: $(NDK_BUILD_MODULES)

define uniqify
$(if $1,$(firstword $1) $(call uniqify,$(filter-out $(firstword $1),$1)))
endef

# Remove duplicate files.
NDK_BUILD_ANDROID_MK := $(call uniqify,$(NDK_BUILD_ANDROID_MK))

# Remove duplicate modules as well.  These can occur when a single
# module imports a module and also declares it in
# LOCAL_SHARED_LIBRARIES.
NDK_BUILD_MODULES := $(call uniqify,$(NDK_BUILD_MODULES))

# Define CFLAGS for compiling C++ code; this involves removing all
# -std=NNN options.
NDK_BUILD_CFLAGS_CXX := $(filter-out -std=%,$(NDK_BUILD_CFLAGS))

define subr-1

# Define ndk-build functions.  Many of these are identical to those in
# build-aux/ndk-build-helper.mk.

# NDK_LAST_MAKEFILE is the last Makefile that was included.
NDK_LAST_MAKEFILE = $$(lastword $$(filter %Android.mk,$$(MAKEFILE_LIST)))

# local-makefile is the current Makefile being loaded.
local-makefile = $$(NDK_LAST_MAKEFILE)

# my-dir is a function that returns the Android module directory.  If
# no Android.mk has been loaded, use the directory of the Makefile
# being included.
my-dir = $$(or $$(and $$(local-makefile),$$(dir $$(local-makefile))),$(dir $(1)))

# Return all Android.mk files under the first arg.
all-makefiles-under = $$(wildcard $$(1)/*/Android.mk)

# Return all Android.mk files in subdirectories of this Makefile's
# location.
all-subdir-makefiles = $$(call all-makefiles-under,$$(call my-dir))

# NDK-defined include variables.

CLEAR_VARS = $(srcdir)/ndk-clear-vars.mk
BUILD_EXECUTABLE = $(srcdir)/ndk-build-executable.mk
BUILD_SHARED_LIBRARY = $(srcdir)/ndk-build-shared-library.mk
BUILD_STATIC_LIBRARY = $(srcdir)/ndk-build-static-library.mk
PREBUILT_SHARED_LIBRARY = $(srcdir)/ndk-prebuilt-shared-library.mk
PREBUILT_STATIC_LIBRARY = $(srcdir)/ndk-prebuilt-static-library.mk

# Target information variables.

TARGET_ARCH = $(NDK_BUILD_ARCH)
TARGET_PLATFORM = android-$(NDK_BUILD_SDK)
TARGET_ARCH_ABI = $(NDK_BUILD_ABI)
TARGET_ABI = $(TARGET_PLATFORM)-$(TARGET_ABI)

# Module description variables.  These are defined by Android.mk.
LOCAL_PATH :=
LOCAL_MODULE :=
LOCAL_MODULE_FILENAME :=
LOCAL_SRC_FILES :=
LOCAL_CPP_EXTENSION :=
LOCAL_CPP_FEATURES :=
LOCAL_C_INCLUDES :=
LOCAL_CFLAGS :=
LOCAL_CPPFLAGS :=
LOCAL_STATIC_LIBRARIES :=
LOCAL_SHARED_LIBRARIES :=
LOCAL_WHOLE_STATIC_LIBRARIES :=
LOCAL_LDLIBS :=
LOCAL_LDFLAGS :=
LOCAL_ALLOW_UNDEFINED_SYMBOLS :=
LOCAL_ARM_MODE :=
LOCAL_ARM_NEON :=
LOCAL_DISABLE_FORMAT_STRING_CHECKS :=
LOCAL_EXPORT_CFLAGS :=
LOCAL_EXPORT_CPPFLAGS :=
LOCAL_EXPORT_C_INCLUDES :=
LOCAL_EXPORT_LDFLAGS :=
LOCAL_EXPORT_LDLIBS :=
LOCAL_ASM_RULE_DEFINED :=
LOCAL_ASM_RULE :=

# Now load Android.mk.
include $(1)

endef

# Now define rules for each Android.mk file.
$(foreach android_mk,$(NDK_BUILD_ANDROID_MK),$(eval $(call subr-1,$(android_mk))))

.PHONY: clean mostlyclean
clean mostlyclean:
	rm -rf *.o *.so *.a

.PHONY: extraclean dist-clean maintainer-clean
extraclean dist-clean maintainer-clean:
	rm -rf Makefile