1## -*-makefile-*-
2## Copyright (C) 2016 and later: Unicode, Inc. and others.
3## License & terms of use: http://www.unicode.org/copyright.html
4## HPUX/gcc specific setup
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=	$(CC) -E -MM $(DEFS) $(CPPFLAGS)
10GEN_DEPS.cc=	$(CXX) -E -MM $(DEFS) $(CPPFLAGS)
11
12## Flags for position independent code
13SHAREDLIBCFLAGS = -fPIC
14SHAREDLIBCXXFLAGS = -fPIC
15SHAREDLIBCPPFLAGS = -DPIC
16
17## Common 'default' path to ensure the sanity of users.  Search the current
18## directory, at least.
19LD_DEFAULTPATH= -Wl,+b,.:'$$'ORIGIN/
20
21# Need to override this or we will get unworking assembly
22#GENCCODE_ASSEMBLY=-a gcc
23GENCCODE_ASSEMBLY=
24
25# Get some handy functions defined properly
26DEFS += -D_HPUX_SOURCE -D_POSIX_C_SOURCE=199506L
27
28## Commands to link
29## For aCC, use the C++ linker so that __shlinit gets defined
30LINK.c=     $(CXX) $(DEFS) $(LDFLAGS) -Wl,+s $(LD_DEFAULTPATH)
31LINK.cc=    $(CXX) $(DEFS) $(LDFLAGS) -Wl,+s $(LD_DEFAULTPATH)
32
33## Shared library options
34LD_SOOPTIONS= -Wl,-Bsymbolic
35
36## Commands to make a shared library
37SHLIB.c=  $(CC) $(DEFS) $(CFLAGS) $(LDFLAGS) $(SHAREDLIBCXXFLAGS) -shared -Wl,+s $(LD_DEFAULTPATH) $(LD_SOOPTIONS)
38SHLIB.cc= $(CXX) $(DEFS) $(CXXFLAGS) $(LDFLAGS) $(SHAREDLIBCXXFLAGS) -shared -Wl,+s $(LD_DEFAULTPATH) $(LD_SOOPTIONS)
39
40## Compiler switch to embed a runtime search path
41LD_RPATH=   -Wl,+b,
42LD_RPATH_PRE=
43
44## Compiler switch to embed a library name
45LD_SONAME = -Wl,+h,$(notdir $(MIDDLE_SO_TARGET))
46
47## Environment variable to set a runtime search path
48LDLIBRARYPATH_ENVVAR = SHLIB_PATH
49
50## Shared object suffix
51SO=		sl
52## Non-shared intermediate object suffix
53STATIC_O = o
54
55## Compilation rules
56%.$(STATIC_O): $(srcdir)/%.c
57	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
58%.o: $(srcdir)/%.c
59	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
60
61%.$(STATIC_O): $(srcdir)/%.cpp
62	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
63%.o: $(srcdir)/%.cpp
64	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
65
66
67## Dependency rules
68%.d : $(srcdir)/%.c
69	@echo "Generating dependency information for $<"
70	@$(SHELL) -ec '$(GEN_DEPS.c) $< \
71		| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
72		[ -s $@ ] || rm -f $@'
73
74%.d : $(srcdir)/%.cpp
75	@echo "Generating dependency information for $<"
76	@$(SHELL) -ec '$(GEN_DEPS.cc) $< \
77		| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
78		[ -s $@ ] || rm -f $@'
79
80## Versioned libraries rules
81
82%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION)
83	$(RM) $@ && ln -s ${<F} $@
84%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR)
85	$(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@
86
87## Remove shared library 's'
88STATIC_PREFIX_WHEN_USED =
89STATIC_PREFIX =
90
91## End HPUX/gcc specific setup
92
93