• 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-2016, International Business Machines
6#   Corporation and others.  All Rights Reserved.
7#
8#******************************************************************************
9## Makefile.in for ICU - icuuc.so
10## Stephen F. Booth
11
12## Source directory information
13srcdir = @srcdir@
14top_srcdir = @top_srcdir@
15
16top_builddir = ..
17
18## All the flags and other definitions are included here.
19include $(top_builddir)/icudefs.mk
20
21## Build directory information
22subdir = common
23
24# for service hook
25LOCALSVC_CPP=localsvc.cpp
26SVC_HOOK_INC=$(top_builddir)/common/svchook.mk
27
28## Extra files to remove for 'make clean'
29CLEANFILES = *~ $(DEPS) $(IMPORT_LIB) $(MIDDLE_IMPORT_LIB) $(FINAL_IMPORT_LIB) $(SVC_HOOK_INC)
30
31## Target information
32
33TARGET_STUBNAME=$(COMMON_STUBNAME)
34
35ifneq ($(ENABLE_STATIC),)
36TARGET = $(LIBDIR)/$(LIBSICU)$(TARGET_STUBNAME)$(ICULIBSUFFIX).$(A)
37endif
38
39ifneq ($(ENABLE_SHARED),)
40SO_TARGET = $(LIBDIR)/$(LIBICU)$(TARGET_STUBNAME)$(ICULIBSUFFIX).$(SO)
41ALL_SO_TARGETS = $(SO_TARGET) $(MIDDLE_SO_TARGET) $(FINAL_SO_TARGET) $(SHARED_OBJECT)
42
43ifeq ($(ENABLE_SO_VERSION_DATA),1)
44SO_VERSION_DATA = common.res
45endif
46
47ifeq ($(BUILD_HOST_ICU),OS390)
48BATCH_TARGET = $(BATCH_COMMON_TARGET)
49BATCH_LIBS = $(BATCH_LIBICUDT) -lm
50endif
51
52endif   # ENABLE_SHARED
53
54ALL_TARGETS = $(TARGET) $(ALL_SO_TARGETS) $(BATCH_TARGET)
55
56DYNAMICCPPFLAGS = $(SHAREDLIBCPPFLAGS)
57DYNAMICCFLAGS = $(SHAREDLIBCFLAGS)
58DYNAMICCXXFLAGS = $(SHAREDLIBCXXFLAGS)
59CFLAGS += $(LIBCFLAGS)
60CXXFLAGS += $(LIBCXXFLAGS)
61
62CPPFLAGS += -I$(srcdir) $(LIBCPPFLAGS) $(CPPFLAGSICUUC)
63# we want DEFS here
64DEFS += -DU_COMMON_IMPLEMENTATION
65LDFLAGS += $(LDFLAGSICUUC)
66
67# for plugin configuration
68CPPFLAGS += "-DDEFAULT_ICU_PLUGINS=\"$(libdir)/icu\" "
69
70# for icu data location
71ifeq ($(PKGDATA_MODE),common)
72CPPFLAGS += "-DU_ICU_DATA_DEFAULT_DIR=\"$(ICUDATA_DIR)\""
73endif
74
75# $(LIBICUDT) is either stub data or the real DLL common data.
76LIBS = $(LIBICUDT) $(DEFAULT_LIBS)
77
78SOURCES = $(shell cat $(srcdir)/sources.txt)
79OBJECTS = $(SOURCES:.cpp=.o)
80
81## Header files to install
82HEADERS = $(srcdir)/unicode/*.h
83
84STATIC_OBJECTS = $(OBJECTS:.o=.$(STATIC_O))
85
86DEPS = $(OBJECTS:.o=.d)
87
88-include Makefile.local
89
90-include $(SVC_HOOK_INC)
91
92
93## List of phony targets
94.PHONY : all all-local install install-local clean clean-local	\
95distclean distclean-local install-library install-headers dist	\
96dist-local check check-local check-exhaustive
97
98## Clear suffix list
99.SUFFIXES :
100
101## List of standard targets
102all: all-local
103install: install-local
104clean: clean-local
105distclean : distclean-local
106dist: dist-local
107check: all check-local
108
109check-exhaustive: check
110
111all-local: $(ALL_TARGETS)
112
113install-local: install-headers install-library
114
115install-library: all-local
116	$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
117ifneq ($(ENABLE_STATIC),)
118	$(INSTALL-L) $(TARGET) $(DESTDIR)$(libdir)
119endif
120ifneq ($(ENABLE_SHARED),)
121# For MinGW, do we want the DLL to go in the bin location?
122ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
123	$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
124	$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(bindir)
125else
126	$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(libdir)
127ifneq ($(FINAL_SO_TARGET),$(SO_TARGET))
128	cd $(DESTDIR)$(libdir) && $(RM) $(notdir $(SO_TARGET)) && ln -s $(notdir $(FINAL_SO_TARGET)) $(notdir $(SO_TARGET))
129ifneq ($(FINAL_SO_TARGET),$(MIDDLE_SO_TARGET))
130	cd $(DESTDIR)$(libdir) && $(RM) $(notdir $(MIDDLE_SO_TARGET)) && ln -s $(notdir $(FINAL_SO_TARGET)) $(notdir $(MIDDLE_SO_TARGET))
131endif
132endif
133endif
134ifneq ($(IMPORT_LIB_EXT),)
135	$(INSTALL-L) $(FINAL_IMPORT_LIB) $(DESTDIR)$(libdir)
136ifneq ($(IMPORT_LIB),$(FINAL_IMPORT_LIB))
137	cd $(DESTDIR)$(libdir) && $(RM) $(notdir $(IMPORT_LIB)) && ln -s $(notdir $(FINAL_IMPORT_LIB)) $(notdir $(IMPORT_LIB))
138endif
139ifneq ($(MIDDLE_IMPORT_LIB),$(FINAL_IMPORT_LIB))
140	cd $(DESTDIR)$(libdir) && $(RM) $(notdir $(MIDDLE_IMPORT_LIB)) && ln -s $(notdir $(FINAL_IMPORT_LIB)) $(notdir $(MIDDLE_IMPORT_LIB))
141endif
142endif
143endif
144
145$(SVC_HOOK_INC):
146	@echo generating $@
147	@-test -f $(top_srcdir)/common/$(LOCALSVC_CPP) && ( echo "have $(LOCALSVC_CPP) - U_LOCAL_SERVICE_HOOK=1" ; \
148		echo 'CPPFLAGS +=-DU_LOCAL_SERVICE_HOOK=1' > $@ ; \
149		echo 'OBJECTS += $(LOCALSVC_CPP:%.cpp=%.o)' >> $@ \
150		 ) ; true
151	@echo "# Autogenerated by Makefile" >> $@
152
153install-headers:
154	$(MKINSTALLDIRS) $(DESTDIR)$(includedir)/unicode
155	@for file in $(HEADERS); do \
156	 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/unicode"; \
157	 $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/unicode || exit; \
158	done
159
160dist-local:
161
162clean-local:
163	test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
164	$(RMV) $(OBJECTS) $(STATIC_OBJECTS) $(ALL_TARGETS) $(SO_VERSION_DATA)
165
166distclean-local: clean-local
167	$(RMV) Makefile icucfg.h $(SVC_HOOK_INC)
168
169check-local:
170
171Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(SVC_HOOK_INC)
172	cd $(top_builddir) \
173	 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
174
175ifneq ($(ENABLE_STATIC),)
176$(TARGET): $(STATIC_OBJECTS)
177	$(AR) $(ARFLAGS) $(AR_OUTOPT)$@ $^
178	$(RANLIB) $@
179endif
180
181ifneq ($(ENABLE_SHARED),)
182$(SHARED_OBJECT): $(OBJECTS) $(SO_VERSION_DATA)
183	$(SHLIB.cc) $(LD_SONAME) $(OUTOPT)$@ $^ $(LIBS)
184ifeq ($(ENABLE_RPATH),YES)
185ifneq ($(wildcard $(libdir)/$(MIDDLE_SO_TARGET)),)
186	$(warning RPATH warning: --enable-rpath means test programs may use existing $(libdir)/$(MIDDLE_SO_TARGET))
187endif
188endif
189
190ifeq ($(BUILD_HOST_ICU),OS390)
191$(BATCH_TARGET):$(OBJECTS)
192	$(SHLIB.cc) $(LD_SONAME) -Wl,-x$@.x $(OUTOPT)$@ $^ $(BATCH_LIBS)
193endif
194endif   # ENABLE_SHARED
195
196ifeq (,$(MAKECMDGOALS))
197-include $(DEPS)
198else
199ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),)
200-include $(DEPS)
201endif
202endif
203
204