1## -*-makefile-*-
2## IRIX-specific setup (for CC)
3## Copyright (c) 1999-2006, International Business Machines Corporation and
4## others. All Rights Reserved.
5
6## Flags for position independent code
7SHAREDLIBCFLAGS = -shared
8SHAREDLIBCXXFLAGS = -shared
9SHAREDLIBCPPFLAGS =
10
11## Commands to generate dependency files
12GEN_DEPS.c=	$(CC) -E -M $(DEFS) $(CPPFLAGS)
13GEN_DEPS.cc=	$(CXX) -E -M $(DEFS) $(CPPFLAGS)
14
15## Commands to link
16## We need to use the C++ linker, even when linking C programs, since
17##  our libraries contain C++ code (C++ static init not called)
18#LINK.c=	$(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
19LINK.c=		$(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS)
20LINK.cc=	$(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS)
21
22## Commands to make a shared library
23SHLIB.c=    $(CC) -shared $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS)
24SHLIB.cc=   $(CXX) -shared $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS)
25
26## Additional flags when building libraries with thread safety
27THREADSCPPFLAGS = -D_REENTRANT -D_PTHREADS
28LIBCPPFLAGS =
29
30## Compiler switch to embed a runtime search path
31LD_RPATH=
32LD_RPATH_PRE=  -Wl,-rpath,
33
34## Compiler switch to embed a library name
35LD_SONAME = -Wl,-soname -Wl,$(notdir $(MIDDLE_SO_TARGET))
36
37## Shared object suffix
38SO=		so
39## Non-shared intermediate object suffix
40STATIC_O = ao
41
42## Compilation rules
43%.$(STATIC_O): $(srcdir)/%.c
44	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
45%.o: $(srcdir)/%.c
46	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
47
48%.$(STATIC_O): $(srcdir)/%.cpp
49	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
50%.o: $(srcdir)/%.cpp
51	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
52
53
54## Dependency rules
55%.d : $(srcdir)/%.c
56	@echo "generating dependency information for $<"
57	@$(SHELL) -ec '$(GEN_DEPS.c) $< \
58		| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
59		[ -s $@ ] || rm -f $@'
60
61%.d : $(srcdir)/%.cpp
62	@echo "generating dependency information for $<"
63	@$(SHELL) -ec '$(GEN_DEPS.cc) $< \
64		| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
65		[ -s $@ ] || rm -f $@'
66
67## Versioned libraries rules
68
69%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION)
70	$(RM) $@ && ln -s ${<F} $@
71%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR)
72	$(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@
73
74## End IRIX-specific setup
75