]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/win32/Makefile
Restore win32 dir from Branch-5.2 and update it
[bacula/bacula] / bacula / src / win32 / Makefile
1 #
2 # Copyright (C) 2000-2018 Kern Sibbald
3 # License: BSD 2-Clause; see file LICENSE-FOSS
4 #
5 #
6 #  Makefile for Win32/Win64 Bacula File daemon
7 #
8 #  If called make win64=yes the Win64 version will be built
9 #     otherwise the Win32 version will be built.
10 #
11 #  If called with bat=no, bat will not be built, otherwise it will be
12 #     built.
13 #
14
15 ECHO_CMD=@
16
17 WIN32_DIRS=lib filed filed/plugins console scripts stored
18 WIN64_DIRS=lib filed filed/plugins console scripts stored
19
20 ifeq ($(win64),yes)
21          DIRS=$(WIN64_DIRS)
22          INSTALLER=win64_installer
23          SPECIAL=bat64 bsmtp
24 else
25          DIRS=$(WIN32_DIRS)
26          INSTALLER=win32_installer
27          SPECIAL=bat32 bsmtp
28 endif
29
30 ifeq ($(bat),no)
31          SPECIAL=bsmtp
32 endif   
33
34 .PHONY: $(DIRS) clean all Makefile.inc win32_installer full_win32_installer \
35          win64_installer bsmtp distclean
36
37 all: Makefile.inc $(DIRS) $(SPECIAL) $(INSTALLER)
38
39 distclean: clean
40
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
48
49 is_depkgs_set:
50         @if test -z $${DEPKGS} ; then \
51            echo "variable DEPKGS not set" ; \
52            echo "You probably want DEPKGS=\"`(cd ../../..;pwd)`\"" ; \
53            exit 1; \
54         fi ; \
55
56 release32/bat.exe: is_depkgs_set
57         ( cd ../qt-console; ./make-win32 "32" )
58         test -f release32/bat.exe
59
60 bat32: release32/bat.exe
61
62 release64/bat.exe: is_depkgs_set
63         ( cd ../qt-console; ./make-win32 "64" )
64         test -f release64/bat.exe
65
66 bat64: release64/bat.exe
67
68 full_win32_installer:
69         @if test -f Makefile.inc; then \
70            if $(MAKE) -C $@ $(MAKECMDGOALS); then \
71                 echo "\n===== Make of $@ succeeded =====\n\n" ; \
72            else  \
73                 echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \
74            fi ; \
75         fi
76
77 win32_installer:
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" ; \
82            else  \
83                 echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \
84            fi ; \
85         fi
86
87 win64_installer:
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" ; \
92            else  \
93                 echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \
94            fi ; \
95         fi
96
97
98 $(DIRS):
99         @if test -f Makefile.inc; then \
100            if $(MAKE) -C $@ $(MAKECMDGOALS); then \
101                 echo "\n===== Make of $@ succeeded =====\n\n" ; \
102            else  \
103                 echo "\n!!!!! Make of $@ failed !!!!!\n\n" ; exit 1; \
104            fi ; \
105         fi
106
107 bsmtp:
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" ; \
111            else  \
112                 echo "\n!!!!! Make of tools/bsmtp failed !!!!!\n\n" ; exit 1; \
113            fi ; \
114         fi
115
116
117
118 Makefile.inc:
119         @echo Creating $@
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; \
135                 MINGWBASE=mingw32; \
136         elif test "$(win64)" = yes && which x86_64-w64-mingw32-g++ ; then \
137                 BINDIR=; \
138                 INCDIR=; \
139                 DLLDIR=; \
140                 DEPKGSDIR=depkgs-mingw-w64; \
141                 DEPKGSDIR32=depkgs-mingw32; \
142                 MINGWBASE=x86_64-w64-mingw32; \
143         elif which i686-w64-mingw32-g++ ; then \
144                 BINDIR=; \
145                 INCDIR=; \
146                 DLLDIR=; \
147                 DEPKGSDIR=depkgs-mingw32; \
148                 DEPKGSDIR32=depkgs-mingw32; \
149                 MINGWBASE=i686-w64-mingw32; \
150         else \
151                 echo "\nThe GCC cross compiler isn't installed."; \
152                 echo "You must run build-win32-cross-tools and build-dependencies first.\n"; \
153                 exit 1; \
154         fi ; \
155         BUILDDIR=`(pwd)`; \
156         MAINDIR=`(cd ../..;pwd)`; \
157         sed \
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 > $@