]> git.saurik.com Git - apt.git/blame - buildlib/library.mak
Only show packages as upgradable if the have a CandidateVer != 0
[apt.git] / buildlib / library.mak
CommitLineData
094a497d
AL
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
10c9f030 8# $(LIBRARY) - The name of the library without lib or .so
094a497d
AL
9# $(MAJOR) - The major version number of this library
10# $(MINOR) - The minor version number of this library
c6e8074f 11# $(APT_DOMAIN) - The text domain for this library
094a497d
AL
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
44c8b5df 19LOCAL := lib$(LIBRARY).so.$(MAJOR).$(MINOR)
094a497d 20$(LOCAL)-OBJS := $(addprefix $(OBJ)/,$(addsuffix .opic,$(notdir $(basename $(SOURCE)))))
e1b1ae50 21$(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .opic.d,$(notdir $(basename $(SOURCE)))))
094a497d 22$(LOCAL)-HEADERS := $(addprefix $(INCLUDE)/,$(HEADERS))
44c8b5df 23$(LOCAL)-SONAME := lib$(LIBRARY).so.$(MAJOR)
880e9be4 24$(LOCAL)-SLIBS := $(SLIBS)
3763d79d 25$(LOCAL)-LIBRARY := $(LIBRARY)
094a497d 26
80948457
AL
27TYPE = src
28include $(PODOMAIN_H)
29
094a497d
AL
30# Install the command hooks
31headers: $($(LOCAL)-HEADERS)
44c8b5df 32library: $(LIB)/lib$(LIBRARY).so $(LIB)/lib$(LIBRARY).so.$(MAJOR)
094a497d
AL
33clean: clean/$(LOCAL)
34veryclean: veryclean/$(LOCAL)
35
b2e465d6
AL
36# Make Directories
37MKDIRS += $(OBJ) $(DEP) $(LIB) $(dir $($(LOCAL)-HEADERS))
38
094a497d
AL
39# The clean rules
40.PHONY: clean/$(LOCAL) veryclean/$(LOCAL)
41clean/$(LOCAL):
42 -rm -f $($(@F)-OBJS) $($(@F)-DEP)
43veryclean/$(LOCAL): clean/$(LOCAL)
a5b7cd82 44 -rm -f $($(@F)-HEADERS) $(LIB)/lib$($(@F)-LIBRARY)*.so*
094a497d
AL
45
46# Build rules for the two symlinks
44c8b5df
DK
47.PHONY: $(LIB)/lib$(LIBRARY).so.$(MAJOR) $(LIB)/lib$(LIBRARY).so
48$(LIB)/lib$(LIBRARY).so.$(MAJOR): $(LIB)/lib$(LIBRARY).so.$(MAJOR).$(MINOR)
094a497d 49 ln -sf $(<F) $@
44c8b5df 50$(LIB)/lib$(LIBRARY).so: $(LIB)/lib$(LIBRARY).so.$(MAJOR).$(MINOR)
094a497d 51 ln -sf $(<F) $@
80948457 52
094a497d 53# The binary build rule
564fcbf9 54$(LIB)/lib$(LIBRARY).so.$(MAJOR).$(MINOR): $($(LOCAL)-HEADERS) $($(LOCAL)-OBJS) $(LIBRARYDEPENDS)
a5b7cd82 55 -rm -f $(LIB)/lib$($(@F)-LIBRARY)*.so* 2> /dev/null
094a497d 56 echo Building shared library $@
70fbac25
AL
57 $(CXX) $(CXXFLAGS) $(LDFLAGS) $(PICFLAGS) $(LFLAGS) $(LFLAGS_SO)\
58 -o $@ $(SONAME_MAGIC)$($(@F)-SONAME) -shared \
59 $(filter %.opic,$^) \
60 $($(@F)-SLIBS)
094a497d
AL
61
62# Compilation rules
63vpath %.cc $(SUBDIRS)
564fcbf9 64$(OBJ)/%.opic: %.cc $(LIBRARYDEPENDS)
094a497d 65 echo Compiling $< to $@
cbc9ec23 66 $(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) $(PICFLAGS) -o $@ $(abspath $<)
094a497d
AL
67 $(DoDep)
68
69# Include the dependencies that are available
70The_DFiles = $(wildcard $($(LOCAL)-DEP))
71ifneq ($(words $(The_DFiles)),0)
72include $(The_DFiles)
80948457 73endif