1# Copyright (c) 2000-2012 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
13include ../defs.mk
14
15# look for the ICU_PATH variable, guess if not there
16ICU_DEFAULT_PATH=../../..
17
18ifeq ($(strip $(ICU_PATH)),)
19  ICU_PATH=$(ICU_DEFAULT_PATH)
20endif
21
22# Name of your target
23TARGET1=reader
24TARGET2=writer
25
26# All object files (C or C++)
27OBJECTS1=reader.o
28OBJECTS2=writer.o
29OBJECTS=$(OBJECTS1) $(OBJECTS2)
30
31CLEANFILES=*~ $(TARGET).out $(TARGET1).out $(TARGET2).out
32
33all: $(TARGET1) $(TARGET2)
34
35# The following lines are to make sure ICU_PATH is set properly.
36writer.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.
46CPPFLAGS += -I$(ICU_PATH)/source/tools/toolutil
47LDFLAGS += -L$(ICU_PATH)/source/tools/toolutil $(shell icu-config --ldflags-toolutil)
48
49
50.PHONY: all clean distclean check report
51
52distclean 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	$(CXX) -o $@ $(LDFLAGS)
60
61$(TARGET2): $(OBJECTS2)
62	$(CXX) -o $@ $(LDFLAGS) -licui18n -licuuc
63
64# Make check: simply runs the sample, logged to a file
65check: $(TARGET1) $(TARGET2)
66	$(INVOKE) ./$(TARGET2) | tee $(TARGET2).out
67	$(INVOKE) ./$(TARGET1) | tee $(TARGET1).out
68
69
70