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