forked from google/j2objc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
118 lines (90 loc) · 3.86 KB
/
Makefile
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
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Builds Android's Apache Xalan library.
SUFFIXES:
default: dist
include environment.mk
JAVA_SOURCES := $(shell find $(SRC_DIR) -name *.java)
JAVA_SOURCES_MANIFEST = $(BUILD_DIR)/java_sources.mf
OBJC_SOURCES_MANIFEST = $(BUILD_DIR)/objc_sources.mf
SOURCEPATH = $(SRC_DIR)
INCLUDE_DIRS = $(GEN_OBJC_DIR)
J2OBJCC := $(ARCH_BIN_DIR)/j2objcc -c $(INCLUDE_DIRS:%=-I%)
TRANSLATE_JAVA_FULL = $(JAVA_SOURCES)
TRANSLATE_JAVA_RELATIVE = $(JAVA_SOURCES:$(SRC_DIR)/%=%)
TRANSLATE_ARGS = -q --batch-translate-max=300 \
-sourcepath $(SOURCEPATH) -encoding UTF-8 -J-Xmx2G
include $(J2OBJC_ROOT)/make/translate.mk
FAT_LIB_NAME = xalan
FAT_LIB_SOURCES_RELATIVE = $(TRANSLATE_SOURCES:$(GEN_OBJC_DIR)/%=%)
FAT_LIB_SOURCE_DIRS = $(GEN_OBJC_DIR)
FAT_LIB_COMPILE = $(J2OBJCC)
include $(J2OBJC_ROOT)/make/fat_lib.mk
PUBLIC_JAVA_SOURCES = \
$(shell cd $(SRC_DIR) && find org -name *.java | xargs egrep -l "^(public|protected) ")
STATIC_FRAMEWORK_RESOURCE_FILES = \
org/apache/xalan/res/XSLTInfo.properties \
org/apache/xml/serializer/Encodings.properties \
org/apache/xml/serializer/HTMLEntities.properties \
org/apache/xml/serializer/output_html.properties \
org/apache/xml/serializer/output_text.properties \
org/apache/xml/serializer/output_unknown.properties \
org/apache/xml/serializer/output_xml.properties \
org/apache/xml/serializer/XMLEntities.properties
STATIC_FRAMEWORK_NAME = Xalan
STATIC_FRAMEWORK_PUBLIC_HEADERS = $(PUBLIC_JAVA_SOURCES:%.java=$(GEN_OBJC_DIR)/%.h)
include $(J2OBJC_ROOT)/make/static_framework.mk
fat_lib_dependencies: jre_emul_dist
JAR = $(BUILD_DIR)/j2objc_xalan.jar
DIST_JAR = $(DIST_JAR_DIR)/j2objc_xalan.jar
XALAN_LICENSE = NOTICE
XALAN_LICENSE_DIST = $(DIST_LICENSE_DIR)/apache_xalan_license.txt
dist: $(FAT_LIBS_DIST) $(DIST_JAR) $(XALAN_LICENSE_DIST)
@tar cf - -C $(GEN_OBJC_DIR) $(TRANSLATE_HEADERS:$(GEN_OBJC_DIR)/%=%) \
| tar xfp - -C $(ARCH_INCLUDE_DIR)
test: $(FAT_LIBS)
@$(MAKE) -f tests.mk test
clean:
@rm -rf $(BUILD_DIR) $(FAT_LIBS_DIST) $(ARCH_INCLUDE_DIR)/com/google/common $(DIST_JAR)
@rm -rf $(XALAN_LICENSE_DIST)
@rm -rf $(STATIC_FRAMEWORK_DIR)
java: $(DIST_JAR)
$(JAR): $(JAVA_SOURCES) | $(BUILD_DIR) java_deps_dist annotations_dist
@echo "building j2objc_xalan.jar"
@stage_dir=`mktemp -d -t j2objc-xalan`; \
$(JAVAC) -sourcepath $(SOURCEPATH) -encoding UTF-8 \
-d $$stage_dir -source 1.7 -target 1.7 -bootclasspath $(DIST_JAR_DIR)/jre_emul.jar $^; \
jar cf $@ -C $$stage_dir .; \
rm -rf $$stage_dir
$(DIST_JAR): $(JAR) | $(DIST_JAR_DIR)
@install -m 0644 $< $@
$(XALAN_LICENSE_DIST): $(XALAN_LICENSE)
@mkdir -p $(@D)
@install -m 0644 $< $@
$(JAVA_SOURCES_MANIFEST): $(JAVA_SOURCES) | $(BUILD_DIR)
@echo "Building $$(basename $@)"
@if [ -e $@ ]; then rm $@; fi
@files='$^' && for i in $$files; do echo $$i >> $@; done
java_sources_manifest: $(JAVA_SOURCES_MANIFEST)
@:
$(OBJC_SOURCES_MANIFEST): $(TRANSLATE_JAVA_FULL) | $(BUILD_DIR)
@echo "Building $$(basename $@)"
@if [ -e $@ ]; then rm $@; fi
@files='$(sort $(TRANSLATE_OBJC))' && for i in $$files; do \
echo $$i >> $@; \
done
objc_sources_manifest: $(OBJC_SOURCES_MANIFEST)
@:
find_cycles: $(JAVA_SOURCES_MANIFEST) | cycle_finder_dist jre_emul_java_manifest
$(DIST_DIR)/cycle_finder -sourcepath $(SOURCEPATH) \
-w ../jre_emul/cycle_whitelist.txt -w cycle_whitelist \
-s ../jre_emul/$(BUILD_DIR_NAME)/java_sources.mf -s $(JAVA_SOURCES_MANIFEST)