configure: put more of the makefile contents into template files

... instead of having (duplicated) code in the configures to create it.

Change-Id: Ia86b44021a024a969f5a49b7fb18d3d414869f93
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Oswald Buddenhagen 2016-11-18 16:27:15 +01:00
parent 4ce0beee1b
commit 9bdb5b5ffe
7 changed files with 102 additions and 110 deletions

74
configure vendored
View File

@ -1631,8 +1631,6 @@ setBootstrapVariable()
echo "########################################################################" > "$mkfile"
echo "## This file was autogenerated by configure, all changes will be lost ##" >> "$mkfile"
echo "########################################################################" >> "$mkfile"
EXTRA_OBJS=
EXTRA_SRCS=
EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS) \$(QMAKE_CXXFLAGS_CXX11) \$(QMAKE_CXXFLAGS_SPLIT_SECTIONS)"
EXTRA_LFLAGS="\$(QMAKE_LFLAGS) \$(QMAKE_LFLAGS_GCSECTIONS)"
@ -1657,58 +1655,6 @@ setBootstrapVariable()
EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)"
fi
case `basename "$PLATFORM"` in
win32-g++*)
EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -DUNICODE"
EXTRA_OBJS="qfilesystemengine_win.o \
qfilesystemiterator_win.o \
qfsfileengine_win.o \
qlocale_win.o \
qsettings_win.o \
qsystemlibrary.o \
registry.o"
EXTRA_SRCS="\"\$(SOURCE_PATH)/src/corelib/corelib/io/qfilesystemengine_win.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_win.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/io/qsettings_win.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp\" \
\"\$(SOURCE_PATH)/tools/shared/windows/registry.cpp\""
EXTRA_LFLAGS="$EXTRA_LFLAGS -static -s -lole32 -luuid -ladvapi32 -lkernel32"
EXEEXT=".exe"
;;
*)
EXTRA_OBJS="qfilesystemengine_unix.o \
qfilesystemiterator_unix.o \
qfsfileengine_unix.o \
qlocale_unix.o"
EXTRA_SRCS="\"\$(SOURCE_PATH)/src/corelib/io/qfilesystemengine_unix.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_unix.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/io/qfsfileengine_unix.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/tools/qlocale_unix.cpp\""
EXEEXT=
;;
esac
if [ "$BUILD_ON_MAC" = "yes" ]; then
echo "COCOA_LFLAGS =-framework Foundation -framework CoreServices" >>"$mkfile"
echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile"
echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile"
EXTRA_LFLAGS="$EXTRA_LFLAGS \$(COCOA_LFLAGS)"
EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)"
EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(CARBON_CFLAGS)"
EXTRA_OBJS="$EXTRA_OBJS \
qsettings_mac.o \
qcore_mac.o \
qcore_mac_objc.o \
qcore_foundation.o"
EXTRA_SRCS="$EXTRA_SRCS \
\"\$(SOURCE_PATH)/src/corelib/io/qsettings_mac.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/kernel/qcore_mac_objc.mm\" \
\"\$(SOURCE_PATH)/src/corelib/kernel/qcore_foundation.mm\""
fi
echo >>"$mkfile"
adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'`
adjoutpath=`echo "$outpath" | sed 's/ /\\\\\\\\ /g'`
adjqmakespec=`echo "$QMAKESPEC" | sed 's/ /\\\\\\\\ /g'`
@ -1725,14 +1671,24 @@ setBootstrapVariable()
echo "QT_MAJOR_VERSION = $QT_MAJOR_VERSION" >> "$mkfile"
echo "QT_MINOR_VERSION = $QT_MINOR_VERSION" >> "$mkfile"
echo "QT_PATCH_VERSION = $QT_PATCH_VERSION" >> "$mkfile"
echo "EXTRA_CXXFLAGS = $EXTRA_CXXFLAGS" >> "$mkfile"
echo "QTOBJS =" $EXTRA_OBJS >> "$mkfile"
echo "QTSRCS =" $EXTRA_SRCS >> "$mkfile"
echo "LFLAGS = $EXTRA_LFLAGS" >> "$mkfile"
echo "EXEEXT = $EXEEXT" >> "$mkfile"
echo "CONFIG_CXXFLAGS = $EXTRA_CXXFLAGS" >> "$mkfile"
echo "CONFIG_LFLAGS = $EXTRA_LFLAGS" >> "$mkfile"
echo "RM_F = rm -f" >> "$mkfile"
echo "RM_RF = rm -rf" >> "$mkfile"
case `basename "$PLATFORM"` in
win32-g++*)
cat "$in_mkfile.win32" >> "$mkfile"
;;
*)
cat "$in_mkfile.unix" >> "$mkfile"
if [ "$BUILD_ON_MAC" = "yes" ]; then
cat "$in_mkfile.macos" >> "$mkfile"
fi
;;
esac
echo >>"$mkfile"
if [ "$BUILD_ON_MAC" = "yes" ]; then
echo "EXTRA_CXXFLAGS += -MMD" >> "$mkfile"
cat "$in_mkfile" >> "$mkfile"

View File

@ -20,7 +20,7 @@ QOBJS=qtextcodec.o qutfcodec.o qstring.o qstring_compat.o qstringbuilder.o qtext
qvariant.o qvsnprintf.o qlocale.o qlocale_tools.o qlinkedlist.o qnumeric.o \
qcryptographichash.o qxmlstream.o qxmlutils.o qlogging.o \
qjson.o qjsondocument.o qjsonparser.o qjsonarray.o qjsonobject.o qjsonvalue.o \
$(QTOBJS)
$(QTOBJS) $(QTOBJS2)
#all sources, used for the depend target
@ -92,7 +92,7 @@ DEPEND_SRC = \
$(SOURCE_PATH)/src/corelib/json/qjsonarray.cpp \
$(SOURCE_PATH)/src/corelib/json/qjsonobject.cpp \
$(SOURCE_PATH)/src/corelib/json/qjsonvalue.cpp \
$(QTSRCS)
$(QTSRCS) $(QTSRCS2)
CPPFLAGS = -g $(EXTRA_CPPFLAGS) \
-I$(QMKSRC) -I$(QMKLIBSRC) -I$(QMKSRC)/generators -I$(QMKSRC)/generators/unix -I$(QMKSRC)/generators/win32 \
@ -106,7 +106,8 @@ CPPFLAGS = -g $(EXTRA_CPPFLAGS) \
-DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL \
-DQT_NO_FOREACH
CXXFLAGS = $(EXTRA_CXXFLAGS) $(CPPFLAGS)
CXXFLAGS = $(EXTRA_CXXFLAGS) $(CONFIG_CXXFLAGS) $(CPPFLAGS)
LFLAGS = $(EXTRA_LFLAGS) $(CONFIG_LFLAGS)
first all: $(BUILD_PATH)/bin/qmake$(EXEEXT)
qmake: $(BUILD_PATH)/bin/qmake$(EXEEXT)

17
qmake/Makefile.unix.macos Normal file
View File

@ -0,0 +1,17 @@
COCOA_LFLAGS = -framework Foundation -framework CoreServices
CARBON_LFLAGS = -framework ApplicationServices
CARBON_CFLAGS = -fconstant-cfstrings
EXTRA_CXXFLAGS = $(CARBON_CFLAGS)
EXTRA_LFLAGS = $(COCOA_LFLAGS) $(CARBON_LFLAGS)
QTOBJS2 = \
qsettings_mac.o \
qcore_mac.o \
qcore_mac_objc.o \
qcore_foundation.o
QTSRCS2 = \
$(SOURCE_PATH)/src/corelib/io/qsettings_mac.cpp \
$(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp \
$(SOURCE_PATH)/src/corelib/kernel/qcore_mac_objc.mm \
$(SOURCE_PATH)/src/corelib/kernel/qcore_foundation.mm

27
qmake/Makefile.unix.mingw Normal file
View File

@ -0,0 +1,27 @@
# SHELL is the full path of sh.exe, unless
# 1) it is found in the current directory
# 2) it is not found at all
# 3) it is overridden on the command line with an existing file
# ... otherwise it is always sh.exe. Specifically, SHELL from the
# environment has no effect.
#
# This check will fail if SHELL is explicitly set to a not
# sh-compatible shell. This is not a problem, because configure.bat
# will not do that.
ifeq ($(SHELL), sh.exe)
ifeq ($(wildcard $(CURDIR)/sh.exe), )
SH = 0
else
SH = 1
endif
else
SH = 1
endif
ifeq ($(SH), 1)
RM_F = rm -f
RM_RF = rm -rf
else
RM_F = del /f
RM_RF = rmdir /s /q
endif

11
qmake/Makefile.unix.unix Normal file
View File

@ -0,0 +1,11 @@
EXEEXT =
QTOBJS = \
qfilesystemengine_unix.o \
qfilesystemiterator_unix.o \
qfsfileengine_unix.o \
qlocale_unix.o
QTSRCS = \
$(SOURCE_PATH)/src/corelib/io/qfilesystemengine_unix.cpp \
$(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_unix.cpp \
$(SOURCE_PATH)/src/corelib/io/qfsfileengine_unix.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlocale_unix.cpp

19
qmake/Makefile.unix.win32 Normal file
View File

@ -0,0 +1,19 @@
EXEEXT = .exe
EXTRA_CXXFLAGS = -DUNICODE
EXTRA_LFLAGS = -static -s -lole32 -luuid -ladvapi32 -lkernel32
QTOBJS = \
qfilesystemengine_win.o \
qfilesystemiterator_win.o \
qfsfileengine_win.o \
qlocale_win.o \
qsettings_win.o \
qsystemlibrary.o \
registry.o
QTSRCS = \
$(SOURCE_PATH)/src/corelib/io/qfilesystemengine_win.cpp \
$(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_win.cpp \
$(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp \
$(SOURCE_PATH)/src/corelib/io/qsettings_win.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp \
$(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp \
$(SOURCE_PATH)/tools/shared/windows/registry.cpp

View File

@ -866,54 +866,15 @@ void Configure::buildQmake()
<< "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl;
if (dictionary[ "QMAKESPEC" ].startsWith("win32-g++")) {
stream << "QMAKESPEC = $(SOURCE_PATH)\\mkspecs\\" << dictionary[ "QMAKESPEC" ] << endl
<< "EXTRA_CXXFLAGS = -std=c++11 -DUNICODE -ffunction-sections" << endl
<< "EXTRA_LFLAGS = -Wl,--gc-sections" << endl
<< "QTOBJS = qfilesystemengine_win.o \\" << endl
<< " qfilesystemiterator_win.o \\" << endl
<< " qfsfileengine_win.o \\" << endl
<< " qlocale_win.o \\" << endl
<< " qsettings_win.o \\" << endl
<< " qsystemlibrary.o \\" << endl
<< " registry.o" << endl
<< "QTSRCS=\"$(SOURCE_PATH)/src/corelib/io/qfilesystemengine_win.cpp\" \\" << endl
<< " \"$(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_win.cpp\" \\" << endl
<< " \"$(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp\" \\" << endl
<< " \"$(SOURCE_PATH)/src/corelib/io/qsettings_win.cpp\" \\" << endl
<< " \"$(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp\" \\" << endl\
<< " \"$(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp\" \\" << endl
<< " \"$(SOURCE_PATH)/tools/shared/windows/registry.cpp\"" << endl
<< "EXEEXT=.exe" << endl
<< "LFLAGS=-static -s -lole32 -luuid -ladvapi32 -lkernel32" << endl;
/*
** SHELL is the full path of sh.exe, unless
** 1) it is found in the current directory
** 2) it is not found at all
** 3) it is overridden on the command line with an existing file
** ... otherwise it is always sh.exe. Specifically, SHELL from the
** environment has no effect.
**
** This check will fail if SHELL is explicitly set to a not
** sh-compatible shell. This is not a problem, because configure.bat
** will not do that.
*/
stream << "ifeq ($(SHELL), sh.exe)" << endl
<< " ifeq ($(wildcard $(CURDIR)/sh.exe), )" << endl
<< " SH = 0" << endl
<< " else" << endl
<< " SH = 1" << endl
<< " endif" << endl
<< "else" << endl
<< " SH = 1" << endl
<< "endif" << endl
<< "\n"
<< "ifeq ($(SH), 1)" << endl
<< " RM_F = rm -f" << endl
<< " RM_RF = rm -rf" << endl
<< "else" << endl
<< " RM_F = del /f" << endl
<< " RM_RF = rmdir /s /q" << endl
<< "endif" << endl;
stream << "\n\n";
<< "CONFIG_CXXFLAGS = -std=c++11 -ffunction-sections" << endl
<< "CONFIG_LFLAGS = -Wl,--gc-sections" << endl;
QFile in(sourcePath + "/qmake/Makefile.unix.win32");
if (in.open(QFile::ReadOnly | QFile::Text))
stream << in.readAll();
QFile in2(sourcePath + "/qmake/Makefile.unix.mingw");
if (in2.open(QFile::ReadOnly | QFile::Text))
stream << in2.readAll();
} else {
stream << "QMAKESPEC = " << dictionary["QMAKESPEC"] << endl;
}