1 # Copyright (C) 2016 and later: Unicode, Inc. and others.
2 # License & terms of use: http://www.unicode.org/copyright.html#License
4 # Copyright (c) 2000-2005 IBM, Inc. and others
5 # conversion sample code
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
12 # - do 'make' in this directory
16 ICU_DEFAULT_PATH=../../..
18 ifeq ($(strip $(ICU_PATH)),)
19 ICU_PATH=$(ICU_DEFAULT_PATH)
27 RES_SRC=root.txt en.txt sr.txt
28 RESOURCES=$(RES_SRC:%.txt=%.res)
30 # All object files (C or C++)
33 CLEANFILES=*~ $(TARGET).out
35 all: $(RESOURCES) $(TARGET)
37 uresb.o: $(ICU_PATH)/source/tools/toolutil/uoptions.h
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"
44 CPPFLAGS += -I$(ICU_PATH)/source/tools/toolutil
45 LDFLAGS += -L$(ICU_PATH)/source/tools/toolutil $(shell icu-config --ldflags-toolutil --ldflags-icuio)
47 .PHONY: all clean distclean check report
50 -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
51 -$(RMV) $(OBJECTS) $(TARGET) $(RESOURCES)
57 $(GENRB) $(GENRBOPT) $^
59 ## Special for a special codepage
62 $(GENRB) $(GENRBOPT) -e cp1251 $?
64 # Can change this to LINK.c if it is a C only program
65 # Can add more libraries here.
67 $(CC) -o $(TARGET) $(LDFLAGS)
69 # Make check: simply runs the sample, logged to a file
70 check: $(TARGET) $(RESOURCES)
71 $(INVOKE) ./$(TARGET) en | tee $(TARGET).out
73 # Make report: creates a 'report file' with both source and sample run
74 report: $(TARGET).report
76 $(TARGET).report: check $(TARGET).cpp
77 more $(TARGET).cpp $(TARGET).out > $@