1#################################################################################
2## Makefile.in for ICU - tools/genrb						#
3## Copyright (c) 1999-2009, International Business Machines Corporation and	#
4## others. All Rights Reserved.							#
5#################################################################################
6#
7#
8# For Help with this Makefile and the procedures for generating ICU4J data, please see
9# "icu4j-readme.txt" in $icu4c_root/source/data
10#
11#
12
13
14## Source directory information
15srcdir = @srcdir@
16top_srcdir = @top_srcdir@
17
18top_builddir = ../..
19
20include $(top_builddir)/icudefs.mk
21
22## Build directory information
23subdir = tools/genrb
24
25TARGET_STUB_NAME = genrb
26DERB_STUB_NAME = derb
27
28SECTION = 1
29
30MAN_FILES = $(TARGET_STUB_NAME).$(SECTION) $(DERB_STUB_NAME).$(SECTION)
31
32
33## Extra files to remove for 'make clean'
34CLEANFILES = *~ $(MAN_FILES) $(DEPS) $(DERB_DEPS)
35
36## Target information
37TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT)
38DERB = $(BINDIR)/$(DERB_STUB_NAME)$(EXEEXT)
39
40ifneq ($(top_builddir),$(top_srcdir))
41CPPFLAGS += -I$(top_builddir)/common
42endif
43CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(srcdir)/../toolutil
44LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M)
45
46OBJECTS = errmsg.o genrb.o parse.o read.o reslist.o ustr.o rbutil.o \
47wrtjava.o rle.o wrtxml.o prscmnts.o
48DERB_OBJ = derb.o
49
50DEPS = $(OBJECTS:.o=.d)
51DERB_DEPS = $(DERB_OBJ:.o=.d)
52
53# build-icu4j  variables
54GENDTJAR_ICUHOME=$(shell pwd)/../../..
55GENDTJAR_OPTS=--icu-root="$(GENDTJAR_ICUHOME)" --jar="$(GENDTJAR_JARHOME)" --icu4j-root="$(ICU4J_HOME)" --verbose
56GENDTJAR_TEMP=./temp/
57GENDTJAR=$(srcdir)/gendtjar.pl
58
59-include Makefile.local
60
61ifeq (,$(ICU4J_HOME))
62ICU4J_HOME=$(shell pwd)/icu4j
63endif
64
65##Added by Brian Rower 6/25/08
66##if JAVA_HOME was not set, try to set it by finding jar
67ifeq (,$(JAVA_HOME))
68JAVA_HOME=$(shell dirname `which jar`)/..
69ifeq (,$(GENDTJAR_JARHOME))
70GENDTJAR_JARHOME=$(shell dirname `which jar`)
71endif
72endif
73
74##if GENDTJAR_JARHOME (the directory that "jar" lives in) is not set
75##set it equal to $JAVA_HOME/bin
76ifeq (,$(GENDTJAR_JARHOME))
77GENDTJAR_JARHOME=""$(JAVA_HOME)"/bin"
78endif
79
80
81
82## List of phony targets
83.PHONY : all all-local install install-local clean clean-local	\
84distclean distclean-local dist dist-local check check-local install-man \
85build-icu4j
86
87## Clear suffix list
88.SUFFIXES :
89
90## List of standard targets
91all: all-local
92install: install-local
93clean: clean-local
94distclean : distclean-local
95dist: dist-local
96check: all check-local
97
98all-local: $(TARGET) $(DERB) $(MAN_FILES) 
99
100install-local: all-local install-man
101	$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
102	$(INSTALL) $(TARGET) $(DESTDIR)$(bindir)
103	$(INSTALL) $(DERB) $(DESTDIR)$(bindir)
104
105install-man: $(MAN_FILES)
106	$(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION)
107	$(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION)
108
109dist-local:
110
111clean-local:
112	test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
113	$(RMV) $(TARGET) $(DERB) $(OBJECTS) $(DERB_OBJ) $(GENDTJAR_TEMP)
114
115distclean-local: clean-local
116	$(RMV) Makefile
117
118check-local: all-local
119
120Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
121	cd $(top_builddir) \
122	 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
123
124$(TARGET) : $(OBJECTS)
125	$(LINK.cc) $(OUTOPT)$@ $^ $(LIBS) 
126	$(POST_BUILD_STEP)
127
128$(DERB) : $(DERB_OBJ)
129	$(LINK.cc) $(OUTOPT)$@ $^ $(LIBS)
130	$(POST_BUILD_STEP)
131
132#$(GENDTJAR_JARHOME)/jar:
133#	@echo $@ not found - make sure GENDTJAR_JARHOME is set. See Makefile.in
134#	exit 1
135
136$(ICU4J_HOME)/build.xml:
137	@echo warning: $@ not found - make sure ICU4J_HOME is set.
138
139
140#Removed GENDTJAR_JARHOME dependancy. If the file path happens to contain a space in it, 
141#having it as a target will cause it to error out when it thinks that there are TWO targets. - Brian Rower 6/25/08
142build-icu4j:	$(GENDTJAR) $(ICU4J_HOME)/build.xml #$(GENDTJAR_JARHOME)/jar
143	# clean up old temp files
144	-$(RMV) $(GENDTJAR_TEMP)
145	perl $(GENDTJAR) $(GENDTJAR_OPTS)
146	@echo Finished building to $(ICU4J_HOME)
147
148
149# This line is needed to serialize builds when the gmake -j option is used.
150$(TARGET_STUB_NAME).$(SECTION): $(DERB_STUB_NAME).$(SECTION)
151
152%.$(SECTION): $(srcdir)/%.$(SECTION).in
153	cd $(top_builddir) \
154	 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
155
156
157ifeq (,$(MAKECMDGOALS))
158-include $(DEPS)
159-include $(DERB_DEPS)
160else
161ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),)
162-include $(DEPS)
163endif
164endif
165
166