1 #############################################################################
2 # Makefile for building: @@APPNAME@@
3 #############################################################################
5 ####### VERSION (modified by the configure script) ############
8 ####### VERSION (modified by the configure script) ############
11 ####### OS (modified by the configure script) ############
15 ####### Qt (modified by the configure script) ############
19 ####### PATHES ############
22 BUILDPATH=$(BUILDDIR)/$(OS)$(ARCH)
23 DISTPATH=$(DISTDIR)/$(OS)$(ARCH)/$(APPNAME)-$(VERSION)
25 ARPATH=$(ARDIR)/$(APPNAME)/v$(VERSION)
27 ####### COMPILERS ############
32 CC-win32 = i686-w64-mingw32-gcc-win32
33 CXX-win32 = i686-w64-mingw32-g++-win32
34 WINDRES-win32 = i686-w64-mingw32-windres
35 CC-win64 = x86_64-w64-mingw32-gcc-win32
36 CXX-win64 = x86_64-w64-mingw32-g++-win32
37 WINDRES-win64 = x86_64-w64-mingw32-windres
39 CC = $(CC-$(OS)$(ARCH))
40 CXX = $(CXX-$(OS)$(ARCH))
41 WINDRES = $(WINDRES-$(OS)$(ARCH))
43 DEFINES-lin32 = -DDEBUG -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -D@@APPDEF@@_LIN
44 DEFINES-lin64 = -DDEBUG -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -D@@APPDEF@@_LIN
45 DEFINES-win32 = -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -DQT_AXCONTAINER_LIB -DQT_PRINTSUPPORT_LIB -DQT_AXBASE_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_XML_LIB -D@@APPDEF@@_WIN
47 DEFINES = $(DEFINES-$(OS)$(ARCH))
49 CFLAGS-lin32 = @@DEBUG@@ -pipe -O2 -Wall -fPIC -D_REENTRANT $(DEFINES)
50 CFLAGS-lin64 = @@DEBUG@@ -pipe -O2 -Wall -fPIC -D_REENTRANT $(DEFINES)
51 CXXFLAGS-lin32 = @@DEBUG@@ -pipe -O2 -Wall -fPIC -D_REENTRANT $(DEFINES)
52 CXXFLAGS-lin64 = @@DEBUG@@ -pipe -O2 -Wall -fPIC -D_REENTRANT $(DEFINES)
53 CFLAGS-win32 = @@DEBUG@@ -pipe -fno-keep-inline-dllexport -O2 -Wall -Wextra $(DEFINES)
54 CXXFLAGS-win32 = @@DEBUG@@ -pipe -fno-keep-inline-dllexport -O2 -frtti -Wall -Wextra -fexceptions -mthreads $(DEFINES)
56 CFLAGS = $(CFLAGS-$(OS)$(ARCH))
57 CXXFLAGS = $(CXXFLAGS-$(OS)$(ARCH))
59 INCPATH-lin64-qt4 = -I/usr/share/qt4/mkspecs/linux-g++ -I$(QTPATH)/QtCore -I$(QTPATH)/QtGui -I$(QTPATH)/QtNetwork -I$(QTPATH)/QtXml -I$(QTPATH)/QtXmlPatterns -I$(QTPATH)
60 INCPATH-lin64-qt5 = -I$(QTPATH)/mkspecs/linux-g++-64 -I$(QTPATH) -I$(QTPATH)/QtWidgets -I$(QTPATH)/QtCore -I$(QTPATH)/QtGui -I$(QTPATH)/QtPrintSupport -I$(QTPATH)/QtNetwork -I$(QTPATH)/QtXml -I$(QTPATH)/QtXmlPatterns
61 INCPATH-win32-qt5 = -I$(QTPATH)/mkspecs/win32-g++ -I$(QTPATH)/include -I$(QTPATH)/include/ActiveQt -I$(QTPATH)/include/QtWidgets -I$(QTPATH)/include/QtGui -I$(QTPATH)/include/QtCore -I$(QTPATH)/include/QtXml -I$(QTPATH)/include/QtXmlPatterns -I$(QTPATH)/include/QtPrintSupport
63 INCPATH = $(INCPATH-$(OS)$(ARCH)-qt$(QTVER)) -I.
65 ################## LINKER #####################
68 LINK-win32 = i686-w64-mingw32-g++-win32
69 LINK-win64 = x86_64-w64-mingw32-g++-win32
71 LINK = $(LINK-$(OS)$(ARCH))
73 LFLAGS-lin32 = -m32 -Wl,-O1
74 LFLAGS-lin64 = -m64 -Wl,-O1
75 LFLAGS-win32 = -Wl,-s -mthreads -Wl,-subsystem,console -mthreads -static-libgcc -static-libstdc++
76 LFLAGS-win64 = -Wl,-s -mthreads -Wl,-subsystem,console -mthreads -static-libgcc -static-libstdc++
78 LFLAGS = $(LFLAGS-$(OS)$(ARCH))
80 LIBS-lin64-qt4 = -lQtCore -lQtGui -lQtXml -lQtXmlPatterns -lpthread -lm
81 LIBS-lin64-qt5 = -lQt5Core -lQt5Gui -lQt5Xml -lQt5XmlPatterns -lQt5Widgets -lQt5PrintSupport -lQt5Network -lpthread -lm
82 LIBS-win32-qt5 = -lmingw32 -L$(QTPATH)/lib -lqtmain -lQt5AxContainer -lQt5PrintSupport -lQt5AxBase -lglu32 -lopengl32 -lole32 -loleaut32 -luser32 -lgdi32 -ladvapi32 -luuid -lQt5Widgets -lQt5Gui -lQt5Core -lQt5Xml -lQt5XmlPatterns -lQt5Network -lm -lws2_32
84 LIBS = $(LIBS-$(OS)$(ARCH)-qt$(QTVER))
86 ################## OBJECTS #####################
87 include object-files.txt
89 OBJ-lin = $(COMMON-OBJ)
90 OBJ-win = $(COMMON-OBJ) $(BUILDPATH)/$(APPNAME)_res.o
94 ################## EXECUTBALE ####################
95 EXENAME-lin = $(APPNAME)
96 EXENAME-win = $(APPNAME).exe
98 EXENAME = $(EXENAME-$(OS))
100 all: $(BUILDPATH)/$(EXENAME)
102 $(BUILDPATH)/$(EXENAME) : $(OBJ)
103 $(LINK) $(LFLAGS) -o $@ $^ $(LIBS)
104 cp $(BUILDPATH)/$(EXENAME) .
106 $(BUILDPATH)/$(APPNAME)_res.o: $(APPNAME).rc
107 $(WINDRES) -i $(APPNAME).rc -o $(BUILDPATH)/$(APPNAME)_res.o --include-dir=. $(DEFINES)
109 ################## DISTRIBUTION ARCHIVE #####################
110 DISTNAME = dist-$(OS)
114 dist-lin: $(BUILDPATH)/$(APPNAME)
115 @echo -n creating binary distribution archive for Linux ...
117 @-mkdir -p $(DISTPATH)
118 @-mkdir -p $(DISTPATH)/locales
119 @cp $(BUILDPATH)/$(APPNAME) $(DISTPATH)
120 @if ls $(APPNAME)_*.qm 2>/dev/null 1>&2; then for loc in $(APPNAME)_*.qm; do cp $$loc $(DISTPATH)/locales; done; fi
121 @cp install.sh $(DISTPATH)
122 @if [ -d examples ]; then cp -r examples $(DISTPATH); fi
123 @cd $(DISTPATH); cd ..; tar zcf $(APPNAME)-$(VERSION)_$(OS)$(ARCH).tgz $(APPNAME)-$(VERSION); rm -rf $(APPNAME)-$(VERSION)
124 @echo done; echo result is in $(DISTDIR)/$(OS)$(ARCH)/$(APPNAME)-$(VERSION)_$(OS)$(ARCH).tgz
126 dist-win: $(BUILDPATH)/$(EXENAME)
127 @echo -n creating binary distribution archive for Windows ...
129 @mkdir -p $(DISTPATH)
130 @cp $(BUILDPATH)/$(APPNAME).exe $(DISTPATH)
131 @cp -r lib/$(OS)$(ARCH)/* $(DISTPATH)
132 @if ls $(APPNAME)_*.qm 2>/dev/null 1>&2; then for loc in $(APPNAME)_*.qm; do cp $$loc $(DISTPATH); done; fi
133 @if [ -d examples ]; then cp -r examples $(DISTPATH); fi
134 @cd $(DISTPATH); cd ..; zip -r $(APPNAME)-$(VERSION)_$(OS)$(ARCH).zip $(APPNAME)-$(VERSION)/* ; rm -rf $(APPNAME)-$(VERSION)
135 @echo done; echo result is in $(DISTDIR)/$(OS)$(ARCH)/$(APPNAME)-$(VERSION)_$(OS)$(ARCH).zip
138 @echo -n creating source archive ...
143 # copying various files: translations (.ts), locales (.qm), resources (.qrc), xml related (.xml,.xsd), config. files (.conf) ...
144 @if ls $(APPNAME)_*.ts 2>/dev/null 1>&2; then for loc in $(APPNAME)_*.ts; do cp $$loc $(ARPATH); done; fi
145 @if ls $(APPNAME)_*.qm 2>/dev/null 1>&2; then for loc in $(APPNAME)_*.qm; do cp $$loc $(ARPATH); done; fi
146 @if ls *.conf 2>/dev/null 1>&2; then for loc in *.conf; do cp $$loc $(ARPATH); done; fi
147 @if ls *.xml 2>/dev/null 1>&2; then for loc in *.xml; do cp $$loc $(ARPATH); done; fi
148 @if ls *.xsd 2>/dev/null 1>&2; then for loc in *.xsd; do cp $$loc $(ARPATH); done; fi
149 @if [ -f $(APPNAME).qrc ]; then cp $(APPNAME).qrc $(ARPATH); fi
150 @if [ -d icons ]; then cp -r icons $(ARPATH); fi
151 @if [ -d examples ]; then cp -r examples $(ARPATH); fi
153 @cp install.sh.in $(ARPATH)
154 @cp Makefile.in $(ARPATH)
155 @cp object-files.txt $(ARPATH)
156 @cp configure $(ARPATH)
157 @if [ -f $(APPNAME).rc ]; then cp $(APPNAME).rc $(ARPATH); fi
158 @if [ -f $(APPNAME).ico ]; then cp $(APPNAME).ico $(ARPATH); fi
159 @cp $(APPNAME).creator $(ARPATH)
160 @if [ -f $(APPNAME).creator.user ]; then cp $(APPNAME).creator.user $(ARPATH); fi
161 @cp $(APPNAME).files $(ARPATH)
162 @cp $(APPNAME).includes $(ARPATH)
163 @if [ -f $(APPNAME).config ]; then cp $(APPNAME).config $(ARPATH); fi
164 @cd $(ARPATH); cd ../..; tar zcf $(APPNAME)-$(VERSION)-src.tgz $(APPNAME); rm -rf $(APPNAME)
165 @echo done; echo result is in $(ARDIR)/$(APPNAME)-$(VERSION)-src.zip
171 rm -f $(BUILDPATH)/$(EXENAME)
175 $(BUILDPATH)/%.o : %.cpp
176 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
179 moc -qt=$(QTVER) $(DEFINES) $(INCPATH) $< -o $@
182 rcc -qt=$(QTVER) $< -o $@ -name $*
184 ### DEPENDENCIES OF EACH SOURCE FILE (auto-added by configure) ###