2 # Makefile for win32 bacula executables
3 # Using MinGW cross-compiler on GNU/Linux
8 # Version for cross-tools-3.4.2
10 CROSSTOOLS = $(TOPDIR)/cross-tools
11 MINGW = $(CROSSTOOLS)/mingw32
12 INCLUDE_MINGW = -I $(MINGW)/mingw32/include
13 INCLUDE_GCC = -I $(MINGW)/lib/gcc/mingw32/3.4.5/include
15 DEPKGS = $(TOPDIR)/depkgs-win32
17 INCLUDE_BACULA = -I .. -I ./compat
18 INCLUDE_PTHREADS = -I$(DEPKGS)/pthreads
19 INCLUDE_ZLIB = -I$(DEPKGS)/zlib
20 INCLUDE_ATL = -I$(CROSSTOOLS)/atlmfc/include
21 INCLUDE_VSS = -I$(CROSSTOOLS)
22 INCLUDE_ICONS = -I ../filed/win32
23 INCLUDE_OPENSSL = -I$(CROSSTOOLS)/openssl/include
25 LIB_MINGW = $(MINGW)/mingw32/lib
26 LIB_PTHREADS = $(DEPKGS)/pthreads/libpthreadGCE.a
27 #LIB_ZLIB = $(DEPKGS)/libz.a
28 #LIB_SSL = $(DEPKGS)/openssl/libssl.a
29 #LIB_CRYPTO = $(DEPKGS)/openssl/libcrypto.a
31 BIN_DIR = $(MINGW)/bin
61 CC = $(BIN_DIR)/mingw32-g++ $(DEFINES) $(INCLUDES)
62 CXX = $(BIN_DIR)/mingw32-g++ $(DEFINES) $(INCLUDES) 2>&1
63 WINDRES = $(BIN_DIR)/mingw32-windres
69 ##########################################################################
71 # Files in src/win32/filed/
74 $(OBJDIR)/authenticate.o \
76 $(OBJDIR)/estimate.o \
78 $(OBJDIR)/filed_conf.o \
79 $(OBJDIR)/heartbeat.o \
84 $(OBJDIR)/verify_vol.o \
86 authenticate.o: ../filed/authenticate.c
87 $(CXX) -c ../filed/authenticate.c -o $(OBJDIR)/authenticate.o
89 backup.o: ../filed/backup.c
90 $(CXX) -c ../filed/backup.c -o $(OBJDIR)/backup.o
92 estimate.o: ../filed/estimate.c
93 $(CXX) -c ../filed/estimate.c -o $(OBJDIR)/estimate.o
95 filed.o: ../filed/filed.c
96 $(CXX) -c ../filed/filed.c -o $(OBJDIR)/filed.o
98 filed_conf.o: ../filed/filed_conf.c
99 $(CXX) -c ../filed/filed_conf.c -o $(OBJDIR)/filed_conf.o
101 heartbeat.o: ../filed/heartbeat.c
102 $(CXX) -c ../filed/heartbeat.c -o $(OBJDIR)/heartbeat.o
104 job.o: ../filed/job.c
105 $(CXX) -c ../filed/job.c -o $(OBJDIR)/job.o
107 restore.o: ../filed/restore.c
108 $(CXX) -c ../filed/restore.c -o $(OBJDIR)/restore.o
110 status.o: ../filed/status.c
111 $(CXX) -c ../filed/status.c -o $(OBJDIR)/status.o
113 verify.o: ../filed/verify.c
114 $(CXX) -c ../filed/verify.c -o $(OBJDIR)/verify.o
116 verify_vol.o: ../filed/verify_vol.c
117 $(CXX) -c ../filed/verify_vol.c -o $(OBJDIR)/verify_vol.o
119 ######################################################################
121 # Files in win32/compat
129 $(OBJDIR)/vss_w2k3.o \
131 compat.o: ./compat/compat.cpp
132 $(CXX) -c ./compat/compat.cpp -o $(OBJDIR)/compat.o
134 getopt.o: ./compat/getopt.c
135 $(CXX) -c ./compat/getopt.c -o $(OBJDIR)/getopt.o
137 print.o: ./compat/print.cpp
138 $(CXX) -c ./compat/print.cpp -o $(OBJDIR)/print.o
140 vss.o: ./compat/vss.cpp
141 $(CXX) -c ./compat/vss.cpp -o $(OBJDIR)/vss.o
143 vss_xp.o: ./compat/vss_XP.cpp
144 $(CXX) -c ./compat/vss_XP.cpp -o $(OBJDIR)/vss_xp.o
146 vss_w2k3.o: ./compat/vss_W2K3.cpp
147 $(CXX) -c ./compat/vss_W2K3.cpp -o $(OBJDIR)/vss_w2k3.o
149 ######################################################################
151 # Files in src/filed/win32
153 $(OBJDIR)/winabout.o \
154 $(OBJDIR)/winevents.o \
155 $(OBJDIR)/winservice.o \
156 $(OBJDIR)/winstat.o \
157 $(OBJDIR)/wintray.o \
158 $(OBJDIR)/winmain.o \
161 winabout.o: ../filed/win32/winabout.cpp
162 $(CXX) -c ../filed/win32/winabout.cpp -o $(OBJDIR)/winabout.o
164 winevents.o: ../filed/win32/winevents.cpp
165 $(CXX) -c ../filed/win32/winevents.cpp -o $(OBJDIR)/winevents.o
167 winmain.o: ../filed/win32/winmain.cpp
168 $(CXX) -c ../filed/win32/winmain.cpp -o $(OBJDIR)/winmain.o
170 winservice.o: ../filed/win32/winservice.cpp
171 $(CXX) -c ../filed/win32/winservice.cpp -o $(OBJDIR)/winservice.o
173 winstat.o: ../filed/win32/winstat.cpp
174 $(CXX) -c ../filed/win32/winstat.cpp -o $(OBJDIR)/winstat.o
176 wintray.o: ../filed/win32/wintray.cpp
177 $(CXX) -c ../filed/win32/wintray.cpp -o $(OBJDIR)/wintray.o
179 winres.res: ../filed/win32/winres.rc
180 $(WINDRES) $(INCLUDE_ICONS) -o coff ../filed/win32/winres.rc -o $(OBJDIR)/winres.res
182 # mingw32-nm winres.res
184 ######################################################################
186 # Files in src/findlib
188 $(OBJDIR)/attribs.o \
190 $(OBJDIR)/create_file.o \
191 $(OBJDIR)/enable_priv.o \
193 $(OBJDIR)/find_one.o \
195 $(OBJDIR)/makepath.o \
199 attribs.o: ../findlib/attribs.c
200 $(CXX) -c ../findlib/attribs.c -o $(OBJDIR)/attribs.o
202 bfile.o: ../findlib/bfile.c
203 $(CXX) -c ../findlib/bfile.c -o $(OBJDIR)/bfile.o
205 create_file.o: ../findlib/create_file.c
206 $(CXX) -c ../findlib/create_file.c -o $(OBJDIR)/create_file.o
208 enable_priv.o: ../findlib/enable_priv.c
209 $(CXX) -c ../findlib/enable_priv.c -o $(OBJDIR)/enable_priv.o
211 find.o: ../findlib/find.c
212 $(CXX) -c ../findlib/find.c -o $(OBJDIR)/find.o
214 find_one.o: ../findlib/find_one.c
215 $(CXX) -c ../findlib/find_one.c -o $(OBJDIR)/find_one.o
217 fstype.o: ../findlib/fstype.c
218 $(CXX) -c ../findlib/fstype.c -o $(OBJDIR)/fstype.o
220 makepath.o: ../findlib/makepath.c
221 $(CXX) -c ../findlib/makepath.c -o $(OBJDIR)/makepath.o
223 match.o: ../findlib/match.c
224 $(CXX) -c ../findlib/match.c -o $(OBJDIR)/match.o
226 save-cwd.o: ../findlib/save-cwd.c
227 $(CXX) -c ../findlib/save-cwd.c -o $(OBJDIR)/save-cwd.o
230 ######################################################################
232 # Files in src/win32/lib, based on files in src/lib
235 $(OBJDIR)/address_conf.o \
241 $(OBJDIR)/bget_msg.o \
243 $(OBJDIR)/bnet_server.o \
249 $(OBJDIR)/btimers.o \
250 $(OBJDIR)/cram-md5.o \
255 $(OBJDIR)/fnmatch.o \
258 $(OBJDIR)/idcache.o \
262 $(OBJDIR)/mem_pool.o \
263 $(OBJDIR)/message.o \
264 $(OBJDIR)/parse_conf.o \
265 $(OBJDIR)/pythonlib.o \
269 $(OBJDIR)/semlock.o \
273 $(OBJDIR)/smartall.o \
276 $(OBJDIR)/watchdog.o \
283 OBJS = $(LIB_OBJS) $(OBJS_COMPAT) $(OBJS_WIN) $(OBJS_FINDLIB) $(OBJS_FILED)
291 $(LIB_MINGW)/libole32.a \
292 $(LIB_MINGW)/liboleaut32.a \
293 $(LIB_MINGW)/libuser32.a \
294 $(LIB_MINGW)/libadvapi32.a \
295 $(LIB_MINGW)/libgdi32.a \
296 $(LIB_MINGW)/libwsock32.a \
297 $(LIB_MINGW)/libshell32.a \
298 $(LIB_MINGW)/libnetapi32.a \
299 $(LIB_MINGW)/libuuid.a
302 # Rules for generating from ../lib
305 address_conf.o: ../lib/address_conf.c
306 $(CXX) -c ../lib/address_conf.c -o $(OBJDIR)/address_conf.o
308 alist.o: ../lib/alist.c
309 $(CXX) -c ../lib/alist.c -o $(OBJDIR)/alist.o
311 alloc.o: ../lib/alloc.c
312 $(CXX) -c ../lib/alloc.c -o $(OBJDIR)/alloc.o
314 attr.o: ../lib/attr.c
315 $(CXX) -c ../lib/attr.c -o $(OBJDIR)/attr.o
317 base64.o: ../lib/base64.c
318 $(CXX) -c ../lib/base64.c -o $(OBJDIR)/base64.o
320 berrno.o: ../lib/berrno.c
321 $(CXX) -c ../lib/berrno.c -o $(OBJDIR)/berrno.o
323 bget_msg.o: ../lib/bget_msg.c
324 $(CXX) -c ../lib/bget_msg.c -o $(OBJDIR)/bget_msg.o
326 bnet.o: ../lib/bnet.c
327 $(CXX) -c ../lib/bnet.c -o $(OBJDIR)/bnet.o
329 bnet_server.o: ../lib/bnet_server.c
330 $(CXX) -c ../lib/bnet_server.c -o $(OBJDIR)/bnet_server.o
332 bpipe.o: ../lib/bpipe.c
333 $(CXX) -c ../lib/bpipe.c -o $(OBJDIR)/bpipe.o
335 bregex.o: ../lib/bregex.c
336 $(CXX) -c ../lib/bregex.c -o $(OBJDIR)/bregex.o
338 bshm.o: ../lib/bshm.c
339 $(CXX) -c ../lib/bshm.c -o $(OBJDIR)/bshm.o
341 bsys.o: ../lib/bsys.c
342 $(CXX) -c ../lib/bsys.c -o $(OBJDIR)/bsys.o
344 btime.o: ../lib/btime.c
345 $(CXX) -c ../lib/btime.c -o $(OBJDIR)/btime.o
347 btimers.o: ../lib/btimers.c
348 $(CXX) -c ../lib/btimers.c -o $(OBJDIR)/btimers.o
350 cram-md5.o: ../lib/cram-md5.c
351 $(CXX) -c ../lib/cram-md5.c -o $(OBJDIR)/cram-md5.o
353 crc32.o: ../lib/crc32.c
354 $(CXX) -c ../lib/crc32.c -o $(OBJDIR)/crc32.o
356 daemon.o: ../lib/daemon.c
357 $(CXX) -c ../lib/daemon.c -o $(OBJDIR)/daemon.o
359 dlist.o: ../lib/dlist.c
360 $(CXX) -c ../lib/dlist.c -o $(OBJDIR)/dlist.o
362 edit.o: ../lib/edit.c
363 $(CXX) -c ../lib/edit.c -o $(OBJDIR)/edit.o
365 fnmatch.o: ../lib/fnmatch.c
366 $(CXX) -c ../lib/fnmatch.c -o $(OBJDIR)/fnmatch.o
368 hmac.o: ../lib/hmac.c
369 $(CXX) -c ../lib/hmac.c -o $(OBJDIR)/hmac.o
371 htable.o: ../lib/htable.c
372 $(CXX) -c ../lib/htable.c -o $(OBJDIR)/htable.o
374 idcache.o: ../lib/idcache.c
375 $(CXX) -c ../lib/idcache.c -o $(OBJDIR)/idcache.o
378 $(CXX) -c ../lib/jcr.c -o $(OBJDIR)/jcr.o
381 $(CXX) -c ../lib/lex.c -o $(OBJDIR)/lex.o
384 $(CXX) -c ../lib/md5.c -o $(OBJDIR)/md5.o
386 mem_pool.o: ../lib/mem_pool.c
387 $(CXX) -c ../lib/mem_pool.c -o $(OBJDIR)/mem_pool.o
389 message.o: ../lib/message.c
390 $(CXX) -c ../lib/message.c -o $(OBJDIR)/message.o
392 parse_conf.o: ../lib/parse_conf.c
393 $(CXX) -c ../lib/parse_conf.c -o $(OBJDIR)/parse_conf.o
395 pythonlib.o: ../lib/pythonlib.c
396 $(CXX) -c ../lib/pythonlib.c -o $(OBJDIR)/pythonlib.o
398 queue.o: ../lib/queue.c
399 $(CXX) -c ../lib/queue.c -o $(OBJDIR)/queue.o
402 $(CXX) -c ../lib/res.c -o $(OBJDIR)/res.o
404 rwlock.o: ../lib/rwlock.c
405 $(CXX) -c ../lib/rwlock.c -o $(OBJDIR)/rwlock.o
407 scan.o: ../lib/scan.c
408 $(CXX) -c ../lib/scan.c -o $(OBJDIR)/scan.o
410 semlock.o: ../lib/semlock.c
411 $(CXX) -c ../lib/semlock.c -o $(OBJDIR)/semlock.o
413 serial.o: ../lib/serial.c
414 $(CXX) -c ../lib/serial.c -o $(OBJDIR)/serial.o
416 sha1.o: ../lib/sha1.c
417 $(CXX) -c ../lib/sha1.c -o $(OBJDIR)/sha1.o
419 signal.o: ../lib/signal.c
420 $(CXX) -c ../lib/signal.c -o $(OBJDIR)/signal.o
422 smartall.o: ../lib/smartall.c
423 $(CXX) -c ../lib/smartall.c -o $(OBJDIR)/smartall.o
426 $(CXX) -c ../lib/tls.c -o $(OBJDIR)/tls.o
428 tree.o: ../lib/tree.c
429 $(CXX) -c ../lib/tree.c -o $(OBJDIR)/tree.o
431 util.o: ../lib/util.c
432 $(CXX) -c ../lib/util.c -o $(OBJDIR)/util.o
435 $(CXX) -c ../lib/var.c -o $(OBJDIR)/var.o
437 watchdog.o: ../lib/watchdog.c
438 $(CXX) -c ../lib/watchdog.c -o $(OBJDIR)/watchdog.o
440 winapi.o: ../lib/winapi.c
441 $(CXX) -c ../lib/winapi.c -o $(OBJDIR)/winapi.o
443 workq.o: ../lib/workq.c
444 $(CXX) -c ../lib/workq.c -o $(OBJDIR)/workq.o
451 rm -f $(OBJDIR)/*.o $(OBJDIR)/bacula-fd.exe $(OBJDIR)/winres.res
453 # Link the executable ...
454 bacula-fd.exe: $(OBJS)
455 $(CXX) $(OBJS) $(LIBS) -o $(OBJDIR)/bacula-fd.exe
458 # Fix vss files: check for consistent levels of pointer indirection
459 # vss_generic.c: VSS_TIMEOUT defined as empty/null
460 # bpipe.c: WTERMSIG undefined