]> git.saurik.com Git - apt.git/blame - buildlib/staticlibrary.mak
Undid undoing for bug 65952, fix is in aliencode
[apt.git] / buildlib / staticlibrary.mak
CommitLineData
e1b1ae50
AL
1# -*- make -*-
2
3# This creates a static 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
10# All output is writtin to .o files in the build directory
11
12# See defaults.mak for information about LOCAL
13
14# Some local definitions
15LOCAL := lib$(LIBRARY).a
16$(LOCAL)-OBJS := $(addprefix $(OBJ)/,$(addsuffix .o,$(notdir $(basename $(SOURCE)))))
17$(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .o.d,$(notdir $(basename $(SOURCE)))))
18$(LOCAL)-HEADERS := $(addprefix $(INCLUDE)/,$(HEADERS))
19$(LOCAL)-LIB := $(LIB)/lib$(LIBRARY).a
20
21# Install the command hooks
22headers: $($(LOCAL)-HEADERS)
23library: $($(LOCAL)-LIB)
24clean: clean/$(LOCAL)
25veryclean: veryclean/$(LOCAL)
26
27# The clean rules
28.PHONY: clean/$(LOCAL) veryclean/$(LOCAL)
29clean/$(LOCAL):
30 -rm -f $($(@F)-OBJS) $($(@F)-DEP)
31veryclean/$(LOCAL): clean/$(LOCAL)
32 -rm -f $($(@F)-HEADERS) $($(@F)-LIB)
33
34# Build rules for the two symlinks
35.PHONY: $($(LOCAL)-LIB)
36
37# The binary build rule
38$($(LOCAL)-LIB): $($(LOCAL)-HEADERS) $($(LOCAL)-OBJS)
39 echo Building library $@
40 -rm $@ > /dev/null 2>&1
41 $(AR) cq $@ $(filter %.o,$^)
b819effd
AL
42ifneq ($(words $(RANLIB)),0)
43 $(RANLIB) $@
44endif
e1b1ae50
AL
45
46# Compilation rules
47vpath %.cc $(SUBDIRS)
48$(OBJ)/%.o: %.cc
49 echo Compiling $< to $@
50 $(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
51 $(DoDep)
52
53# Include the dependencies that are available
54The_DFiles = $(wildcard $($(LOCAL)-DEP))
55ifneq ($(words $(The_DFiles)),0)
56include $(The_DFiles)
57endif