1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Copyright (c) 2001-2004 IBM, Inc. and others
2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# conversion sample code
3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Usage:
6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#  - configure and build ICU [see the docs] .. use "--prefix=" something
7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#     (I  used --prefix=/home/srl/III )
8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# 
9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#  - do 'make install' of icu 
10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#
11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#  - set the variable ICU_PREFIX to point at $(prefix)
12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#    (will look for $(prefix)/lib/icu/Makefile.inc )
13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# 
14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#  - set the variable ICU_LEGACY  (read the README)
15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#   ( Will look for ICU_LEGACY/include/unicode/ucol.h )
16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#  
17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#  - do 'make' in this directory
18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ICU_PREFIX=/home/weiv/build/current
20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ICU_LEGACY = /home/weiv/build/icu-1-8-1
21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruLEGACY_INCLUDE = $(ICU_LEGACY)/include
23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruICU_INC=$(ICU_PREFIX)/lib/icu/Makefile.inc
25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruICUPATH=
26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru-include $(ICU_INC)
28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Name of your target
30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruTARGET=legacy
31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# All object files (C or C++)
33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruOBJECTS=legacy.o newcol.o oldcol.o
34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruCLEANFILES=*~ $(TARGET).out
36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDEPS=$(OBJECTS:.o=.d)
38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# turn on super warnings
40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#CPPFLAGS += -Wall
41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruall: $(TARGET) $(ICU_INC)
43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru.PHONY: all clean distclean check report
45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruoldcol.o : oldcol.cpp $(LEGACY_INCLUDE)/unicode/ucol.h
47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	$(CXX) -I$(LEGACY_INCLUDE) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) -c oldcol.cpp
48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querudistclean clean:
50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	-$(RMV) $(OBJECTS) $(TARGET)
52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	-$(RMV) $(DEPS)
53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Can change this to LINK.c if it is a C only program
55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Can add more libraries here. 
56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru$(TARGET): $(OBJECTS)
57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	$(LINK.cc) -o $@ $^ $(ICULIBS) $(ICU_PREFIX)/lib/libicuuc.so.18 $(ICU_PREFIX)/lib/libicui18n.so.18 
58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Make check: simply runs the sample, logged to a file
60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querucheck: $(TARGET)
61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	$(INVOKE) ./$(TARGET) | tee $(TARGET).out
62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Make report: creates a 'report file' with both source and sample run
64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querureport: $(TARGET).report
65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru$(TARGET).report: check $(TARGET).cpp
67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	more $(TARGET).cpp $(TARGET).out > $@
68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru$(ICU_INC):
70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo ICU_PREFIX variable is not set correctly
71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo "Please read the directions at the top of this file (Makefile)"
72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo "And the README"
73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo "Can't open $(ICU_INC)"
74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@false
75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru$(LEGACY_INCLUDE)/unicode/ucol.h:
77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo ICU_LEGACY variable is not set correctly.
78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo "Please read the directions at the top of this file (Makefile)"
79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo "And the README"
80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo "Can't open $@"
81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@false
82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruifneq ($(MAKECMDGOALS),distclean)
84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru-include $(DEPS)
85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruendif
86