988819cf61a33ddf7b0553c50c0ace0bdecdab7d
[platform/upstream/syncevolution.git] / src / synthesis / src / gen-makefile-am.sh
1 #! /bin/sh
2 #
3 # Turns Makefile.am.in into a Makefile.am which can be processed by
4 # automake. This is necessary because automake cannot build a list
5 # of source files dynamically.
6
7 # directories which contain sources for the sync engine
8 ENGINE_SOURCES="sysync DB_interfaces sysync_SDK/Sources Transport_interfaces/engine platform_adapters"
9
10 # files needed exclusively for libsynthesissdk.a
11 cat > SDK_FILES <<EOF
12 enginemodulebridge.cpp
13 enginemodulebridge.h
14 stringutil.cpp
15 stringutil.h
16 target_options.h
17 san.cpp
18 san.h
19 timeutil.cpp
20 timeutil.h
21 UI_util.cpp
22 UI_util.h
23 EOF
24
25 # The distinction between client and server files is not
26 # important and even likely to be wrong/incomplete. Right now,
27 # all of these files are compiled into libsynthesis and only
28 # kept out of libsynthesisdk.
29
30 # files needed exclusively for the client engine
31 cat >CLIENT_FILES <<EOF
32 binfile.cpp
33 binfileimplds.cpp
34 binfileimplclient.cpp
35 binfilebase.cpp
36 engineclientbase.cpp
37 syncclient.cpp
38 syncclientbase.cpp
39 EOF
40
41 # files needed exclusively for the server engine
42 cat > SERVER_FILES <<EOF
43 admindata.cpp
44 admindata.h
45 dbitem.cpp
46 dbitem.h
47 blobs.cpp
48 blobs.h
49 enginesessiondispatch.cpp
50 syncserver.cpp
51 EOF
52
53 # files not needed anywhere at the moment
54 cat > EXTRA_FILES <<EOF
55 clientprovisioning_inc.cpp
56 .*_tables_inc.cpp
57 syncsessiondispatch.cpp
58 platform_thread.cpp
59 enginestubs.c
60 EOF
61
62 # files to be included in libsynthesis
63 cat EXTRA_FILES SDK_FILES > EXCLUDE_FILES
64 LIBSYNTHESIS_SOURCES=`find ${ENGINE_SOURCES} \
65      syncapps/clientEngine_custom \
66      syncapps/serverEngine_custom \
67      sysync_SDK/DB_Interfaces/text_db \
68      \( -name '*.cpp' -o -name '*.[ch]' \) |
69     grep -v -E -f EXCLUDE_FILES`
70 LIBSYNTHESIS_SOURCES=`echo $LIBSYNTHESIS_SOURCES`
71
72 # files to be included in both libsynthesis and libsynthesissdk;
73 # necessary when building as shared libraries with these files not
74 # being exposed by libsynthesis
75 cat SERVER_FILES CLIENT_FILES EXTRA_FILES > EXCLUDE_FILES
76 LIBSYNTHESISSDK_SOURCES_BOTH=`find sysync_SDK/Sources \
77      \( -name '*.cpp' -o -name '*.c' \) |
78     grep -v -E -f EXCLUDE_FILES`
79 LIBSYNTHESISSDK_SOURCES_BOTH=`echo $LIBSYNTHESISSDK_SOURCES_BOTH`
80
81 # files only needed in libsynthesissdk
82 cat SERVER_FILES CLIENT_FILES EXTRA_FILES > EXCLUDE_FILES
83 LIBSYNTHESISSDK_SOURCES_ONLY=`find sysync_SDK/Sources \
84      \( -name '*.cpp' -o -name '*.c' \) |
85     grep -E -f SDK_FILES |
86     grep -v -E -f EXCLUDE_FILES`
87 LIBSYNTHESISSDK_SOURCES_ONLY=`echo $LIBSYNTHESISSDK_SOURCES_ONLY`
88
89 # files needed in libsmltk
90 LIBSMLTK_SOURCES=`find syncml_tk \
91      \( -name '*.cpp' -o -name '*.[ch]' \) \
92      \! \( -wholename syncml_tk/src/sml/\*/palm/\* -o \
93            -wholename syncml_tk/src/sml/\*/win/\* \)`
94 LIBSMLTK_SOURCES=`echo $LIBSMLTK_SOURCES`
95
96 # header files required for using libsynthesissdk,
97 # with "synthesis/" prefix
98 LIBSYNTHESISSDK_HEADERS=`find sysync_SDK/Sources -name '*.h' | sed -e 's;.*/;synthesis/;'`
99 LIBSYNTHESISSDK_HEADERS=`echo $LIBSYNTHESISSDK_HEADERS`
100
101 sed -e "s;@LIBSYNTHESIS_SOURCES@;$LIBSYNTHESIS_SOURCES;" \
102     -e "s;@LIBSYNTHESISSDK_SOURCES_BOTH@;$LIBSYNTHESISSDK_SOURCES_BOTH;" \
103     -e "s;@LIBSYNTHESISSDK_SOURCES_SDK_ONLY@;$LIBSYNTHESISSDK_SOURCES_ONLY;" \
104     -e "s;@LIBSMLTK_SOURCES@;$LIBSMLTK_SOURCES;" \
105     -e "s;@LIBSYNTHESISSDK_HEADERS@;$LIBSYNTHESISSDK_HEADERS;" \
106     Makefile.am.in >Makefile.am