Blob Blame History Raw
PYCOMPILE_DIR		 = build.pycompile
PYCOMPILE_CFGHOST	 = $(NATIVE_CC_CFGHOST)
PYCOMPILE_PREFIX	 = $(CURDIR)/$(PYCOMPILE_DIR)
PYCOMPILE_PATH		 =
PYCOMPILE		 = $(PYCOMPILE_DIR)/bin/pycompile

PYCOMPILE_APP_SRCS	 = $(APP_SRCS)
PYCOMPILE_CONFIG_SRCS	 = $(CONFIG_DEFAULT_SRCS)

PYCOMPILE_TAGS		+= $(PYCOMPILE_DIR)/tree.tag
PYCOMPILE_TAGS		+= $(PYCOMPILE_DIR)/config.tag

PYCOMPILE_CFLAGS	+= -I$(PYCOMPILE_DIR)/build
PYCOMPILE_CFLAGS	+= -I$(PROJECT_DIR)/profiles
PYCOMPILE_CFLAGS	+= -I$(SOURCE_DIR)/Include
PYCOMPILE_CFLAGS	+= -DPY_FOR_PYCOMPILE
PYCOMPILE_CFLAGS	+= -DVPATH=\"$(SOURCE_DIR)\"
PYCOMPILE_CFLAGS	+= -DVERSION=\"$(PYTHON_VER)\"
PYCOMPILE_CFLAGS	+= -DPLATFORM=\"$(NATIVE_OS)\"
PYCOMPILE_CFLAGS	+= -DPREFIX=\"$(PYCOMPILE_PREFIX)\"
PYCOMPILE_CFLAGS	+= -DEXEC_PREFIX=\"$(PYCOMPILE_PREFIX)\"
PYCOMPILE_CFLAGS	+= -DPYTHONPATH=\"$(PYCOMPILE_PATH)\"
PYCOMPILE_CFLAGS	+= $(NATIVE_CC_CFLAGS)

PYCOMPILE_LDFLAGS	+= -lreadline -lm -lutil -lpthread
PYCOMPILE_LDFLAGS	+= $(NATIVE_CC_LDFLAGS)
PYCOMPILE_LDFLAGS	+= -lreadline -lm -lutil -lpthread

$(PYCOMPILE_DIR)/tree.tag:
		mkdir -p $(PYCOMPILE_DIR)/bin
		mkdir -p $(PYCOMPILE_DIR)/lib
		mkdir -p $(PYCOMPILE_DIR)/lib/$(NICKNAME)
		mkdir -p $(PYCOMPILE_DIR)/lib/$(NICKNAME)/encodings
		mkdir -p $(PYCOMPILE_DIR)/lib/$(NICKNAME)/lib-dynload
		mkdir -p $(PYCOMPILE_DIR)/build
		mkdir -p $(PYCOMPILE_DIR)/Modules
		mkdir -p $(PYCOMPILE_DIR)/Objects
		mkdir -p $(PYCOMPILE_DIR)/Parser
		mkdir -p $(PYCOMPILE_DIR)/Python
		touch $(PYCOMPILE_DIR)/tree.tag

ifeq ($(PYCOMPILE_CFGSTEP),)

$(PYCOMPILE_DIR)/config.tag:
	$(MAKE) PYCOMPILE_CFGSTEP=yes                  \
		PYCOMPILE_CFGHOST=$(PYCOMPILE_CFGHOST) \
		CFGHOST=$(PYCOMPILE_CFGHOST)           \
		$(PYCOMPILE_DIR)/config.tag
else

$(PYCOMPILE_DIR)/config.tag:
	mkdir -p $(PYCOMPILE_DIR)/build
	cp -a $(PROJECT_DIR)/config/$(CFGHOST)/config.c   $(PYCOMPILE_DIR)/build/
	cp -a $(PROJECT_DIR)/config/$(CFGHOST)/pyconfig.h $(PYCOMPILE_DIR)/build/
	touch $(PYCOMPILE_DIR)/config.tag

endif

$(PYCOMPILE_DIR)/build/config.c:	$(PYCOMPILE_DIR)/config.tag
$(PYCOMPILE_DIR)/build/pyconfig.h:	$(PYCOMPILE_DIR)/config.tag

$(PYCOMPILE_DIR)/Modules/config.o:	$(PYCOMPILE_DIR)/build/config.c $(ALL_HEADERS) $(PYCOMPILE_TAGS)
					$(NATIVE_CC) -c -o $@ $< $(PYCOMPILE_CFLAGS)

$(PYCOMPILE_DIR)/Modules/%.o:	$(SOURCE_DIR)/Modules/%.c $(ALL_HEADERS) $(PYCOMPILE_TAGS)
				$(NATIVE_CC) -c -o $@ $< $(PYCOMPILE_CFLAGS)

$(PYCOMPILE_DIR)/Objects/%.o:	$(SOURCE_DIR)/Objects/%.c $(ALL_HEADERS) $(PYCOMPILE_TAGS)
				$(NATIVE_CC) -c -o $@ $< $(PYCOMPILE_CFLAGS)

$(PYCOMPILE_DIR)/Parser/%.o:	$(SOURCE_DIR)/Parser/%.c $(ALL_HEADERS) $(PYCOMPILE_TAGS)
				$(NATIVE_CC) -c -o $@ $< $(PYCOMPILE_CFLAGS)

$(PYCOMPILE_DIR)/Python/%.o:	$(SOURCE_DIR)/Python/%.c $(ALL_HEADERS) $(PYCOMPILE_TAGS)
				$(NATIVE_CC) -c -o $@ $< $(PYCOMPILE_CFLAGS)


PYCOMPILE_PYEXT_SRCS = \
	$(PYEXT_COLLECTIONS_SRCS)	\
	$(PYEXT_FUNCTOOLS_SRCS)		\
	$(PYEXT_HEAPQ_SRCS)		\
	$(PYEXT_LOCALE_SRCS)		\
	$(PYEXT_ITERTOOLS_SRCS)		\
	$(PYEXT_OPERATOR_SRCS)		\
	$(PYEXT_READLINE_SRCS)		\
	$(PYEXT_STROP_SRCS)		\
	$(PYEXT_UNICODEDATA_SRCS)	\


PYCOMPILE_APP_OBJS	= $(PYCOMPILE_APP_SRCS:Modules/%.c=$(PYCOMPILE_DIR)/Modules/%.o)
PYCOMPILE_CONFIG_OBJS	= $(PYCOMPILE_CONFIG_SRCS:Modules/%.c=$(PYCOMPILE_DIR)/Modules/%.o)
PYCOMPILE_PYEXT_OBJS	= $(PYCOMPILE_PYEXT_SRCS:Modules/%.c=$(PYCOMPILE_DIR)/Modules/%.o)
PYCOMPILE_MODULE_OBJS	= $(MODULE_SRCS:Modules/%.c=$(PYCOMPILE_DIR)/Modules/%.o)
PYCOMPILE_OBJECT_OBJS	= $(OBJECT_SRCS:Objects/%.c=$(PYCOMPILE_DIR)/Objects/%.o)
PYCOMPILE_PARSER_OBJS	= $(PARSER_SRCS:Parser/%.c=$(PYCOMPILE_DIR)/Parser/%.o)
PYCOMPILE_PYTHON_OBJS	= $(PYTHON_SRCS:Python/%.c=$(PYCOMPILE_DIR)/Python/%.o)

PYCOMPILE_OBJS = \
	$(PYCOMPILE_APP_OBJS)		\
	$(PYCOMPILE_CONFIG_OBJS)	\
	$(PYCOMPILE_MODULE_OBJS)	\
	$(PYCOMPILE_OBJECT_OBJS)	\
	$(PYCOMPILE_PARSER_OBJS)	\
	$(PYCOMPILE_PYTHON_OBJS)	\
	$(PYCOMPILE_PYEXT_OBJS)		\


ifeq ($(PYCOMPILE_CFGSTEP),)

$(PYCOMPILE):	$(PYCOMPILE_OBJS)
	$(MAKE) PYCOMPILE_CFGSTEP=yes                  \
		PYCOMPILE_CFGHOST=$(PYCOMPILE_CFGHOST) \
		CFGHOST=$(PYCOMPILE_CFGHOST)           \
		pycompile
else

$(PYCOMPILE):	$(PYCOMPILE_OBJS)
		$(NATIVE_CC) -o $@ $^ $(PYCOMPILE_LDFLAGS)

endif


pycompile:	$(PYCOMPILE)

pycompile-objs:	$(PYCOMPILE_OBJS)

pycompile-clean-config:
	rm -f $(PYCOMPILE_DIR)/tree.tag
	rm -f $(PYCOMPILE_DIR)/config.tag
	rm -f $(PYCOMPILE_DIR)/build/config.c
	rm -f $(PYCOMPILE_DIR)/build/pyconfig.h

pycompile-clean-objs:
	rm -f $(PYCOMPILE_OBJS)

pycompile-clean-pycompile:
	rm -f $(PYCOMPILE)

pycompile-clean:pycompile-clean-objs
pycompile-clean:pycompile-clean-config
pycompile-clean:pycompile-clean-pycompile

clean:		pycompile-clean-objs
clean:		pycompile-clean-config
clean:		pycompile-clean-pycompile

.PHONY:		pycompile               pycompile-objs
		pycompile-clean         pycompile-clean-objs
		pycompile-clean-config  pycompile-clean-pycompile