]>
Commit | Line | Data |
---|---|---|
73c04bcf | 1 | # Copyright (c) 2000-2005 IBM, Inc. and others |
374ca955 | 2 | # conversion sample code |
b75a7d8f A |
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 | ||
73c04bcf | 19 | GENRBOPT = -s. -d. |
b75a7d8f A |
20 | |
21 | # Name of your target | |
22 | TARGET=uresb | |
23 | PKG=$(TARGET) | |
24 | RES_SRC=root.txt en.txt sr.txt | |
73c04bcf | 25 | RESOURCES=$(RES_SRC:%.txt=%.res) |
b75a7d8f A |
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 | |
374ca955 | 42 | LDFLAGS += -L$(ICU_PATH)/source/tools/toolutil $(shell icu-config --ldflags-toolutil --ldflags-icuio) |
b75a7d8f A |
43 | |
44 | .PHONY: all clean distclean check report | |
45 | ||
46 | distclean clean: | |
47 | -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) | |
73c04bcf | 48 | -$(RMV) $(OBJECTS) $(TARGET) $(RESOURCES) |
b75a7d8f A |
49 | |
50 | ||
51 | ## resources | |
73c04bcf | 52 | %.res: %.txt |
b75a7d8f A |
53 | @echo "generating $@" |
54 | $(GENRB) $(GENRBOPT) $^ | |
55 | ||
56 | ## Special for a special codepage | |
73c04bcf | 57 | sr.res : sr.txt |
b75a7d8f A |
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 |