• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## -*-makefile-*-
2## BSD-specific setup (FreeBSD, OpenBSD, NetBSD, *BSD)
3## Copyright (c) 1999-2006, International Business Machines Corporation and
4## others. All Rights Reserved.
5
6## Commands to generate dependency files
7GEN_DEPS.c=	$(CC) -E -MM $(DEFS) $(CPPFLAGS)
8GEN_DEPS.cc=	$(CXX) -E -MM $(DEFS) $(CPPFLAGS)
9
10## Flags for position independent code
11SHAREDLIBCFLAGS = -fPIC
12SHAREDLIBCXXFLAGS = -fPIC
13SHAREDLIBCPPFLAGS = -DPIC
14
15## Additional flags when building libraries and with threads
16THREADSCPPFLAGS = -D_REENTRANT
17LIBCPPFLAGS =
18
19## Compiler switch to embed a runtime search path
20LD_RPATH=
21LD_RPATH_PRE=	-Wl,-rpath,
22
23## Compiler switch to embed a library name
24LD_SONAME = -Wl,-soname -Wl,$(notdir $(MIDDLE_SO_TARGET))
25
26## Shared object suffix
27SO = so
28## Non-shared intermediate object suffix
29STATIC_O = ao
30
31## Compilation rules
32%.$(STATIC_O): $(srcdir)/%.c
33	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
34%.o: $(srcdir)/%.c
35	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
36
37%.$(STATIC_O): $(srcdir)/%.cpp
38	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
39%.o: $(srcdir)/%.cpp
40	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
41
42
43## Dependency rules
44%.d: $(srcdir)/%.c
45	@echo "generating dependency information for $<"
46	@$(SHELL) -ec '$(GEN_DEPS.c) $< \
47		| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
48		[ -s $@ ] || rm -f $@'
49
50%.d: $(srcdir)/%.cpp
51	@echo "generating dependency information for $<"
52	@$(SHELL) -ec '$(GEN_DEPS.cc) $< \
53		| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
54		[ -s $@ ] || rm -f $@'
55
56## Versioned libraries rules
57
58%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION)
59	$(RM) $@ && ln -s ${<F} $@
60%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR)
61	$(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@
62
63## End FreeBSD-specific setup
64
65