2 # Copyright (C) 2000-2018 Kern Sibbald
3 # License: BSD 2-Clause; see file LICENSE-FOSS
6 # Makefile for Win32/Win64 Bacula File daemon
8 # If called make win64=yes the Win64 version will be built
9 # otherwise the Win32 version will be built.
11 # If called with bat=no, bat will not be built, otherwise it will be
17 WIN32_DIRS=lib filed filed/plugins console scripts stored
18 WIN64_DIRS=lib filed filed/plugins console scripts stored
22 INSTALLER=win64_installer
26 INSTALLER=win32_installer
34 .PHONY: $(DIRS) clean all Makefile.inc win32_installer full_win32_installer \
35 win64_installer bsmtp distclean
37 all: Makefile.inc $(DIRS) $(SPECIAL) $(INSTALLER)
41 clean: $(DIRS) win32_installer win64_installer
42 $(MAKE) -C tools clean
43 $(ECHO_CMD)-rm -rf release32 release64
44 $(ECHO_CMD)-rm -rf ../qt-console/obj32 ../qt-console/obj64
45 $(ECHO_CMD)-rm -f ../qt-console/release/bat.exe ../qt-console/debug/bat.exe
46 $(ECHO_CMD)-rm -rf ../qt-console/tray-monitor/obj32 ../qt-console/tray-monitor/obj64
47 $(ECHO_CMD)-rm -f ../qt-console/tray-monitor/release/bacula-tray-monitor.exe ../qt-console/tray-monitor/debug/bacula-tray-monitor.exe
50 @if test -z $${DEPKGS} ; then \
51 echo "variable DEPKGS not set" ; \
52 echo "You probably want DEPKGS=\"`(cd ../../..;pwd)`\"" ; \
56 release32/bat.exe: is_depkgs_set
57 ( cd ../qt-console; ./make-win32 "32" )
58 test -f release32/bat.exe
60 bat32: release32/bat.exe
62 release64/bat.exe: is_depkgs_set
63 ( cd ../qt-console; ./make-win32 "64" )
64 test -f release64/bat.exe
66 bat64: release64/bat.exe
69 @if test -f Makefile.inc; then \
70 if $(MAKE) -C $@ $(MAKECMDGOALS); then \
71 echo "\n===== Make of $@ succeeded =====\n\n" ; \
73 echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \
78 echo "Making 32 bit version"
79 @if test -f Makefile.inc; then \
80 if $(MAKE) -C $@ $(MAKECMDGOALS); then \
81 echo "\n===== Make of $@ succeeded =====\n\n" ; \
83 echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \
88 echo "Making 64 bit version"
89 @if test -f Makefile.inc; then \
90 if $(MAKE) -C $@ $(MAKECMDGOALS); then \
91 echo "\n===== Make of $@ succeeded =====\n\n" ; \
93 echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \
99 @if test -f Makefile.inc; then \
100 if $(MAKE) -C $@ $(MAKECMDGOALS); then \
101 echo "\n===== Make of $@ succeeded =====\n\n" ; \
103 echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \
108 @if test -f Makefile.inc; then \
109 if $(MAKE) -C tools bsmtp $(MAKECMDGOALS); then \
110 echo "\n===== Make of tools/bsmtp succeeded =====\n\n" ; \
112 echo "\n!!!!! Make of tools/bsmtp failed !!!!!\n\n" ; exit 1; \
120 $(ECHO_CMD)TOPDIR=`(cd ../../..;pwd)`; \
121 TOPDIR=$${DEPKGS:-$${TOPDIR}}; \
122 if test "$(win64)" = yes -a -e $${TOPDIR}/cross-tools/mingw-w64/bin/x86_64-pc-mingw32-gcc; then \
123 BINDIR=$${TOPDIR}/cross-tools/mingw-w64/bin; \
124 INCDIR=$${TOPDIR}/cross-tools/mingw-w64/x86_64-pc-mingw32/include; \
125 DLLDIR=$${TOPDIR}/cross-tools/mingw-w64/x86_64-pc-mingw32/bin; \
126 DEPKGSDIR=depkgs-mingw-w64; \
127 DEPKGSDIR32=depkgs-mingw32; \
128 MINGWBASE=x86_64-pc-mingw32; \
129 elif test -e $${TOPDIR}/cross-tools/mingw32/bin/mingw32-gcc; then \
130 BINDIR=$${TOPDIR}/cross-tools/mingw32/bin; \
131 INCDIR=$${TOPDIR}/cross-tools/mingw32/mingw32/include; \
132 DLLDIR=$${TOPDIR}/cross-tools/mingw32/mingw32/bin; \
133 DEPKGSDIR=depkgs-mingw32; \
134 DEPKGSDIR32=depkgs-mingw32; \
136 elif test "$(win64)" = yes && which x86_64-w64-mingw32-g++ ; then \
140 DEPKGSDIR=depkgs-mingw-w64; \
141 DEPKGSDIR32=depkgs-mingw32; \
142 MINGWBASE=x86_64-w64-mingw32; \
143 elif which i686-w64-mingw32-g++ ; then \
147 DEPKGSDIR=depkgs-mingw32; \
148 DEPKGSDIR32=depkgs-mingw32; \
149 MINGWBASE=i686-w64-mingw32; \
151 echo "\nThe GCC cross compiler isn't installed."; \
152 echo "You must run build-win32-cross-tools and build-dependencies first.\n"; \
156 MAINDIR=`(cd ../..;pwd)`; \
158 -e "s^@MINGWBASE@^$${MINGWBASE}^" \
159 -e "s^@WIN64@^$${win64}^" \
160 -e "s^@BAT@^$${bat}^" \
161 -e "s^@WIN32DEPKGS@^$${DEPKGSDIR}^" \
162 -e "s^@WIN32DEPKGS32@^$${DEPKGSDIR32}^" \
163 -e "s^@WIN32BUILDDIR@^$${BUILDDIR}^" \
164 -e "s^@WIN32MAINDIR@^$${MAINDIR}^" \
165 -e "s^@WIN32TOPDIR@^$${TOPDIR}^" \
166 -e "s^@WIN32BINDIR@^$${BINDIR}^" \
167 -e "s^@WIN32INCDIR@^$${INCDIR}^" \
168 -e "s^@WIN32DLLDIR@^$${DLLDIR}^" < Makefile.inc.in > $@