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) 2001-2004 IBM, Inc. and others
5# conversion sample code
6
7
8# Usage:
9#  - configure and build ICU [see the docs] .. use "--prefix=" something
10#     (I  used --prefix=/home/srl/III )
11# 
12#  - do 'make install' of icu 
13#
14#  - set the variable ICU_PREFIX to point at $(prefix)
15#    (will look for $(prefix)/lib/icu/Makefile.inc )
16# 
17#  - set the variable ICU_LEGACY  (read the README)
18#   ( Will look for ICU_LEGACY/include/unicode/ucol.h )
19#  
20#  - do 'make' in this directory
21
22#ICU_PREFIX=/home/weiv/build/current
23#ICU_LEGACY = /home/weiv/build/icu-1-8-1
24
25LEGACY_INCLUDE = $(ICU_LEGACY)/include
26
27ICU_INC=$(ICU_PREFIX)/lib/icu/Makefile.inc
28ICUPATH=
29
30-include $(ICU_INC)
31
32# Name of your target
33TARGET=legacy
34
35# All object files (C or C++)
36OBJECTS=legacy.o newcol.o oldcol.o
37
38CLEANFILES=*~ $(TARGET).out
39
40DEPS=$(OBJECTS:.o=.d)
41
42# turn on super warnings
43#CPPFLAGS += -Wall
44
45all: $(TARGET) $(ICU_INC)
46
47.PHONY: all clean distclean check report
48
49oldcol.o : oldcol.cpp $(LEGACY_INCLUDE)/unicode/ucol.h
50	$(CXX) -I$(LEGACY_INCLUDE) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) -c oldcol.cpp
51
52distclean clean:
53	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
54	-$(RMV) $(OBJECTS) $(TARGET)
55	-$(RMV) $(DEPS)
56
57# Can change this to LINK.c if it is a C only program
58# Can add more libraries here. 
59$(TARGET): $(OBJECTS)
60	$(LINK.cc) -o $@ $^ $(ICULIBS) $(ICU_PREFIX)/lib/libicuuc.so.18 $(ICU_PREFIX)/lib/libicui18n.so.18 
61
62# Make check: simply runs the sample, logged to a file
63check: $(TARGET)
64	$(INVOKE) ./$(TARGET) | tee $(TARGET).out
65
66# Make report: creates a 'report file' with both source and sample run
67report: $(TARGET).report
68
69$(TARGET).report: check $(TARGET).cpp
70	more $(TARGET).cpp $(TARGET).out > $@
71
72$(ICU_INC):
73	@echo ICU_PREFIX variable is not set correctly
74	@echo "Please read the directions at the top of this file (Makefile)"
75	@echo "And the README"
76	@echo "Can't open $(ICU_INC)"
77	@false
78
79$(LEGACY_INCLUDE)/unicode/ucol.h:
80	@echo ICU_LEGACY variable is not set correctly.
81	@echo "Please read the directions at the top of this file (Makefile)"
82	@echo "And the README"
83	@echo "Can't open $@"
84	@false
85
86ifneq ($(MAKECMDGOALS),distclean)
87-include $(DEPS)
88endif
89