Home | History | Annotate | Download | only in udata
      1 # Copyright (c) 2000-2004 IBM, Inc. and others
      2 # udata 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 
     11 
     12 # Include ICU standard definitions
     13 include ../defs.mk
     14 
     15 # look for the ICU_PATH variable, guess if not there
     16 ICU_DEFAULT_PATH=../../..
     17 
     18 ifeq ($(strip $(ICU_PATH)),)
     19   ICU_PATH=$(ICU_DEFAULT_PATH)
     20 endif
     21 
     22 # Name of your target
     23 TARGET1=reader
     24 TARGET2=writer
     25 
     26 # All object files (C or C++)
     27 OBJECTS1=reader.o
     28 OBJECTS2=writer.o
     29 OBJECTS=$(OBJECTS1) $(OBJECTS2)
     30 
     31 CLEANFILES=*~ $(TARGET).out
     32 
     33 all: $(TARGET1) $(TARGET2)
     34 
     35 # The following lines are to make sure ICU_PATH is set properly.
     36 writer.o: $(ICU_PATH)/source/tools/toolutil/uoptions.h
     37 
     38 $(ICU_PATH)/source/tools/toolutil/uoptions.h:
     39 	@echo
     40 	@echo "*** Please read the directions at the top of this file (Makefile)"
     41 	@echo "*** Can't open $@ - check ICU_PATH"
     42 	@echo
     43 	@false
     44 
     45 # Only the writer needs these, actually.
     46 CPPFLAGS += -I$(ICU_PATH)/source/tools/toolutil
     47 LDFLAGS += -L$(ICU_PATH)/source/tools/toolutil $(shell icu-config --ldflags-toolutil)
     48 
     49 
     50 .PHONY: all clean distclean check report
     51 
     52 distclean clean:
     53 	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
     54 	-$(RMV) $(OBJECTS) $(TARGET1) $(TARGET2)
     55 
     56 # Can change this to LINK.c if it is a C only program
     57 # Can add more libraries here. 
     58 $(TARGET1): $(OBJECTS1)
     59 	$(CC) -o $@ $^ $(LDFLAGS)
     60 
     61 $(TARGET2): $(OBJECTS2)
     62 	$(CC) -o $@ $^ $(LDFLAGS)
     63 
     64 # Make check: simply runs the sample, logged to a file
     65 check: $(TARGET1) $(TARGET2)
     66 	$(INVOKE) ./$(TARGET2) | tee $(TARGET2).out
     67 	$(INVOKE) ./$(TARGET1) | tee $(TARGET1).out
     68 
     69 
     70