1## -*-makefile-*-
2## Copyright (C) 2016 and later: Unicode, Inc. and others.
3## License & terms of use: http://www.unicode.org/copyright.html
4## HP/UX-specific setup using aCC
5## Copyright (c) 1999-2012, International Business Machines Corporation and
6## others. All Rights Reserved.
7
8## Commands to generate dependency files
9GEN_DEPS.c=	:
10GEN_DEPS.cc= 	:
11
12## Flags for position independent code
13SHAREDLIBCFLAGS = +Z
14SHAREDLIBCXXFLAGS = +Z
15
16## Additional flags when building libraries with threads
17## We use this instead of -mt, which isn't available in all versions of aCC
18## Our tools won't compile with -D_POSIX_C_SOURCE=199506L
19THREADSCPPFLAGS = -D_REENTRANT -D_THREAD_SAFE
20
21# Use Extended ANSI mode, which is useful for 64-bit numbers
22# +W ignores some warnings
23#    740 Unsafe cast between pointers/references to incomplete classes...
24#    749 This operation is non-portable and potentially unsafe.
25#        (Ironically the solution to fix this warning is non-portable)
26#    823 Redundant preprocessing concatenation operation results in two valid
27#        preprocessing tokens. This comes from INT64_C in <inttypes.h>
28#   4232 conversion to a more strictly aligned type may cause misaligned access.
29CFLAGS += -Ae +Olit=all
30CXXFLAGS += -AA -Wc,-ansi_for_scope,on +W740 +W749 +W823 +W4232
31
32ifeq ($(UCLN_NO_AUTO_CLEANUP),0)
33# set up init point.
34UCLN_FINI =  ucln_fini$(TARGET_STUBNAME)_$(SO_TARGET_VERSION_MAJOR)$(ICULIBSUFFIXCNAME)
35CPPFLAGS_FINI = -DUCLN_FINI=$(UCLN_FINI)
36LDFLAGS_FINI = -Wl,+fini,$(UCLN_FINI)
37
38CPPFLAGSICUUC += $(CPPFLAGS_FINI)
39LDFLAGSICUUC += $(LDFLAGS_FINI)
40CPPFLAGSICUIO += $(CPPFLAGS_FINI)
41LDFLAGSICUIO += $(LDFLAGS_FINI)
42CPPFLAGSICUI18N += $(CPPFLAGS_FINI)
43LDFLAGSICUI18N += $(LDFLAGS_FINI)
44CPPFLAGSCTESTFW += $(CPPFLAGS_FINI)
45LDFLAGSCTESTFW += $(LDFLAGS_FINI)
46
47# ICUUC, ICUIO, ICUI18N, CTESTFW
48endif
49
50# -Bhidden_def Hides all symbols defined in the module.
51#LIBCFLAGS = -Bhidden_def
52#LIBCXXFLAGS = -Bhidden_def
53
54## Commands to compile
55COMPILE.c=	$(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c
56COMPILE.cc=	$(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) -c
57
58## Common 'default' path to ensure the sanity of users.  Search the current
59## directory, at least.
60LD_DEFAULTPATH= -Wl,+b,'$$'ORIGIN/
61
62# Use SHLIB_PATH and LD_LIBRARY_PATH to locate shared libraries
63LDFLAGS += -Wl,+s $(LD_DEFAULTPATH)
64
65## Commands to link
66## For aCC, use the C++ linker so that __shlinit gets defined
67LINK.c=		$(CXX) $(CXXFLAGS) $(LDFLAGS)
68LINK.cc=	$(CXX) $(CXXFLAGS) $(LDFLAGS)
69
70## Shared library options
71## HPUX PA-risc does not recognize -Bprotected_def aC++ option.
72## Use linker option -Wl,-B,symbolic instead.
73ifeq ($(shell uname -m),ia64)
74LD_SOOPTIONS= -Bprotected_def
75else
76LD_SOOPTIONS= -Wl,-B,symbolic
77endif
78
79## Commands to make a shared library
80#SHLIB.c=	$(LD) $(LDFLAGS) -b
81SHLIB.c=	$(CXX) $(CXXFLAGS) $(LDFLAGS) -b $(LD_SOOPTIONS)
82SHLIB.cc=	$(CXX) $(CXXFLAGS) $(LDFLAGS) -b $(LD_SOOPTIONS)
83
84## Compiler switch to embed a runtime search path
85LD_RPATH=	-Wl,+b,
86LD_RPATH_PRE= 	
87
88## Environment variable to set a runtime search path
89LDLIBRARYPATH_ENVVAR = SHLIB_PATH
90
91## Compiler switch to embed a library name
92LD_SONAME = -Wl,+h,$(notdir $(MIDDLE_SO_TARGET))
93
94## The type of assembly needed when pkgdata is used for generating shared libraries.
95# Commented out for now because the hp1 test machine runs out of memory.
96#GENCCODE_ASSEMBLY=-a aCC-parisc
97
98## Shared object suffix
99SO=		sl
100## Non-shared intermediate object suffix
101STATIC_O = o
102
103## Compilation rules
104%.$(STATIC_O): $(srcdir)/%.c
105	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
106%.o: $(srcdir)/%.c
107	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
108
109%.$(STATIC_O): $(srcdir)/%.cpp
110	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
111%.o: $(srcdir)/%.cpp
112	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
113
114
115## Dependency rules
116%.d : $(srcdir)/%.c
117	@echo "generating dependency information for $<"
118	@$(GEN_DEPS.c) $< > $@
119
120%.d : $(srcdir)/%.cpp
121	@echo "generating dependency information for $<"
122	@$(GEN_DEPS.cc) $< > $@
123
124## Versioned libraries rules
125
126%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION)
127	$(RM) $@ && ln -s ${<F} $@
128%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR)
129	$(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@
130
131## Install libraries as executable
132INSTALL-L=$(INSTALL_PROGRAM)
133
134## Remove shared library 's'
135STATIC_PREFIX_WHEN_USED = 
136STATIC_PREFIX = 
137
138## End HP/UX-specific setup
139