diff options
author | midipix <writeonce@midipix.org> | 2018-11-23 19:48:43 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-11-24 22:40:57 -0500 |
commit | a9733e59e6f7e3f1602973ae286a5acc8d99c055 (patch) | |
tree | df0525d66931c891309c331f0cb378b624148732 /project | |
parent | 8875c0887da904d7277a6ecc3c12acbfdb08b412 (diff) | |
download | sbpython2-a9733e59e6f7e3f1602973ae286a5acc8d99c055.tar.bz2 sbpython2-a9733e59e6f7e3f1602973ae286a5acc8d99c055.tar.xz |
project: added generic rules for building python's extension modules.
Diffstat (limited to 'project')
-rw-r--r-- | project/extras.mk | 64 | ||||
-rw-r--r-- | project/pyexts.mk | 0 | ||||
-rw-r--r-- | project/tree.mk | 7 |
3 files changed, 71 insertions, 0 deletions
diff --git a/project/extras.mk b/project/extras.mk index 6b69bf7..93d1edc 100644 --- a/project/extras.mk +++ b/project/extras.mk @@ -1,3 +1,4 @@ +# build info PYTHON_VER = 2.7 CFLAGS_COMMON += -I$(SOURCE_DIR)/Include @@ -7,3 +8,66 @@ 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_IMPLIB = +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): + $(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 diff --git a/project/pyexts.mk b/project/pyexts.mk new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/project/pyexts.mk diff --git a/project/tree.mk b/project/tree.mk index dcdc150..4af315d 100644 --- a/project/tree.mk +++ b/project/tree.mk @@ -1,5 +1,12 @@ tree.tag: + mkdir -p pyext mkdir -p Modules + mkdir -p Modules/cjkcodecs + mkdir -p Modules/zlib + mkdir -p Modules/_ctypes + mkdir -p Modules/_io + mkdir -p Modules/_multiprocessing + mkdir -p Modules/_sqlite mkdir -p Objects mkdir -p Parser mkdir -p Python |