<commit_before>BUILD_DIR      := $(ROOT_DIR)/build
DOWNLOAD_DIR   := $(ROOT_DIR)/download

QT_DIR         := $(BUILD_DIR)/qt
QT_SRC_DIR     := $(QT_DIR)/source
QT_BUILD_DIR   := $(QT_DIR)/build
QT_INSTALL_DIR := $(QT_DIR)/install

DOWNLOADED  := $(QT_DIR)/.downloaded
EXTRACTED   := $(QT_DIR)/.extracted
CONFIGURED  := $(QT_DIR)/.configured
ENVIRONMENT := $(QT_DIR)/.environment

QT_URL    := http://download.qt-project.org/official_releases/qt/4.8/4.8.5/qt-everywhere-opensource-src-4.8.5.tar.gz
QT_MD5    := 1864987bdbb2f58f8ae8b350dfdbe133
QT_BUNDLE := $(DOWNLOAD_DIR)/$(notdir $(QT_URL))

QT_PATCH := qt_patch.txt

ifeq (arm,$(EMBOX_ARCH))
ARCH_FLAGS   := -arch arm
ENDIAN_FLAGS := -little-endian
else ifeq (x86,$(EMBOX_ARCH))
ARCH_FLAGS   := -arch i386
ENDIAN_FLAGS := -little-endian
else
$(error Unsupported architecture: $(EMBOX_ARCH))
endif

CROSS_COMPILER_FLAGS :=
ifneq (,$(EMBOX_CROSS_COMPILE))
CROSS_COMPILER_FLAGS += -device-option CROSS_COMPILE='$(EMBOX_CROSS_COMPILE)'
endif

QT_CONF_FLAGS :=
QT_CONF_FLAGS += -hostprefix $(QT_INSTALL_DIR)
QT_CONF_FLAGS += $(ARCH_FLAGS) $(ENDIAN_FLAGS) $(CROSS_COMPILER_FLAGS)
QT_CONF_FLAGS += -embedded-lite vnc -v
QT_CONF_FLAGS += -xplatform qws/embox-generic-g++ -static
QT_CONF_FLAGS += -opensource -confirm-license
QT_CONF_FLAGS += -no-pch -fast
QT_CONF_FLAGS += -no-largefile -no-qt3support
QT_CONF_FLAGS += -no-kbd-tty -no-mouse-pc -no-mouse-linuxtp \
				 -no-gfx-linuxfb -no-gfx-multiscreen
QT_CONF_FLAGS += -no-feature-TEMPORARYFILE -D QT_NO_TEMPORARYFILE
QT_CONF_FLAGS += -no-feature-PROCESS -D QT_NO_PROCESS
QT_CONF_FLAGS += -no-feature-SHAREDMEMORY -D QT_NO_SHAREDMEMORY
QT_CONF_FLAGS += -no-feature-NETWORKINTERFACE -D QT_NO_NETWORKINTERFACE
QT_CONF_FLAGS += -no-feature-HOSTINFO -D QT_NO_HOSTINFO
QT_CONF_FLAGS += -no-feature-QWS_INPUTMETHODS -D QT_NO_QWS_INPUTMETHODS
# Necessity to add this appeared after something was added, maybe -no-freetype
QT_CONF_FLAGS += -D QT_NO_IM
QT_CONF_FLAGS += -D Q_NO_POSIX_SIGNALS
QT_CONF_FLAGS += -D QT_NO_BEARERMANAGEMENT
QT_CONF_FLAGS += -D QT_NO_DYNAMIC_LIBRARY
QT_CONF_FLAGS += -no-sql-sqlite
QT_CONF_FLAGS += -nomake examples -nomake demos
QT_CONF_FLAGS += -nomake translations
ifneq (,$(filter -fno-exceptions,$(EMBOX_CXXFLAGS)))
QT_CONF_FLAGS += -no-exceptions
endif
QT_CONF_FLAGS += -debug
QT_CONF_FLAGS += -qt-gfx-vnc
QT_CONF_FLAGS += -no-freetype
QT_CONF_FLAGS += -no-xmlpatterns
QT_CONF_FLAGS += -D QEMBOX_PLUGIN_VNC
ifneq (arm,$(EMBOX_ARCH))
# it is temporary hack to prevent building Qt on ARM until frame buffer is not supported
QT_CONF_FLAGS += -D QEMBOX_PLUGIN_EMBOXVC
endif

EMBOX_IMPORTED_CPPFLAGS :=
EMBOX_IMPORTED_CPPFLAGS += -save-temps=obj
EMBOX_IMPORTED_CPPFLAGS += $(filter -I%,$(EMBOX_CPPFLAGS))
EMBOX_IMPORTED_CPPFLAGS += $(filter -nostdinc,$(EMBOX_CPPFLAGS))
EMBOX_IMPORTED_CPPFLAGS += $(filter -D__EMBOX__,$(EMBOX_CPPFLAGS))

EMBOX_IMPORTED_CFLAGS :=
EMBOX_IMPORTED_CFLAGS += $(EMBOX_IMPORTED_CPPFLAGS)
EMBOX_IMPORTED_CFLAGS += $(filter -fno-common,$(EMBOX_CFLAGS))
EMBOX_IMPORTED_CFLAGS += $(filter -march%,$(EMBOX_CFLAGS))
EMBOX_IMPORTED_CFLAGS += $(filter -m32,$(EMBOX_CFLAGS))
EMBOX_IMPORTED_CFLAGS += $(filter -fno-stack-protector,$(EMBOX_CFLAGS))
EMBOX_IMPORTED_CFLAGS += $(filter -mno-unaligned-access,$(EMBOX_CFLAGS))

EMBOX_IMPORTED_CXXFLAGS :=
EMBOX_IMPORTED_CXXFLAGS += $(EMBOX_IMPORTED_CPPFLAGS)
EMBOX_IMPORTED_CXXFLAGS += $(subst .,$(ROOT_DIR),$(filter -I%,$(EMBOX_CXXFLAGS))) # remove me
EMBOX_IMPORTED_CXXFLAGS += $(filter -fno-common,$(EMBOX_CXXFLAGS))
EMBOX_IMPORTED_CXXFLAGS += $(filter -march%,$(EMBOX_CXXFLAGS))
EMBOX_IMPORTED_CXXFLAGS += $(filter -m32,$(EMBOX_CXXFLAGS))
EMBOX_IMPORTED_CXXFLAGS += $(filter -fno-stack-protector,$(EMBOX_CXXFLAGS))
EMBOX_IMPORTED_CXXFLAGS += $(filter -mno-unaligned-access,$(EMBOX_CXXFLAGS))
EMBOX_IMPORTED_CXXFLAGS += $(filter -fno-rtti,$(EMBOX_CXXFLAGS))
EMBOX_IMPORTED_CXXFLAGS += $(filter -fno-exceptions,$(EMBOX_CXXFLAGS))
EMBOX_IMPORTED_CXXFLAGS += $(filter -fno-threadsafe-statics,$(EMBOX_CXXFLAGS))

EMBOX_IMPORTED_MAKEFLAGS :=
ifneq (,$(filter -j,$(EMBOX_MAKEFLAGS)))
EMBOX_IMPORTED_MAKEFLAGS += -j $(shell nproc)
endif

EMBOX_DERIVED_CFLAGS    := $(EMBOX_IMPORTED_CFLAGS)
EMBOX_DERIVED_CXXFLAGS  := $(EMBOX_IMPORTED_CXXFLAGS)
EMBOX_DERIVED_MAKEFLAGS := $(EMBOX_IMPORTED_MAKEFLAGS)

QMAKE_CONF_M4  := $(shell (cd tree && find . -name qmake.conf.m4))
QMAKE_CONF     := $(patsubst %.m4,%,$(QMAKE_CONF_M4))
ifneq ($(words $(QMAKE_CONF_M4)),1)
$(error need exactly one qmake.conf.m4)
endif

.PHONY: all build_and_install configure merge_trees

all:
#all: build_and_install

$(QT_BUILD_DIR):
	mkdir -p $@

QT_MD5_LINE:=$(QT_MD5)  $(QT_BUNDLE)

$(DOWNLOADED):
	(echo '$(QT_MD5_LINE)' | $(MD5) -c) || \
		(wget -P $(DOWNLOAD_DIR) -c $(QT_URL) && \
			echo '$(QT_MD5_LINE)' | $(MD5) -c)
	mkdir -p $(dir $@)
	touch $@

# When necessity to re-patch is detected manual resolution is required.
# We cannot automatically detect if there were or not changes in extracted sources
# and do not want to accidentally remove some possible desired changes.
# Therefore it is left to the discretion of the user.
# HINT: Typically it is good to perform build directory cleanup: 'make clean'
# The patch is saved to .extracted for the user to be able to compare previous patch with current one.
# In some situations this might be useful.
$(EXTRACTED): $(QT_PATCH) $(DOWNLOADED)
	 [ ! -e $@ ] || (echo Re-patching is needed. Please resolve manually. && false)
	rm -rf $(QT_SRC_DIR)
	mkdir -p $(QT_SRC_DIR)
	tar -C $(QT_SRC_DIR) -xzf $(abspath $(QT_BUNDLE)) --strip-components=1
	patch -p1 -d $(QT_SRC_DIR) -N --input=$(abspath $(QT_PATCH))
	cp $(QT_PATCH) $@
<commit_msg>qt-pro: Fix qt/Makefile all target<commit_after>BUILD_DIR      := $(ROOT_DIR)/build
DOWNLOAD_DIR   := $(ROOT_DIR)/download

QT_DIR         := $(BUILD_DIR)/qt
QT_SRC_DIR     := $(QT_DIR)/source
QT_BUILD_DIR   := $(QT_DIR)/build
QT_INSTALL_DIR := $(QT_DIR)/install

DOWNLOADED  := $(QT_DIR)/.downloaded
EXTRACTED   := $(QT_DIR)/.extracted
CONFIGURED  := $(QT_DIR)/.configured
ENVIRONMENT := $(QT_DIR)/.environment

QT_URL    := http://download.qt-project.org/official_releases/qt/4.8/4.8.5/qt-everywhere-opensource-src-4.8.5.tar.gz
QT_MD5    := 1864987bdbb2f58f8ae8b350dfdbe133
QT_BUNDLE := $(DOWNLOAD_DIR)/$(notdir $(QT_URL))

QT_PATCH := qt_patch.txt

ifeq (arm,$(EMBOX_ARCH))
ARCH_FLAGS   := -arch arm
ENDIAN_FLAGS := -little-endian
else ifeq (x86,$(EMBOX_ARCH))
ARCH_FLAGS   := -arch i386
ENDIAN_FLAGS := -little-endian
else
$(error Unsupported architecture: $(EMBOX_ARCH))
endif

CROSS_COMPILER_FLAGS :=
ifneq (,$(EMBOX_CROSS_COMPILE))
CROSS_COMPILER_FLAGS += -device-option CROSS_COMPILE='$(EMBOX_CROSS_COMPILE)'
endif

QT_CONF_FLAGS :=
QT_CONF_FLAGS += -hostprefix $(QT_INSTALL_DIR)
QT_CONF_FLAGS += $(ARCH_FLAGS) $(ENDIAN_FLAGS) $(CROSS_COMPILER_FLAGS)
QT_CONF_FLAGS += -embedded-lite vnc -v
QT_CONF_FLAGS += -xplatform qws/embox-generic-g++ -static
QT_CONF_FLAGS += -opensource -confirm-license
QT_CONF_FLAGS += -no-pch -fast
QT_CONF_FLAGS += -no-largefile -no-qt3support
QT_CONF_FLAGS += -no-kbd-tty -no-mouse-pc -no-mouse-linuxtp \
				 -no-gfx-linuxfb -no-gfx-multiscreen
QT_CONF_FLAGS += -no-feature-TEMPORARYFILE -D QT_NO_TEMPORARYFILE
QT_CONF_FLAGS += -no-feature-PROCESS -D QT_NO_PROCESS
QT_CONF_FLAGS += -no-feature-SHAREDMEMORY -D QT_NO_SHAREDMEMORY
QT_CONF_FLAGS += -no-feature-NETWORKINTERFACE -D QT_NO_NETWORKINTERFACE
QT_CONF_FLAGS += -no-feature-HOSTINFO -D QT_NO_HOSTINFO
QT_CONF_FLAGS += -no-feature-QWS_INPUTMETHODS -D QT_NO_QWS_INPUTMETHODS
# Necessity to add this appeared after something was added, maybe -no-freetype
QT_CONF_FLAGS += -D QT_NO_IM
QT_CONF_FLAGS += -D Q_NO_POSIX_SIGNALS
QT_CONF_FLAGS += -D QT_NO_BEARERMANAGEMENT
QT_CONF_FLAGS += -D QT_NO_DYNAMIC_LIBRARY
QT_CONF_FLAGS += -no-sql-sqlite
QT_CONF_FLAGS += -nomake examples -nomake demos
QT_CONF_FLAGS += -nomake translations
ifneq (,$(filter -fno-exceptions,$(EMBOX_CXXFLAGS)))
QT_CONF_FLAGS += -no-exceptions
endif
QT_CONF_FLAGS += -debug
QT_CONF_FLAGS += -qt-gfx-vnc
QT_CONF_FLAGS += -no-freetype
QT_CONF_FLAGS += -no-xmlpatterns
QT_CONF_FLAGS += -D QEMBOX_PLUGIN_VNC
ifneq (arm,$(EMBOX_ARCH))
# it is temporary hack to prevent building Qt on ARM until frame buffer is not supported
QT_CONF_FLAGS += -D QEMBOX_PLUGIN_EMBOXVC
endif

EMBOX_IMPORTED_CPPFLAGS :=
EMBOX_IMPORTED_CPPFLAGS += -save-temps=obj
EMBOX_IMPORTED_CPPFLAGS += $(filter -I%,$(EMBOX_CPPFLAGS))
EMBOX_IMPORTED_CPPFLAGS += $(filter -nostdinc,$(EMBOX_CPPFLAGS))
EMBOX_IMPORTED_CPPFLAGS += $(filter -D__EMBOX__,$(EMBOX_CPPFLAGS))

EMBOX_IMPORTED_CFLAGS :=
EMBOX_IMPORTED_CFLAGS += $(EMBOX_IMPORTED_CPPFLAGS)
EMBOX_IMPORTED_CFLAGS += $(filter -fno-common,$(EMBOX_CFLAGS))
EMBOX_IMPORTED_CFLAGS += $(filter -march%,$(EMBOX_CFLAGS))
EMBOX_IMPORTED_CFLAGS += $(filter -m32,$(EMBOX_CFLAGS))
EMBOX_IMPORTED_CFLAGS += $(filter -fno-stack-protector,$(EMBOX_CFLAGS))
EMBOX_IMPORTED_CFLAGS += $(filter -mno-unaligned-access,$(EMBOX_CFLAGS))

EMBOX_IMPORTED_CXXFLAGS :=
EMBOX_IMPORTED_CXXFLAGS += $(EMBOX_IMPORTED_CPPFLAGS)
EMBOX_IMPORTED_CXXFLAGS += $(subst .,$(ROOT_DIR),$(filter -I%,$(EMBOX_CXXFLAGS))) # remove me
EMBOX_IMPORTED_CXXFLAGS += $(filter -fno-common,$(EMBOX_CXXFLAGS))
EMBOX_IMPORTED_CXXFLAGS += $(filter -march%,$(EMBOX_CXXFLAGS))
EMBOX_IMPORTED_CXXFLAGS += $(filter -m32,$(EMBOX_CXXFLAGS))
EMBOX_IMPORTED_CXXFLAGS += $(filter -fno-stack-protector,$(EMBOX_CXXFLAGS))
EMBOX_IMPORTED_CXXFLAGS += $(filter -mno-unaligned-access,$(EMBOX_CXXFLAGS))
EMBOX_IMPORTED_CXXFLAGS += $(filter -fno-rtti,$(EMBOX_CXXFLAGS))
EMBOX_IMPORTED_CXXFLAGS += $(filter -fno-exceptions,$(EMBOX_CXXFLAGS))
EMBOX_IMPORTED_CXXFLAGS += $(filter -fno-threadsafe-statics,$(EMBOX_CXXFLAGS))

EMBOX_IMPORTED_MAKEFLAGS :=
ifneq (,$(filter -j,$(EMBOX_MAKEFLAGS)))
EMBOX_IMPORTED_MAKEFLAGS += -j $(shell nproc)
endif

EMBOX_DERIVED_CFLAGS    := $(EMBOX_IMPORTED_CFLAGS)
EMBOX_DERIVED_CXXFLAGS  := $(EMBOX_IMPORTED_CXXFLAGS)
EMBOX_DERIVED_MAKEFLAGS := $(EMBOX_IMPORTED_MAKEFLAGS)

QMAKE_CONF_M4  := $(shell (cd tree && find . -name qmake.conf.m4))
QMAKE_CONF     := $(patsubst %.m4,%,$(QMAKE_CONF_M4))
ifneq ($(words $(QMAKE_CONF_M4)),1)
$(error need exactly one qmake.conf.m4)
endif

.PHONY: all build_and_install configure merge_trees

all: build_and_install

$(QT_BUILD_DIR):
	mkdir -p $@

QT_MD5_LINE:=$(QT_MD5)  $(QT_BUNDLE)

$(DOWNLOADED):
	(echo '$(QT_MD5_LINE)' | $(MD5) -c) || \
		(wget -P $(DOWNLOAD_DIR) -c $(QT_URL) && \
			echo '$(QT_MD5_LINE)' | $(MD5) -c)
	mkdir -p $(dir $@)
	touch $@

# When necessity to re-patch is detected manual resolution is required.
# We cannot automatically detect if there were or not changes in extracted sources
# and do not want to accidentally remove some possible desired changes.
# Therefore it is left to the discretion of the user.
# HINT: Typically it is good to perform build directory cleanup: 'make clean'
# The patch is saved to .extracted for the user to be able to compare previous patch with current one.
# In some situations this might be useful.
$(EXTRACTED): $(QT_PATCH) $(DOWNLOADED)
	 [ ! -e $@ ] || (echo Re-patching is needed. Please resolve manually. && false)
	rm -rf $(QT_SRC_DIR)
	mkdir -p $(QT_SRC_DIR)
	tar -C $(QT_SRC_DIR) -xzf $(abspath $(QT_BUNDLE)) --strip-components=1
	patch -p1 -d $(QT_SRC_DIR) -N --input=$(abspath $(QT_PATCH))
	cp $(QT_PATCH) $@

{'fraction_non_alphanumeric': 0.1389848525112942, 'fraction_numerical': 0.009212507750907964, 'mean_word_length': 5.809408926417371, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6476708', 'n_tokens_mistral': 4584, 'n_tokens_neox': 4389, 'n_words': 861}