1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Copyright (c) 2000-2005 IBM, Inc. and others
2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# conversion sample code
3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Usage:
4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#  - configure, build, install ICU
5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#  - ensure that 'icu-config' is in the PATH (PREFIX/bin/icu-config) 
6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#  - if ICU is not built relative to this directory,
7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#      set the variable ICU_PATH to the 'icu' directory
8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#       (i.e.  /foo/icu  )
9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#  - do 'make' in this directory
10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinclude ../defs.mk
12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruICU_DEFAULT_PATH=../../..
14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruifeq ($(strip $(ICU_PATH)),)
16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru  ICU_PATH=$(ICU_DEFAULT_PATH)
17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruendif
18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruGENRBOPT = -s. -d.
20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Name of your target
22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruTARGET=uresb
23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruPKG=$(TARGET)
24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruRES_SRC=root.txt en.txt sr.txt
25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruRESOURCES=$(RES_SRC:%.txt=%.res)
26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# All object files (C or C++)
28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruOBJECTS=uresb.o
29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruCLEANFILES=*~ $(TARGET).out
31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruall: $(RESOURCES) $(TARGET) 
33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruuresb.o:  $(ICU_PATH)/source/tools/toolutil/uoptions.h
35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru$(ICU_PATH)/source/tools/toolutil/uoptions.h:
37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo "Please read the directions at the top of this file (Makefile)"
38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo "Can't open $@ - check ICU_PATH"
39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@false
40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruCPPFLAGS += -I$(ICU_PATH)/source/tools/toolutil
42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruLDFLAGS += -L$(ICU_PATH)/source/tools/toolutil $(shell icu-config --ldflags-toolutil --ldflags-icuio)
43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru.PHONY: all clean distclean check report
45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querudistclean clean:
47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	-$(RMV) $(OBJECTS) $(TARGET) $(RESOURCES)
49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## resources
52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru%.res: %.txt
53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo "generating $@"
54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	$(GENRB) $(GENRBOPT) $^
55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Special for a special codepage
57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querusr.res : sr.txt
58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo "generating $@"
59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	$(GENRB) $(GENRBOPT) -e cp1251 $?
60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Can change this to LINK.c if it is a C only program
62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Can add more libraries here. 
63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru$(TARGET): $(OBJECTS)
64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	$(CC) -o $@ $^ $(LDFLAGS)
65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Make check: simply runs the sample, logged to a file
67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querucheck: $(TARGET) $(RESOURCES)
68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	$(INVOKE) ./$(TARGET) en | tee $(TARGET).out
69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Make report: creates a 'report file' with both source and sample run
71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querureport: $(TARGET).report
72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru$(TARGET).report: check $(TARGET).cpp
74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	more $(TARGET).cpp $(TARGET).out > $@
75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
78