• 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 ($(OS390BATCH),1)
48BATCH_TARGET = $(BATCH_COMMON_TARGET)
49BATCH_LIBS = $(BATCH_LIBICUDT) -lm
50endif   # OS390BATCH
51
52endif   # ENABLE_SHARED
53
54ALL_TARGETS = $(TARGET) $(ALL_SO_TARGETS) $(BATCH_TARGET)
55
56DYNAMICCPPFLAGS = $(SHAREDLIBCPPFLAGS)
57DYNAMICCFLAGS = $(SHAREDLIBCFLAGS)
58DYNAMICCXXFLAGS = $(SHAREDLIBCXXFLAGS)
59CFLAGS += $(LIBCFLAGS)
60CXXFLAGS += $(LIBCXXFLAGS)
61ifeq ($(OS390BATCH),1)
62CFLAGS += -WI
63CXXFLAGS += -WI
64endif
65
66CPPFLAGS += -I$(srcdir) $(LIBCPPFLAGS) $(CPPFLAGSICUUC)
67# we want DEFS here
68DEFS += -DU_COMMON_IMPLEMENTATION
69LDFLAGS += $(LDFLAGSICUUC)
70
71# for plugin configuration
72CPPFLAGS += "-DDEFAULT_ICU_PLUGINS=\"$(libdir)/icu\" "
73
74# for icu data location
75ifeq ($(PKGDATA_MODE),common)
76CPPFLAGS += "-DU_ICU_DATA_DEFAULT_DIR=\"$(ICUDATA_DIR)\""
77endif
78
79# $(LIBICUDT) is either stub data or the real DLL common data.
80LIBS = $(LIBICUDT) $(DEFAULT_LIBS)
81
82SOURCES = $(shell cat $(srcdir)/sources.txt)
83OBJECTS = $(SOURCES:.cpp=.o)
84
85## Header files to install
86HEADERS = $(srcdir)/unicode/*.h
87
88STATIC_OBJECTS = $(OBJECTS:.o=.$(STATIC_O))
89
90DEPS = $(OBJECTS:.o=.d)
91
92-include Makefile.local
93
94-include $(SVC_HOOK_INC)
95
96
97## List of phony targets
98.PHONY : all all-local install install-local clean clean-local	\
99distclean distclean-local install-library install-headers dist	\
100dist-local check check-local check-exhaustive
101
102## Clear suffix list
103.SUFFIXES :
104
105## List of standard targets
106all: all-local
107install: install-local
108clean: clean-local
109distclean : distclean-local
110dist: dist-local
111check: all check-local
112
113check-exhaustive: check
114
115all-local: $(ALL_TARGETS)
116
117install-local: install-headers install-library
118
119install-library: all-local
120	$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
121ifneq ($(ENABLE_STATIC),)
122	$(INSTALL-L) $(TARGET) $(DESTDIR)$(libdir)
123endif
124ifneq ($(ENABLE_SHARED),)
125# For MinGW, do we want the DLL to go in the bin location?
126ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
127	$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
128	$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(bindir)
129else
130	$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(libdir)
131ifneq ($(FINAL_SO_TARGET),$(SO_TARGET))
132	cd $(DESTDIR)$(libdir) && $(RM) $(notdir $(SO_TARGET)) && ln -s $(notdir $(FINAL_SO_TARGET)) $(notdir $(SO_TARGET))
133ifneq ($(FINAL_SO_TARGET),$(MIDDLE_SO_TARGET))
134	cd $(DESTDIR)$(libdir) && $(RM) $(notdir $(MIDDLE_SO_TARGET)) && ln -s $(notdir $(FINAL_SO_TARGET)) $(notdir $(MIDDLE_SO_TARGET))
135endif
136endif
137endif
138ifneq ($(IMPORT_LIB_EXT),)
139	$(INSTALL-L) $(FINAL_IMPORT_LIB) $(DESTDIR)$(libdir)
140ifneq ($(IMPORT_LIB),$(FINAL_IMPORT_LIB))
141	cd $(DESTDIR)$(libdir) && $(RM) $(notdir $(IMPORT_LIB)) && ln -s $(notdir $(FINAL_IMPORT_LIB)) $(notdir $(IMPORT_LIB))
142endif
143ifneq ($(MIDDLE_IMPORT_LIB),$(FINAL_IMPORT_LIB))
144	cd $(DESTDIR)$(libdir) && $(RM) $(notdir $(MIDDLE_IMPORT_LIB)) && ln -s $(notdir $(FINAL_IMPORT_LIB)) $(notdir $(MIDDLE_IMPORT_LIB))
145endif
146endif
147endif
148
149$(SVC_HOOK_INC):
150	@echo generating $@
151	@-test -f $(top_srcdir)/common/$(LOCALSVC_CPP) && ( echo "have $(LOCALSVC_CPP) - U_LOCAL_SERVICE_HOOK=1" ; \
152		echo 'CPPFLAGS +=-DU_LOCAL_SERVICE_HOOK=1' > $@ ; \
153		echo 'OBJECTS += $(LOCALSVC_CPP:%.cpp=%.o)' >> $@ \
154		 ) ; true
155	@echo "# Autogenerated by Makefile" >> $@
156
157install-headers:
158	$(MKINSTALLDIRS) $(DESTDIR)$(includedir)/unicode
159	@for file in $(HEADERS); do \
160	 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/unicode"; \
161	 $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/unicode || exit; \
162	done
163
164dist-local:
165
166clean-local:
167	test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
168	$(RMV) $(OBJECTS) $(STATIC_OBJECTS) $(ALL_TARGETS) $(SO_VERSION_DATA)
169
170distclean-local: clean-local
171	$(RMV) Makefile icucfg.h $(SVC_HOOK_INC)
172
173check-local:
174
175Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(SVC_HOOK_INC)
176	cd $(top_builddir) \
177	 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
178
179ifneq ($(ENABLE_STATIC),)
180$(TARGET): $(STATIC_OBJECTS)
181	$(AR) $(ARFLAGS) $(AR_OUTOPT)$@ $^
182	$(RANLIB) $@
183endif
184
185ifneq ($(ENABLE_SHARED),)
186$(SHARED_OBJECT): $(OBJECTS) $(SO_VERSION_DATA)
187	$(SHLIB.cc) $(LD_SONAME) $(OUTOPT)$@ $^ $(LIBS)
188ifeq ($(ENABLE_RPATH),YES)
189ifneq ($(wildcard $(libdir)/$(MIDDLE_SO_TARGET)),)
190	$(warning RPATH warning: --enable-rpath means test programs may use existing $(libdir)/$(MIDDLE_SO_TARGET))
191endif
192endif
193
194ifeq ($(OS390BATCH),1)
195$(BATCH_TARGET):$(OBJECTS)
196	$(SHLIB.cc) $(LD_SONAME) $(OUTOPT)$@ $^ $(BATCH_LIBS)
197endif   # OS390BATCH
198endif   # ENABLE_SHARED
199
200ifeq (,$(MAKECMDGOALS))
201-include $(DEPS)
202else
203ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),)
204-include $(DEPS)
205endif
206endif
207
208