1fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com# Copyright (c) 2001-2004 IBM, Inc. and others
2fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com# conversion sample code
3fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com
4fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com
5fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com# Usage:
6fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com#  - configure and build ICU [see the docs] .. use "--prefix=" something
7b45a1b46ee25e9b19800b028bb1ca925212ac7b4caryclark@google.com#     (I  used --prefix=/home/srl/III )
8fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com# 
9fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com#  - do 'make install' of icu 
10fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com#
11fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com#  - set the variable ICU_PREFIX to point at $(prefix)
1215fa138f2276a77679530fb608463ff5b4133f7bcaryclark@google.com#    (will look for $(prefix)/lib/icu/Makefile.inc )
1315fa138f2276a77679530fb608463ff5b4133f7bcaryclark@google.com# 
1415fa138f2276a77679530fb608463ff5b4133f7bcaryclark@google.com#  - set the variable ICU_LEGACY  (read the README)
15b45a1b46ee25e9b19800b028bb1ca925212ac7b4caryclark@google.com#   ( Will look for ICU_LEGACY/include/unicode/ucol.h )
16b45a1b46ee25e9b19800b028bb1ca925212ac7b4caryclark@google.com#  
1715fa138f2276a77679530fb608463ff5b4133f7bcaryclark@google.com#  - do 'make' in this directory
1815fa138f2276a77679530fb608463ff5b4133f7bcaryclark@google.com
1915fa138f2276a77679530fb608463ff5b4133f7bcaryclark@google.com#ICU_PREFIX=/home/weiv/build/current
2047580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com#ICU_LEGACY = /home/weiv/build/icu-1-8-1
2115fa138f2276a77679530fb608463ff5b4133f7bcaryclark@google.com
22fa0588ff672564af1c235a63589573829035a60bcaryclark@google.comLEGACY_INCLUDE = $(ICU_LEGACY)/include
2347580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com
2447580694fbe974a065caf7c39c3d2075708c2018caryclark@google.comICU_INC=$(ICU_PREFIX)/lib/icu/Makefile.inc
2547580694fbe974a065caf7c39c3d2075708c2018caryclark@google.comICUPATH=
2647580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com
2747580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com-include $(ICU_INC)
28f839c0359c308fd06895d9f73fc12c4f3869e399caryclark@google.com
290b7da433fe0eaa2833d1b2900715b013b36d93dacaryclark@google.com# Name of your target
30a461ff0866526bc51dbd4c4f9f066a727ec21510caryclark@google.comTARGET=legacy
3147580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com
32e7bd5f4041701cbab87f6e779eb18fbb9fe74216caryclark@google.com# All object files (C or C++)
3347580694fbe974a065caf7c39c3d2075708c2018caryclark@google.comOBJECTS=legacy.o newcol.o oldcol.o
3431143cf37fa38dc98f71c71e518ecc21c83b5e27caryclark@google.com
35fa0588ff672564af1c235a63589573829035a60bcaryclark@google.comCLEANFILES=*~ $(TARGET).out
3647580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com
37fa0588ff672564af1c235a63589573829035a60bcaryclark@google.comDEPS=$(OBJECTS:.o=.d)
3847580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com
394eeda37a7456876cb8d509a4ea43c7f4c684477acaryclark@google.com# turn on super warnings
40fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com#CPPFLAGS += -Wall
4147580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com
42c899ad9c7fa28234d99479ab09afb6866bbd8dc3caryclark@google.comall: $(TARGET) $(ICU_INC)
43e7bd5f4041701cbab87f6e779eb18fbb9fe74216caryclark@google.com
4447580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com.PHONY: all clean distclean check report
458dcf114db9762c02d217beba6e29dffa4e92d298caryclark@google.com
46e7bd5f4041701cbab87f6e779eb18fbb9fe74216caryclark@google.comoldcol.o : oldcol.cpp $(LEGACY_INCLUDE)/unicode/ucol.h
4747580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com	$(CXX) -I$(LEGACY_INCLUDE) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) -c oldcol.cpp
48f839c0359c308fd06895d9f73fc12c4f3869e399caryclark@google.com
49729e1c46cea63dfaa6e4a05608b8f3be41e19dcecaryclark@google.comdistclean clean:
5047580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
51afe56de6361a81eef537ddd8f6d5626c8546d4c7caryclark@google.com	-$(RMV) $(OBJECTS) $(TARGET)
528dcf114db9762c02d217beba6e29dffa4e92d298caryclark@google.com	-$(RMV) $(DEPS)
53fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com
54fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com# Can change this to LINK.c if it is a C only program
55fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com# Can add more libraries here. 
5647580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com$(TARGET): $(OBJECTS)
57fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com	$(LINK.cc) -o $@ $^ $(ICULIBS) $(ICU_PREFIX)/lib/libicuuc.so.18 $(ICU_PREFIX)/lib/libicui18n.so.18 
58c91dfe417a51f73c28ecf2708df1e0bee942c6eacaryclark@google.com
594eeda37a7456876cb8d509a4ea43c7f4c684477acaryclark@google.com# Make check: simply runs the sample, logged to a file
606aea33f92c611d6fdc88bc2352c5c966168af83bcaryclark@google.comcheck: $(TARGET)
616aea33f92c611d6fdc88bc2352c5c966168af83bcaryclark@google.com	$(INVOKE) ./$(TARGET) | tee $(TARGET).out
623350c3c68ab75cd08721da3a938b8d2b10096d70caryclark@google.com
63e7bd5f4041701cbab87f6e779eb18fbb9fe74216caryclark@google.com# Make report: creates a 'report file' with both source and sample run
643350c3c68ab75cd08721da3a938b8d2b10096d70caryclark@google.comreport: $(TARGET).report
65534aa5b9460639a09b9dc30d29e77782e44b8fffcaryclark@google.com
66e7bd5f4041701cbab87f6e779eb18fbb9fe74216caryclark@google.com$(TARGET).report: check $(TARGET).cpp
673350c3c68ab75cd08721da3a938b8d2b10096d70caryclark@google.com	more $(TARGET).cpp $(TARGET).out > $@
6865f9f0a1664a9cb38157ccfbcc3e0e936af0a58ecaryclark@google.com
69729e1c46cea63dfaa6e4a05608b8f3be41e19dcecaryclark@google.com$(ICU_INC):
7047580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com	@echo ICU_PREFIX variable is not set correctly
71afe56de6361a81eef537ddd8f6d5626c8546d4c7caryclark@google.com	@echo "Please read the directions at the top of this file (Makefile)"
7247580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com	@echo "And the README"
73fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com	@echo "Can't open $(ICU_INC)"
74fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com	@false
75fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com
766aea33f92c611d6fdc88bc2352c5c966168af83bcaryclark@google.com$(LEGACY_INCLUDE)/unicode/ucol.h:
77027de226c144d9e6b7a76acb2e904952b5620a5ecaryclark@google.com	@echo ICU_LEGACY variable is not set correctly.
78fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com	@echo "Please read the directions at the top of this file (Makefile)"
79fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com	@echo "And the README"
8065f9f0a1664a9cb38157ccfbcc3e0e936af0a58ecaryclark@google.com	@echo "Can't open $@"
81fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com	@false
82fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com
83fa0588ff672564af1c235a63589573829035a60bcaryclark@google.comifneq ($(MAKECMDGOALS),distclean)
84fa0588ff672564af1c235a63589573829035a60bcaryclark@google.com-include $(DEPS)
858dcf114db9762c02d217beba6e29dffa4e92d298caryclark@google.comendif
868dcf114db9762c02d217beba6e29dffa4e92d298caryclark@google.com