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