2 ## Darwin-specific setup (Darwin is the Mac OS X developer preview, successor
3 ## to Rhapsody, aka Mac OS X Server)
4 ## Copyright (c) 1999-2003, International Business Machines Corporation and
5 ## others. All Rights Reserved.
7 ## $Id: mh-darwin,v 1.6 2003/07/03 23:51:33 avery Exp $
9 ## Flags for position independent code
10 SHAREDLIBCFLAGS = -dynamic
11 SHAREDLIBCXXFLAGS = -dynamic
14 # Pad out the paths to the maximum possible length
15 LD_FLAGS += -headerpad_max_install_names
17 ## Commands to generate dependency files
18 GEN_DEPS.c= $(CC) -E -MMD $(DEFS) $(CPPFLAGS)
19 GEN_DEPS.cc= $(CXX) -E -MMD $(DEFS) $(CPPFLAGS)
21 ## Commands to compile
22 COMPILE.c= $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -fno-common -c
23 COMPILE.cc= $(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) -fno-common -c
25 ## Commands to make a shared library
26 SHLIB.c= $(CC) -dynamiclib -dynamic $(CFLAGS) $(LDFLAGS) -install_name $(MIDDLE_SO_TARGET)
27 SHLIB.cc= $(CXX) -dynamiclib -dynamic $(CXXFLAGS) $(LDFLAGS) -install_name $(MIDDLE_SO_TARGET)
29 ## Compiler switch to embed a runtime search path
33 ## Environment variable to set a runtime search path
34 LDLIBRARYPATH_ENVVAR = DYLD_LIBRARY_PATH
36 ## Shared object suffix
38 ## Non-shared intermediate object suffix
41 ## Versioned target for a shared library.
42 FINAL_SO_TARGET = $(basename $(SO_TARGET)).$(SO_TARGET_VERSION).$(SO)
43 MIDDLE_SO_TARGET = $(basename $(SO_TARGET)).$(SO_TARGET_VERSION_MAJOR).$(SO)
46 %.$(STATIC_O): $(srcdir)/%.c
47 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
49 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
51 %.$(STATIC_O): $(srcdir)/%.cpp
52 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
54 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
56 ../data/%.o: ../data/%.c
57 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
61 @echo "generating dependency information for $<"
62 @$(GEN_DEPS.c) $< -o $@
64 @( echo '/\.[ch]$$' ; echo '+,$$d' ; echo "wq" ) | ed $@~ 2>/dev/null >/dev/null || exit 0
70 @echo "generating dependency information for $<"
71 @$(GEN_DEPS.cc) $< -o $@
73 @( echo '/\.[ch]$$' ; echo '+,$$d' ; echo "wq" ) | ed $@~ 2>/dev/null >/dev/null || exit 0
78 ## Versioned libraries rules
80 %.$(SO_TARGET_VERSION_MAJOR).$(SO): %.$(SO_TARGET_VERSION).$(SO)
81 $(RM) $@ && ln -s ${<F} $@
82 %.$(SO): %.$(SO_TARGET_VERSION_MAJOR).$(SO)
83 $(RM) $@ && ln -s ${*F}.$(SO_TARGET_VERSION).$(SO) $@
85 ## End Darwin-specific setup