Home | History | Annotate | Download | only in uresb
      1 # Copyright (C) 2016 and later: Unicode, Inc. and others.
      2 # License & terms of use: http://www.unicode.org/copyright.html#License
      3 #
      4 # Copyright (c) 2000-2005 IBM, Inc. and others
      5 # conversion sample code
      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 
     22 GENRBOPT = -s. -d.
     23 
     24 # Name of your target
     25 TARGET=uresb
     26 PKG=$(TARGET)
     27 RES_SRC=root.txt en.txt sr.txt
     28 RESOURCES=$(RES_SRC:%.txt=%.res)
     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
     45 LDFLAGS += -L$(ICU_PATH)/source/tools/toolutil $(shell icu-config --ldflags-toolutil --ldflags-icuio)
     46 
     47 .PHONY: all clean distclean check report
     48 
     49 distclean clean:
     50 	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
     51 	-$(RMV) $(OBJECTS) $(TARGET) $(RESOURCES)
     52 
     53 
     54 ## resources
     55 %.res: %.txt
     56 	@echo "generating $@"
     57 	$(GENRB) $(GENRBOPT) $^
     58 
     59 ## Special for a special codepage
     60 sr.res : sr.txt
     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)
     67 	$(CC) -o $@ $^ $(LDFLAGS)
     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 
     81