summaryrefslogtreecommitdiff
path: root/project/extras.mk
blob: 15e018c9887579d0a010f9b508f030e162f9a21f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# build info
PYTHON_VER     = 2.7

CFLAGS_COMMON += -I$(SOURCE_DIR)/Include

CFLAGS_CONFIG += -DVERSION=\"$(PYTHON_VER)\"
CFLAGS_CONFIG += -DPREFIX=\"$(PREFIX)\"
CFLAGS_CONFIG += -DEXEC_PREFIX=\"$(EXEC_PREFIX)\"
CFLAGS_CONFIG += -DVPATH=\"$(SOURCE_DIR)\"
CFLAGS_CONFIG += -DPYTHONPATH=\"$(PYTHON_PATH)\"


# dynamically loaded extension module
pyext/%$(OS_LIB_SUFFIX): LDFLAGS_SONAME =
pyext/%$(OS_LIB_SUFFIX): LDFLAGS_DSOEXT = -Wl,-soname -Wl,$(subst pyext/,,$@)
pyext/%$(OS_LIB_SUFFIX): LDFLAGS_DYNEXT = $(LDFLAGS_DSOEXT) $(LDFLAGS_PYEXT)

pyext/%$(OS_LIB_SUFFIX): $(DSO_REF_SOLINK)
	$(CC) -shared -o $@ $^ $(LDFLAGS_SHARED) $(LDFLAGS_DYNEXT) -l$(PACKAGE)


# statically linked extension
pyext/%$(OS_ARCHIVE_EXT):
	rm -f $@
	$(AR) rcs $@ $^


# compile rules for python's extension modules
Modules/cjkcodecs/%.lo:		$(SOURCE_DIR)/Modules/cjkcodecs/%.c $(ALL_HEADERS) host.tag tree.tag config.tag
				$(CC) -c -o $@ $< $(CFLAGS_SHARED)

Modules/cjkcodecs/%.o:		$(SOURCE_DIR)/Modules/cjkcodecs/%.c $(ALL_HEADERS) host.tag tree.tag config.tag
				$(CC) -c -o $@ $< $(CFLAGS_STATIC)

Modules/expat/%.lo:		$(SOURCE_DIR)/Modules/expat/%.c $(ALL_HEADERS) host.tag tree.tag config.tag
				$(CC) -c -o $@ $< $(CFLAGS_SHARED)

Modules/expat/%.o:		$(SOURCE_DIR)/Modules/expat/%.c $(ALL_HEADERS) host.tag tree.tag config.tag
				$(CC) -c -o $@ $< $(CFLAGS_STATIC)

Modules/zlib/%.lo:		$(SOURCE_DIR)/Modules/zlib/%.c $(ALL_HEADERS) host.tag tree.tag config.tag
				$(CC) -c -o $@ $< $(CFLAGS_SHARED)

Modules/zlib/%.o:		$(SOURCE_DIR)/Modules/zlib/%.c $(ALL_HEADERS) host.tag tree.tag config.tag
				$(CC) -c -o $@ $< $(CFLAGS_STATIC)

Modules/_ctypes/%.lo:		$(SOURCE_DIR)/Modules/_ctypes/%.c $(ALL_HEADERS) host.tag tree.tag config.tag
				$(CC) -c -o $@ $< $(CFLAGS_SHARED)

Modules/_ctypes/%.o:		$(SOURCE_DIR)/Modules/_ctypes/%.c $(ALL_HEADERS) host.tag tree.tag config.tag
				$(CC) -c -o $@ $< $(CFLAGS_STATIC)

Modules/_io/%.lo:		$(SOURCE_DIR)/Modules/_io/%.c $(ALL_HEADERS) host.tag tree.tag config.tag
				$(CC) -c -o $@ $< $(CFLAGS_SHARED)

Modules/_io/%.o:		$(SOURCE_DIR)/Modules/_io/%.c $(ALL_HEADERS) host.tag tree.tag config.tag
				$(CC) -c -o $@ $< $(CFLAGS_STATIC)

Modules/_multiprocessing/%.lo:	$(SOURCE_DIR)/Modules/_multiprocessing/%.c $(ALL_HEADERS) host.tag tree.tag config.tag
				$(CC) -c -o $@ $< $(CFLAGS_SHARED)

Modules/_multiprocessing/%.o:	$(SOURCE_DIR)/Modules/_multiprocessing/%.c $(ALL_HEADERS) host.tag tree.tag config.tag
				$(CC) -c -o $@ $< $(CFLAGS_STATIC)

Modules/_sqlite/%.lo:		$(SOURCE_DIR)/Modules/_sqlite/%.c $(ALL_HEADERS) host.tag tree.tag config.tag
				$(CC) -c -o $@ $< $(CFLAGS_SHARED)

Modules/_sqlite/%.o:		$(SOURCE_DIR)/Modules/_sqlite/%.c $(ALL_HEADERS) host.tag tree.tag config.tag
				$(CC) -c -o $@ $< $(CFLAGS_STATIC)

# build rules for python's extension modules
include $(PROJECT_DIR)/project/pyexts.mk


# shared extension modules: desired subset
ifeq ($(ALL_STATIC),yes)
all:	$(PYEXT_SUBSET_STATIC)
else
all:	$(PYEXT_SUBSET_SHARED)
endif