1## ******************************************************************************
2## *
3## *   Copyright (C) 1999-2014, International Business Machines
4## *   Corporation and others.  All Rights Reserved.
5## *
6## *******************************************************************************
7## Makefile.in for ICU - uconv
8## Steven  R. Loomis
9
10## Set the following to dll or static or common..
11UCONVMSG_MODE=static
12##############################################################
13
14srcdir=@srcdir@
15top_srcdir=@top_srcdir@
16
17top_builddir = ../..
18subdir = extra/uconv
19
20include $(top_builddir)/icudefs.mk
21
22MSGNAME=uconvmsg
23
24# RESSRC comes from resfiles.mk
25FILESEPCHAR=/
26include $(srcdir)/resfiles.mk
27
28RESDIR=$(MSGNAME)
29RESFILES=$(RESSRC:$(RESOURCESDIR)$(FILESEPCHAR)%.txt=$(RESDIR)/%.res)
30
31##
32
33TARGET_STUB_NAME = uconv
34
35SECTION = 1
36
37ALL_MAN_FILES = $(TARGET_STUB_NAME).$(SECTION)
38
39## Extra files to remove for 'make clean'
40CLEANFILES = *~ $(DEPS) $(ALL_MAN_FILES)
41
42## Target information
43TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT)
44
45CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(srcdir)/../toolutil
46CPPFLAGS += -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit
47LIBS = $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M)
48
49ifeq ($(PKGDATA_OPTS),)
50PKGDATA_OPTS = -O pkgdata.inc
51endif
52
53## generic settings for data - common.
54PKGMODE=common
55INSTALLTO=$(DESTDIR)$(ICUDATA_DIR)
56UCONVMSG_LIB=package-resfiles
57
58## Static mode
59ifeq ($(UCONVMSG_MODE),static)
60DEFS += -DUCONVMSG_LINK=$(MSGNAME)
61UCONVMSG_LIB = $(RESDIR)/$(LIBPREFIX)$(STATIC_PREFIX_WHEN_USED)$(MSGNAME).$(A)
62LIBS += $(UCONVMSG_LIB)
63PKGMODE=static
64INSTALLTO=$(libdir)
65endif
66
67## DLL mode
68ifeq ($(UCONVMSG_MODE),dll)
69DEFS += -DUCONVMSG_LINK=$(MSGNAME)
70LIBS += -L$(RESDIR) -l$(MSGNAME)
71PKGMODE=dll
72INSTALLTO=$(libdir)
73endif
74
75OBJECTS = uconv.o uwmsg.o
76
77DEPS = $(OBJECTS:.o=.d)
78
79## List of phony targets
80.PHONY : all all-local install install-local clean clean-local \
81distclean resclean distclean-local dist dist-local \
82check check-local build-dir package-resfiles install-resfiles install-man
83
84## Clear suffix list
85.SUFFIXES :
86
87## List of standard targets
88all: all-local
89
90install: install-local
91clean: clean-local
92distclean : distclean-local
93dist: dist-local
94check: check-local
95
96all-local: build-dir $(TARGET) $(ALL_MAN_FILES)
97
98install-local: all-local install-target install-resfiles install-man
99
100install-target: all-local
101	$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
102	$(INSTALL) $(TARGET) $(DESTDIR)$(bindir)
103
104dist-local:
105
106clean-local: resclean
107	test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES) $(RESFILES)
108	$(RMV) $(OBJECTS) $(TARGET)
109
110resclean:
111	@#-$(INVOKE) $(TOOLBINDIR)/pkgdata --clean -p $(RESDIR) -O pkgdata.inc -m $(PKGMODE) -d $(RESDIR) -T $(RESDIR) $(RESDIR)/$(RESDIR).lst
112	$(RMV) pkgdata.inc $(RESDIR)
113
114distclean-local: clean-local
115	$(RMV) Makefile $(DEPS)
116
117check-local: $(TARGET)
118ifneq (,$(filter $(PKGDATA_MODE),files common))
119	@echo "Currently, pkgdata is in \"$(PKGDATA_MODE)\" mode."
120	@echo "To test uconv, run this manually after installing ICU:"
121	@echo "\"./$(TARGET) -f ibm-37 $(srcdir)/samples/ibm-37-test.txt\""
122else
123	$(INVOKE) ./$(TARGET) -f ibm-37 $(srcdir)/samples/ibm-37-test.txt
124endif
125
126Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
127	cd $(top_builddir) \
128	 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
129
130pkgdata.inc: pkgdataMakefile
131	$(MAKE) -f pkgdataMakefile
132
133build-dir:
134	@$(MKINSTALLDIRS) $(RESDIR)
135
136pkgdataMakefile:
137	cd $(top_builddir) \
138	&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
139
140$(TARGET_STUB_NAME).$(SECTION): $(srcdir)/$(TARGET_STUB_NAME).$(SECTION).in pkgdata.inc
141	cd $(top_builddir) \
142	 && CONFIG_FILES=$(subdir)/$(TARGET_STUB_NAME).$(SECTION) CONFIG_HEADERS= $(SHELL) ./config.status
143
144$(TARGET) : $(OBJECTS)  $(UCONVMSG_LIB)
145	$(LINK.cc) $(OUTOPT)$@ $(OBJECTS) $(LIBS)
146	$(POST_BUILD_STEP)
147
148# The | is an order-only prerequisite. This helps when the -j option is used,
149# and we don't want the files to be built before the directories are built.
150ifneq ($(filter order-only,$(.FEATURES)),)
151$(RESFILES) $(RESDIR)/$(RESDIR).lst: | build-dir
152endif
153
154$(UCONVMSG_LIB): $(RESFILES) $(RESDIR)/$(RESDIR).lst pkgdata.inc
155	$(INVOKE) $(PKGDATA_INVOKE_OPTS) $(TOOLBINDIR)/pkgdata -p $(MSGNAME) $(PKGDATA_OPTS) -m $(PKGMODE) -s $(RESDIR) -d $(RESDIR) -T $(RESDIR) $(RESDIR)/$(RESDIR).lst
156
157$(RESDIR)/$(RESDIR).lst: Makefile $(srcdir)/resfiles.mk
158	@-$(RMV) $@
159	@for file in $(RESFILES:$(RESDIR)/%.res=%.res); do \
160	  echo $$file >> $@; \
161	done;
162
163# no install for static mode
164ifneq ($(UCONVMSG_MODE),static)
165install-resfiles: $(RESFILES) $(RESDIR)/$(RESDIR).lst pkgdata.inc 
166	$(MKINSTALLDIRS) $(DESTDIR)$(ICUDATA_DIR)
167	$(INVOKE) $(TOOLBINDIR)/pkgdata -p $(RESDIR) -O pkgdata.inc -m $(PKGMODE) -d $(RESDIR) -I $(INSTALLTO) -T $(RESDIR) $(RESDIR)/$(RESDIR).lst
168else
169install-resfiles:
170endif
171
172$(MSGNAME)/%.res: $(srcdir)/$(RESOURCESDIR)/%.txt
173	$(INVOKE) $(TOOLBINDIR)/genrb -e UTF-8 -s $(^D) -d $(@D) $(^F)
174
175install-man: $(ALL_MAN_FILES)
176	$(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION)
177	$(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION)
178
179
180
181