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 11include ../defs.mk 12 13ICU_DEFAULT_PATH=../../.. 14 15ifeq ($(strip $(ICU_PATH)),) 16 ICU_PATH=$(ICU_DEFAULT_PATH) 17endif 18 19GENRBOPT = -s. -d. 20 21# Name of your target 22TARGET=uresb 23PKG=$(TARGET) 24RES_SRC=root.txt en.txt sr.txt 25RESOURCES=$(RES_SRC:%.txt=%.res) 26 27# All object files (C or C++) 28OBJECTS=uresb.o 29 30CLEANFILES=*~ $(TARGET).out 31 32all: $(RESOURCES) $(TARGET) 33 34uresb.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 41CPPFLAGS += -I$(ICU_PATH)/source/tools/toolutil 42LDFLAGS += -L$(ICU_PATH)/source/tools/toolutil $(shell icu-config --ldflags-toolutil --ldflags-icuio) 43 44.PHONY: all clean distclean check report 45 46distclean 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 57sr.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 67check: $(TARGET) $(RESOURCES) 68 $(INVOKE) ./$(TARGET) en | tee $(TARGET).out 69 70# Make report: creates a 'report file' with both source and sample run 71report: $(TARGET).report 72 73$(TARGET).report: check $(TARGET).cpp 74 more $(TARGET).cpp $(TARGET).out > $@ 75 76 77 78