1 #
2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 #
4 # Copyright 2018 Olaf Wintermann. All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are met:
8 #
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 #
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
15 #
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 # POSSIBILITY OF SUCH DAMAGE.
27 #
28
29 include ../config.mk
30
31 DAV_SRC = main.c
32 DAV_SRC += config.c
33 DAV_SRC += optparser.c
34 DAV_SRC += error.c
35 DAV_SRC += assistant.c
36 DAV_SRC += tar.c
37 DAV_SRC += system.c
38 DAV_SRC += libxattr.c
39 DAV_SRC += finfo.c
40 DAV_SRC += connect.c
41
42 SYNC_SRC = sync.c
43 SYNC_SRC += config.c
44 SYNC_SRC += scfg.c
45 SYNC_SRC += sopt.c
46 SYNC_SRC += db.c
47 SYNC_SRC += error.c
48 SYNC_SRC += assistant.c
49 SYNC_SRC += libxattr.c
50 SYNC_SRC += finfo.c
51 SYNC_SRC += tags.c
52 SYNC_SRC += system.c
53 SYNC_SRC += connect.c
54
55 XATTR_SRC = xattrtool.c
56 XATTR_SRC += libxattr.c
57
58 DAV_OBJ = $(DAV_SRC:%.c=../build/tool/%$(OBJ_EXT))
59 SYNC_OBJ = $(SYNC_SRC:%.c=../build/tool/%$(OBJ_EXT))
60 XATTR_OBJ = $(XATTR_SRC:%.c=../build/tool/%$(OBJ_EXT))
61
62 DAV_BIN = ../build/bin/dav$(APP_EXT)
63 DAV_SYNC_BIN = ../build/bin/dav-sync$(APP_EXT)
64 XATTRTOOL_BIN = ../build/bin/xattrtool$(APP_EXT)
65
66 all: ../build/bin/dav ../build/bin/dav-sync ../build/bin/xattrtool
67
68 $(DAV_BIN): $(DAV_OBJ) ../build/lib/libidav$(LIB_EXT)
69 $(CC) -o $(DAV_BIN) $(DAV_OBJ) \
70 ../build/lib/libidav$(LIB_EXT) ../build/lib/libucx$(LIB_EXT) \
71 $(LDFLAGS) $(DAV_LDFLAGS)
72
73 $(DAV_SYNC_BIN): $(SYNC_OBJ) ../build/lib/libidav$(LIB_EXT)
74 $(CC) -o $(DAV_SYNC_BIN) $(SYNC_OBJ) \
75 ../build/lib/libidav$(LIB_EXT) ../build/lib/libucx$(LIB_EXT) \
76 $(LDFLAGS) $(DAV_LDFLAGS)
77
78 $(XATTRTOOL_BIN): $(XATTR_OBJ)
79 $(CC) -o $(XATTRTOOL_BIN) $(XATTR_OBJ) $(LDFLAGS)
80
81 ../build/tool/%$(OBJ_EXT): %.c
82 $(CC) -I../ucx -I../ $(CFLAGS) $(DAV_CFLAGS) -c -o $@ $<
83
84 ../build/lib/libidav$(LIB_EXT):
85 test -f '$@'
86
87 cppcheck: $(DAV_SRC) $(SYNC_SRC)
88 $(CPPCHECK) $(CPPCHECK_CONFIG) -I../ucx $(CPPCHECK_FLAGS) $+ 2>> ../$(CPPCHECK_LOG)
89
90