1c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott## -*-makefile-*-
2c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott## Linux-specific setup
3c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott## Copyright (c) 1999-2006, International Business Machines Corporation and
4c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott## others. All Rights Reserved.
5c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
6c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott## Commands to generate dependency files
7c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottGEN_DEPS.c=	$(CC) -E -MM $(DEFS) $(CPPFLAGS)
8c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottGEN_DEPS.cc=	$(CXX) -E -MM $(DEFS) $(CPPFLAGS)
9c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
10c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott## Flags for position independent code
11c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottSHAREDLIBCFLAGS = -fPIC
12c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottSHAREDLIBCXXFLAGS = -fPIC
13c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottSHAREDLIBCPPFLAGS = -DPIC
14c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
15c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott## Additional flags when building libraries and with threads
16c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottTHREADSCPPFLAGS = -D_REENTRANT
17c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottLIBCPPFLAGS =
18c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
19c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott# The tests need complete IEEE floating point support
20c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottCFLAGS += -mieee
21c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottCXXFLAGS += -mieee
22c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
23c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott## Compiler switch to embed a runtime search path
24c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottLD_RPATH=	
25c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottLD_RPATH_PRE=	-Wl,-rpath,
26c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
27c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott## Compiler switch to embed a library name
28c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottLD_SONAME = -Wl,-soname -Wl,$(notdir $(MIDDLE_SO_TARGET))
29c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
30c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott## Shared object suffix
31c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottSO = so
32c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott## Non-shared intermediate object suffix
33c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottSTATIC_O = ao
34c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
35c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott## Compilation rules
36c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott%.$(STATIC_O): $(srcdir)/%.c
37c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
38c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott%.o: $(srcdir)/%.c
39c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
40c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
41c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott%.$(STATIC_O): $(srcdir)/%.cpp
42c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
43c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott%.o: $(srcdir)/%.cpp
44c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
45c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
46c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
47c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott## Dependency rules
48c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott%.d: $(srcdir)/%.c
49c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott	@echo "generating dependency information for $<"
50c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott	@$(SHELL) -ec '$(GEN_DEPS.c) $< \
51c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott		| sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
52c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott		[ -s $@ ] || rm -f $@'
53c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
54c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott%.d: $(srcdir)/%.cpp
55c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott	@echo "generating dependency information for $<"
56c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott	@$(SHELL) -ec '$(GEN_DEPS.cc) $< \
57c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott		| sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
58c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott		[ -s $@ ] || rm -f $@'
59c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
60c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott## Versioned libraries rules
61c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
62c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION)
63c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott	$(RM) $@ && ln -s ${<F} $@
64c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR)
65c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott	$(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@
66c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
67c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott# The type of assembly to write for generating an object file
68c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottGENCCODE_ASSEMBLY=-a gcc
69c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
70c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott##  Bind internal references
71c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
72c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott# LDflags that pkgdata will use
73c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottBIR_LDFLAGS= -Wl,-Bsymbolic
74c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
75c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott# Dependencies [i.e. map files] for the final library
76c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottBIR_DEPS=
77c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
78c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott## End Linux-specific setup
79c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
80