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