]> git.saurik.com Git - apt.git/blame - buildlib/python.mak
select kernels to protect from autoremove based on Debian version
[apt.git] / buildlib / python.mak
CommitLineData
b2e465d6
AL
1# -*- make -*-
2
3# This creates a python shared module.
4
5# Input
6# $(SOURCE) - The source code to use
7# $(MODULE) - The name of the module without module or .so
8
9# All output is writtin to .opic files in the build directory to
10# signify the PIC output.
11
12# See defaults.mak for information about LOCAL
13
14# Some local definitions
15LOCAL := $(MODULE)module.so
16$(LOCAL)-OBJS := $(addprefix $(OBJ)/,$(addsuffix .opic,$(notdir $(basename $(SOURCE)))))
17$(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .opic.d,$(notdir $(basename $(SOURCE)))))
18$(LOCAL)-SLIBS := $(SLIBS)
19$(LOCAL)-MODULE := $(MODULE)
20
21# Install the command hooks
22library: $(LIB)/$(MODULE)module.so
23clean: clean/$(LOCAL)
24veryclean: veryclean/$(LOCAL)
25
26# Make Directories
27MKDIRS += $(OBJ) $(DEP) $(LIB)
28
29# The clean rules
30.PHONY: clean/$(LOCAL) veryclean/$(LOCAL)
31clean/$(LOCAL):
32 -rm -f $($(@F)-OBJS) $($(@F)-DEP)
33veryclean/$(LOCAL): clean/$(LOCAL)
34 -rm -f $($(@F)-HEADERS) $(LIB)/$($(@F)-MODULE)module.so*
35
36# The binary build rule.
37ifdef PYTHONLIB
38ifndef ONLYSTATICLIBS
39$(LIB)/$(MODULE)module.so: $($(LOCAL)-OBJS)
40 -rm -f $(LIB)/$($(@F)-MODULE)module.so* 2> /dev/null
41 echo Building shared Python module $@
42 $(CXX) $(CXXFLAGS) $(LDFLAGS) $(PICFLAGS) $(LFLAGS) $(LFLAGS_SO)\
43 -o $@ -shared \
44 $(filter %.opic,$^) \
45 $($(@F)-SLIBS) $(PYTHONLIB)
46else
47.PHONY: $(LIB)/$(MODULE)module.so
48$(LIB)/$(MODULE)module.so:
49 echo Don't know how to make a python module here, not building $@
50endif # ifndef ONLYSTATICLIBS
51else
52.PHONY: $(LIB)/$(MODULE)module.so
53$(LIB)/$(MODULE)module.so:
54 echo No python support, not building $@
55endif # ifdef PYTHONLIB
56
57# Compilation rules
58vpath %.cc $(SUBDIRS)
59$(OBJ)/%.opic: %.cc
60 echo Compiling $< to $@
cbc9ec23 61 $(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) $(PICFLAGS) -o $@ $(abspath $<)
b2e465d6
AL
62 $(DoDep)
63
64# Include the dependencies that are available
65The_DFiles = $(wildcard $($(LOCAL)-DEP))
66ifneq ($(words $(The_DFiles)),0)
67include $(The_DFiles)
68endif