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