12e5b6d6dSopenharmony_ci# -*- makefile -*-
22e5b6d6dSopenharmony_ci#
32e5b6d6dSopenharmony_ci# Copyright (C) 2017 and later: Unicode, Inc. and others.
42e5b6d6dSopenharmony_ci# License & terms of use: http://www.unicode.org/copyright.html
52e5b6d6dSopenharmony_ci#
62e5b6d6dSopenharmony_ci# Copyright (C) 2012 IBM Corporation and Others. All Rights Reserved.
72e5b6d6dSopenharmony_ci## Name of the app
82e5b6d6dSopenharmony_ci
92e5b6d6dSopenharmony_ciTARGET=icu4jscan
102e5b6d6dSopenharmony_ci
112e5b6d6dSopenharmony_ciall:
122e5b6d6dSopenharmony_ci	@echo To build and list "'" $(OUTFILES) "'"  in "'" $(J_GOOD) "'" use "$(MAKE) check"
132e5b6d6dSopenharmony_ci
142e5b6d6dSopenharmony_ci## Setup multicu
152e5b6d6dSopenharmony_ciMULTICU_ROOT=../../
162e5b6d6dSopenharmony_ciinclude $(MULTICU_ROOT)/j/Makefile-j.inc
172e5b6d6dSopenharmony_ci
182e5b6d6dSopenharmony_ci
192e5b6d6dSopenharmony_ci## The output files.  Will result in:   out/3_8.txt  out/4_0.txt  etc.
202e5b6d6dSopenharmony_ciOUT=jxml
212e5b6d6dSopenharmony_ciOUTFILES=$(J_GOOD:%=$(OUT)/%.txt)
222e5b6d6dSopenharmony_ci
232e5b6d6dSopenharmony_ci.PRECIOUS: $(C_CLEAN_TARGET)
242e5b6d6dSopenharmony_ci
252e5b6d6dSopenharmony_ci## Generate a file
262e5b6d6dSopenharmony_ci$(OUT)/%.txt: $(OUT) $(C_INS)/%/bin/$(TARGET)
272e5b6d6dSopenharmony_ci	$(shell $(C_INS)/$*/bin/icu-config --invoke) $(C_INS)/$*/bin/$(TARGET)  > $@
282e5b6d6dSopenharmony_ci
292e5b6d6dSopenharmony_ci## clean
302e5b6d6dSopenharmony_ciclean:
312e5b6d6dSopenharmony_ci	-rm -f $(C_CLEAN_TARGET)
322e5b6d6dSopenharmony_ci	-rm -f ./$(OUT)/*
332e5b6d6dSopenharmony_ci	-rmdir $(OUT)
342e5b6d6dSopenharmony_ci
352e5b6d6dSopenharmony_ci
362e5b6d6dSopenharmony_ci## Test: generate out files, and print them.
372e5b6d6dSopenharmony_cicheck: $(OUTFILES)
382e5b6d6dSopenharmony_ci	@for file in $(OUTFILES); \
392e5b6d6dSopenharmony_ci	do \
402e5b6d6dSopenharmony_ci		echo; \
412e5b6d6dSopenharmony_ci		sed -e "s%^%$$file: %g" < $$file; \
422e5b6d6dSopenharmony_ci	done
432e5b6d6dSopenharmony_ci
442e5b6d6dSopenharmony_ciMULTICU_ROOT=../../
452e5b6d6dSopenharmony_ciinclude $(MULTICU_ROOT)/common/Makefile-multi.inc
462e5b6d6dSopenharmony_ci
472e5b6d6dSopenharmony_ciXML=./xml
482e5b6d6dSopenharmony_ci
492e5b6d6dSopenharmony_ciJVMXML=./jvmxml
502e5b6d6dSopenharmony_ciJVM=$(MULTICU_ROOT)/j/jvm
512e5b6d6dSopenharmony_ciJVM_CFG=.sh
522e5b6d6dSopenharmony_ciJVMSH:=$(wildcard $(JVM)/[0-9]*$(JVM_CFG))
532e5b6d6dSopenharmony_ci
542e5b6d6dSopenharmony_ciALLICUS=$(ICUVERS:%=$(BLD)/%/$(S_BLD))
552e5b6d6dSopenharmony_ciIICUS=$(ICUVERS:%=$(INS)/%/$(S_INS))
562e5b6d6dSopenharmony_ciALLAPPS=$(ICUVERS:%=$(INS)/%/bin/$(TARGET))
572e5b6d6dSopenharmony_ciALLXMLS=$(ICUVERS:%=$(XML)/%.xml)
582e5b6d6dSopenharmony_ciCOOKED=cooked
592e5b6d6dSopenharmony_ciINPUT=input
602e5b6d6dSopenharmony_ciINTROXMLS=$(wildcard $(INPUT)/*-introduction.xml)
612e5b6d6dSopenharmony_ciFEATXMLS=$(INTROXMLS:$(INPUT)/%-introduction.xml=$(COOKED)/%-cooked.xml) $(COOKED)/characters.xml
622e5b6d6dSopenharmony_ciALLCOOKED=cooked/features.xml
632e5b6d6dSopenharmony_ci
642e5b6d6dSopenharmony_ciJXML=./jxml
652e5b6d6dSopenharmony_ci#ICU4JVERS
662e5b6d6dSopenharmony_ciALLICU4JS=$(ICU4JVERS:%=$(ICUS)/icu4j-%.jar)
672e5b6d6dSopenharmony_ciALLJXMLS=$(J_GOOD:%=$(JXML)/%.xml)
682e5b6d6dSopenharmony_ciJSCAN=ScanICU
692e5b6d6dSopenharmony_cialljxmls: $(JXML) $(ALLJXMLS)
702e5b6d6dSopenharmony_ciJSCANDIR=../icu4jscan
712e5b6d6dSopenharmony_ciJCLASSFILE=$(JSCANDIR)/bin/com/ibm/icu/dev/scan/$(JSCAN).class
722e5b6d6dSopenharmony_ciJScanPackage=com.ibm.icu.dev.scan
732e5b6d6dSopenharmony_ciALLJVM=$(JVMSH:$(JVM)/%$(JVM_CFG)=%)
742e5b6d6dSopenharmony_ciALLJVMXMLS=$(ALLJVM:%=$(JVMXML)/%.xml)
752e5b6d6dSopenharmony_ciJVMSCAN=ScanJava
762e5b6d6dSopenharmony_cialljvmxmls: $(JVMXML) $(ALLJVMXMLS)
772e5b6d6dSopenharmony_ciJVMCLASSFILE=$(JSCANDIR)/bin/com/ibm/icu/dev/scan/$(JVMSCAN).class
782e5b6d6dSopenharmony_ci
792e5b6d6dSopenharmony_ci
802e5b6d6dSopenharmony_ci# java stuff
812e5b6d6dSopenharmony_ciJAVA=java
822e5b6d6dSopenharmony_ciMergerName=Merger
832e5b6d6dSopenharmony_ciPropagateName=PropagateFeatures
842e5b6d6dSopenharmony_ciPropagateCharsName=PropagateCharacters
852e5b6d6dSopenharmony_ciMergerPackage=com.ibm.icu.dev.meta
862e5b6d6dSopenharmony_ciMergerPackageSlash=$(subst .,/,$(MergerPackage))
872e5b6d6dSopenharmony_ci## ICUMETA=/xsrl/E/data/meta  (in Makefile.local)
882e5b6d6dSopenharmony_ciMergerLib=$(ICUMETA)/lib
892e5b6d6dSopenharmony_ciMergerJar=$(ICUMETA)/icumeta.jar
902e5b6d6dSopenharmony_ci#was: $(ICUMETA)/classes
912e5b6d6dSopenharmony_ciMergerClassPath=$(shell ls $(MergerLib)/*.jar | tr '\n' ':')$(MergerJar):$(OTHERJARS)
922e5b6d6dSopenharmony_ciinclude Makefile.local
932e5b6d6dSopenharmony_ciMergerBuild=$(ICUMETA)/build.xml
942e5b6d6dSopenharmony_ci#MergerClass=$(ICUMETA)/classes/$(MergerPackageSlash)/$(MergerName).class
952e5b6d6dSopenharmony_ci#MergerJava=$(ICUMETA)/src/$(MergerPackageSlash)/$(MergerName).java
962e5b6d6dSopenharmony_ci#BASEXMLS=$(ICUMETA)/xml/icumeta.xml
972e5b6d6dSopenharmony_ciBASEXMLS=$(ICUMETA)/input/versions.xml
982e5b6d6dSopenharmony_ci
992e5b6d6dSopenharmony_ci
1002e5b6d6dSopenharmony_ciAPRECIOUS=$(ICUVERS:%=$(BLD)/%/$(S_SRC)) $(ICUVERS:%=$(BLD)/%/$(S_BLD)) $(ICUVERS:%=$(INS)/%/$(S_INS))
1012e5b6d6dSopenharmony_ci
1022e5b6d6dSopenharmony_ci.PRECIOUS: $(APRECIOUS)
1032e5b6d6dSopenharmony_ci
1042e5b6d6dSopenharmony_citehprecious:
1052e5b6d6dSopenharmony_ci	echo $(APRECIOUS)
1062e5b6d6dSopenharmony_ci
1072e5b6d6dSopenharmony_ci$(MergerJar):
1082e5b6d6dSopenharmony_ci	( cd $(ICUMETA)  ; ant jar )
1092e5b6d6dSopenharmony_ci
1102e5b6d6dSopenharmony_ci$(BLD):
1112e5b6d6dSopenharmony_ci	-mkdir $(BLD)
1122e5b6d6dSopenharmony_ci
1132e5b6d6dSopenharmony_ci$(INS)/%/$(S_INS): $(BLD)/%/$(S_BLD)
1142e5b6d6dSopenharmony_ci	@if [ -f $(BLD)/$*/build.err ]; then echo Error for $* stored in $(BLD)/$*/build.err; false;  fi
1152e5b6d6dSopenharmony_ci	( make $(MAKE_OPTS) -C $(BLD)/$*/icu/source 2>&1 all install | tee $(BLD)/$*/build.log ) || ( mv $(BLD)/$*/build.log $(BLD)/$*/build.err ; false )
1162e5b6d6dSopenharmony_ci	touch -c $@
1172e5b6d6dSopenharmony_ci
1182e5b6d6dSopenharmony_ci$(BLD)/%/$(S_SRC): $(ICUS)/icu4c-%-src.tgz
1192e5b6d6dSopenharmony_ci	-mv $(BLD)/$* $(BLD)/$*.old
1202e5b6d6dSopenharmony_ci	-( rm -rf ./$(BLD)/$*.old& )
1212e5b6d6dSopenharmony_ci	mkdir -p $(BLD)/$*
1222e5b6d6dSopenharmony_ci	( cd $(BLD)/$* ; tar xfpz $(DOT)/$^ )
1232e5b6d6dSopenharmony_ci	([ -f patch/$* ] && patch -d $(BLD)/$* -p1 < $(DOT)/patch/$*) || true
1242e5b6d6dSopenharmony_ci	touch -c $@
1252e5b6d6dSopenharmony_ci
1262e5b6d6dSopenharmony_ci$(BLD)/%/$(S_BLD): $(BLD)/%/$(S_SRC)
1272e5b6d6dSopenharmony_ci	-mkdir -p $(INS)
1282e5b6d6dSopenharmony_ci	( cd $(BLD)/$*/icu/source ; ./configure --disable-renaming --enable-shared --disable-static --enable-release --disable-debug --prefix=$(DOT)/$(INS)/$* )
1292e5b6d6dSopenharmony_ci	touch -c $@
1302e5b6d6dSopenharmony_ci
1312e5b6d6dSopenharmony_ci$(INS)/%/bin/$(TARGET): $(INS)/%/$(S_INS) $(SRCS)
1322e5b6d6dSopenharmony_ci	-rm -rf ./$(BLD)/$*/tmp
1332e5b6d6dSopenharmony_ci	mkdir ./$(BLD)/$*/tmp
1342e5b6d6dSopenharmony_ci	@for file in $(OBJECTS); \
1352e5b6d6dSopenharmony_ci	do \
1362e5b6d6dSopenharmony_ci		what=`basename $$file .o` ; \
1372e5b6d6dSopenharmony_ci		echo compiling $*/$$what ; \
1382e5b6d6dSopenharmony_ci		$(CXX) -c -o ./$(BLD)/$*/tmp/$$what.o $$what.cpp -I $(INS)/$*/include -I $(BLD)/$*/icu/source/tools/toolutil ; \
1392e5b6d6dSopenharmony_ci	done
1402e5b6d6dSopenharmony_ci	$(CXX) -o $@ $(OBJECTS:%.o=./$(BLD)/$*/tmp/%.o)  -licudata -licuuc -licutu -licui18n -L$(INS)/$*/lib 
1412e5b6d6dSopenharmony_ci
1422e5b6d6dSopenharmony_ci$(XML):
1432e5b6d6dSopenharmony_ci	mkdir $(XML)
1442e5b6d6dSopenharmony_ci
1452e5b6d6dSopenharmony_ci$(JXML):
1462e5b6d6dSopenharmony_ci	mkdir $(JXML)
1472e5b6d6dSopenharmony_ci
1482e5b6d6dSopenharmony_ciifeq ($(JVMSH),)
1492e5b6d6dSopenharmony_ciJVMSH_WARN=warn-jvmsh
1502e5b6d6dSopenharmony_ciwarn-jvmsh:
1512e5b6d6dSopenharmony_ci	@echo "Note: No $(JVM)/*$(JVM_CFG) files found, see $(JVM)/readme.txt"
1522e5b6d6dSopenharmony_ciendif
1532e5b6d6dSopenharmony_ci
1542e5b6d6dSopenharmony_ci
1552e5b6d6dSopenharmony_ci$(JVMXML):
1562e5b6d6dSopenharmony_ci	mkdir $(JVMXML)
1572e5b6d6dSopenharmony_ci
1582e5b6d6dSopenharmony_ci$(XML)/%.xml: $(INS)/%/bin/$(TARGET) $(XML)
1592e5b6d6dSopenharmony_ci	$(shell $(INS)/$*/bin/icu-config --invoke) $(INS)/$*/bin/$(TARGET)  > $@
1602e5b6d6dSopenharmony_ci
1612e5b6d6dSopenharmony_ciallxmls: $(ALLXMLS) | $(OUT)
1622e5b6d6dSopenharmony_ci
1632e5b6d6dSopenharmony_cialljvmxmls:  $(ALLJVMXMLS) $(JVMSH_WARN)  | $(JVMXML)
1642e5b6d6dSopenharmony_ci
1652e5b6d6dSopenharmony_ciallapps: $(BLD) $(ALLAPPS)
1662e5b6d6dSopenharmony_ci
1672e5b6d6dSopenharmony_ciallicus: $(BLD) $(ALLICUS)
1682e5b6d6dSopenharmony_ci
1692e5b6d6dSopenharmony_ciclean-allapps:
1702e5b6d6dSopenharmony_ci	-rm -f $(ALLAPPS)
1712e5b6d6dSopenharmony_ci
1722e5b6d6dSopenharmony_ciiicus: $(BLD) $(IICUS)
1732e5b6d6dSopenharmony_ci
1742e5b6d6dSopenharmony_ciDTDCACHE=$(shell pwd)/dtdcache
1752e5b6d6dSopenharmony_ciDTDTMP=$(shell pwd)/dtdtmp
1762e5b6d6dSopenharmony_ciDTDOVR=$(ICUMETA)/dtd
1772e5b6d6dSopenharmony_ciJAVADEBUG=-DCLDR_DTD_CACHE_DEBUG=n -DCLDR_DTD_CACHE_ADEBUG=n 
1782e5b6d6dSopenharmony_ciJAVAPROPS= -DCLDR_DTD_CACHE=$(DTDCACHE) -DCLDR_DTD_OVERRIDE=$(DTDOVR) -DICU_DTD_CACHE=$(DTDCACHE) -DICU_DTD_OVERRIDE=$DTDOVR 
1792e5b6d6dSopenharmony_ci
1802e5b6d6dSopenharmony_ci#//$(DTD)/Makefile: $(ICUMETA)/dtd/Makfile
1812e5b6d6dSopenharmony_ci#//	ln -s $^ $@
1822e5b6d6dSopenharmony_ci#//
1832e5b6d6dSopenharmony_ci#//dtd/icucaps.dtd: $(DTD)/Makefile dtd/icucaps.rnc
1842e5b6d6dSopenharmony_ci#//	make -C $(DTD)
1852e5b6d6dSopenharmony_ci
1862e5b6d6dSopenharmony_ciICUMETA_XML=$(ICUMETA)/xml/icumeta.xml
1872e5b6d6dSopenharmony_ci
1882e5b6d6dSopenharmony_ci#$(ICUMETA)/xml/icumeta.xml: $(MergerBuild)
1892e5b6d6dSopenharmony_ci#	( cd $(ICUMETA) ; ant xml )	
1902e5b6d6dSopenharmony_ci
1912e5b6d6dSopenharmony_cifeatxmls: $(FEATXMLS)
1922e5b6d6dSopenharmony_ci
1932e5b6d6dSopenharmony_ciallcooked: $(ALLCOOKED)
1942e5b6d6dSopenharmony_ci
1952e5b6d6dSopenharmony_ci$(ALLCOOKED): $(FEATXMLS) $(MergerJar)
1962e5b6d6dSopenharmony_ci	-rm -rf ./dtdcache
1972e5b6d6dSopenharmony_ci	mkdir dtdcache
1982e5b6d6dSopenharmony_ci	$(JAVA) $(JAVAPROPS) -classpath $(MergerClassPath) $(MergerPackage).$(MergerName) -v  -o:$@ $(FEATXMLS)
1992e5b6d6dSopenharmony_ci
2002e5b6d6dSopenharmony_ci$(COOKED)/%-cooked.xml: $(ICUMETA_XML) $(INPUT)/%-introduction.xml $(MergerJar)
2012e5b6d6dSopenharmony_ci	-rm -rf ./dtdcache
2022e5b6d6dSopenharmony_ci	mkdir dtdcache
2032e5b6d6dSopenharmony_ci	$(JAVA) $(JAVAPROPS) -classpath $(MergerClassPath) $(MergerPackage).$(PropagateName) $(ICUMETA_XML) $(INPUT)/$*-introduction.xml > $(COOKED)/$*-cooked.xml
2042e5b6d6dSopenharmony_ci
2052e5b6d6dSopenharmony_ci$(COOKED)/characters.xml: $(ALLJXMLS) $(ALLXMLS) $(MergerJar)
2062e5b6d6dSopenharmony_ci	$(JAVA) $(JAVAPROPS) -classpath $(MergerClassPath) $(MergerPackage).$(PropagateCharsName) > $@ $(ALLJXMLS) $(ALLXMLS) || (rm ./$@ ; false)
2072e5b6d6dSopenharmony_ci
2082e5b6d6dSopenharmony_ci
2092e5b6d6dSopenharmony_ciicucaps.xml: $(BASEXMLS) $(ALLJXMLS) $(ALLXMLS) $(MergerJar) $(ALLCOOKED)
2102e5b6d6dSopenharmony_ci	-rm -rf ./dtdcache
2112e5b6d6dSopenharmony_ci	mkdir dtdcache
2122e5b6d6dSopenharmony_ci#	-rm -rf ./dtdtmp
2132e5b6d6dSopenharmony_ci#	mkdir dtdtmp
2142e5b6d6dSopenharmony_ci#	ln -s $(ICUMETA)/dtd/*.dtd ./dtdtmp/
2152e5b6d6dSopenharmony_ci#	ln -s ./dtd/*.dtd ./dtdtmp/
2162e5b6d6dSopenharmony_ci	$(JAVA) $(JAVAPROPS) -classpath $(MergerClassPath) $(MergerPackage).$(MergerName) -v  -o:$@ $(BASEXMLS)  $(ALLXMLS) $(ALLJXMLS) $(ALLCOOKED)
2172e5b6d6dSopenharmony_ci
2182e5b6d6dSopenharmony_ci# --- J 
2192e5b6d6dSopenharmony_ci
2202e5b6d6dSopenharmony_ci$(JXML)/%.xml: $(JCLASSFILE) $(ICUS)/icu4j-%.jar | $(JXML)
2212e5b6d6dSopenharmony_ci	$(JAVA) -classpath $(JSCANDIR)/bin:$(ICUS)/icu4j-$*.jar:$(JSCANDIR)/lib/icumeta.jar:$(JSCANDIR)/lib/xalan.jar:$(JSCANDIR)/lib/cldr.jar:$(JSCANDIR)/lib/utilities.jar:$(MergerJar):$(MergerLib)/utilities.jar:$(MergerLib)/cldr.jar:$(JSCANDIR)/lib/xerces.jar:$(OTHERJARS) $(JScanPackage).$(JSCAN) > $@ || (rm -f ./$@ ; false)
2222e5b6d6dSopenharmony_ci
2232e5b6d6dSopenharmony_ci$(JVMXML)/%.xml: $(JVMCLASSFILE) $(JVM)/%$(JVM_CFG) | $(JVMXML)
2242e5b6d6dSopenharmony_ci	$(JVM)/invoke.sh $(JVM)/$*$(JVM_CFG) $(JSCANDIR)/bin:$(ICUS)/icu4j-$*.jar:$(JSCANDIR)/lib/icumeta.jar:$(JSCANDIR)/lib/xalan.jar:$(JSCANDIR)/lib/cldr.jar:$(MergerJar):$(MergerJar):$(MergerLib)/utilities.jar:$(MergerLib)/cldr.jar:$(JSCANDIR)/lib/utilities.jar:$(JSCANDIR)/lib/xerces.jar:$(OTHERJARS) $(JScanPackage).$(JVMSCAN) > $@ || (rm ./$@ ; false)
2252e5b6d6dSopenharmony_ci
2262e5b6d6dSopenharmony_ci## Just generate
2272e5b6d6dSopenharmony_cioutfiles: $(XML) $(JXML) $(ALLJXMLS) $(ALLJVMXMLS)
228