]> git.saurik.com Git - apt-legacy.git/blame - buildlib/library.mak
Fixed Dl-Limit (long standing APT bug that they won't acknowledge), specified error...
[apt-legacy.git] / buildlib / library.mak
CommitLineData
da6ee469
JF
1# -*- make -*-
2
3# This creates a shared library.
4
5# Input
6# $(SOURCE) - The source code to use
7# $(HEADERS) - Exported header files and private header files
8# $(LIBRARY) - The name of the library without lib or .so
9# $(MAJOR) - The major version number of this library
10# $(MINOR) - The minor version number of this library
11# $(APT_DOMAIN) - The text domain for this library
12
13# All output is writtin to .opic files in the build directory to
14# signify the PIC output.
15
16# See defaults.mak for information about LOCAL
17
18# Some local definitions
19LOCAL := lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR).$(MINOR)
20$(LOCAL)-OBJS := $(addprefix $(OBJ)/,$(addsuffix .opic,$(notdir $(basename $(SOURCE)))))
21$(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .opic.d,$(notdir $(basename $(SOURCE)))))
22$(LOCAL)-HEADERS := $(addprefix $(INCLUDE)/,$(HEADERS))
23$(LOCAL)-SONAME := lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR)
24$(LOCAL)-SLIBS := $(SLIBS)
25$(LOCAL)-LIBRARY := $(LIBRARY)
26
27TYPE = src
28include $(PODOMAIN_H)
29
30# Install the command hooks
31headers: $($(LOCAL)-HEADERS)
32library: $(LIB)/lib$(LIBRARY).dylib $(LIB)/lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR)
33clean: clean/$(LOCAL)
34veryclean: veryclean/$(LOCAL)
35
36# Make Directories
37MKDIRS += $(OBJ) $(DEP) $(LIB) $(dir $($(LOCAL)-HEADERS))
38
39# The clean rules
40.PHONY: clean/$(LOCAL) veryclean/$(LOCAL)
41clean/$(LOCAL):
42 -rm -f $($(@F)-OBJS) $($(@F)-DEP)
43veryclean/$(LOCAL): clean/$(LOCAL)
44 -rm -f $($(@F)-HEADERS) $(LIB)/lib$($(@F)-LIBRARY)*.dylib*
45
46# Build rules for the two symlinks
47.PHONY: $(LIB)/lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR) $(LIB)/lib$(LIBRARY).dylib
48$(LIB)/lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR): $(LIB)/lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR).$(MINOR)
49 ln -sf $(<F) $@
50$(LIB)/lib$(LIBRARY).dylib: $(LIB)/lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR).$(MINOR)
51 ln -sf $(<F) $@
52
53# The binary build rule
54$(LIB)/lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR).$(MINOR): $($(LOCAL)-HEADERS) $($(LOCAL)-OBJS)
55 -rm -f $(LIB)/lib$($(@F)-LIBRARY)*.dylib* 2> /dev/null
56 echo Building shared library $@
57 $(CXX) $(CXXFLAGS) $(LDFLAGS) $(PICFLAGS) $(LFLAGS) $(LFLAGS_SO)\
7a86155a 58 -o $@ -Wl,-dylib_install_name,$(patsubst $(LIB)/%,/usr/lib/%,$@) -dynamiclib \
da6ee469
JF
59 $(filter %.opic,$^) \
60 $($(@F)-SLIBS)
61
62# Compilation rules
63vpath %.cc $(SUBDIRS)
64$(OBJ)/%.opic: %.cc
65 echo Compiling $< to $@
66 $(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) $(PICFLAGS) -o $@ $<
67 $(DoDep)
68
69# Include the dependencies that are available
70The_DFiles = $(wildcard $($(LOCAL)-DEP))
71ifneq ($(words $(The_DFiles)),0)
72include $(The_DFiles)
73endif