Simplify the math to round up to the next multiple of some value.
[tor/rransom.git] / src / or / Makefile.am
blobc967a8846f55cb600b243ba6bfc376159434c928
1 TESTS = test
3 noinst_PROGRAMS = test
5 bin_PROGRAMS = tor
7 if BUILD_NT_SERVICES
8 tor_platform_source=ntmain.c
9 else
10 tor_platform_source=
11 endif
13 EXTRA_DIST=ntmain.c or_sha1.i
15 if USE_EXTERNAL_EVDNS
16 evdns_source=
17 else
18 evdns_source=eventdns.c
19 endif
21 COMMON_SRC = buffers.c circuitbuild.c circuitlist.c \
22         circuituse.c command.c config.c \
23         connection.c connection_edge.c connection_or.c control.c \
24         cpuworker.c directory.c dirserv.c dirvote.c \
25         dns.c dnsserv.c geoip.c hibernate.c main.c $(tor_platform_source) \
26         networkstatus.c onion.c policies.c \
27         reasons.c relay.c rendcommon.c rendclient.c rendmid.c \
28         rendservice.c rephist.c router.c routerlist.c routerparse.c \
29         $(evdns_source) config_codedigest.c
31 tor_SOURCES = $(COMMON_SRC) tor_main.c
33 AM_CPPFLAGS = -DSHARE_DATADIR="\"$(datadir)\"" \
34         -DLOCALSTATEDIR="\"$(localstatedir)\"" \
35         -DBINDIR="\"$(bindir)\""
37 # -L flags need to go in LDFLAGS. -l flags need to go in LDADD.
38 # This seems to matter nowhere but on windows, but I assure you that it
39 # matters a lot there, and is quite hard to debug if you forget to do it.
41 tor_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ @TOR_LDFLAGS_libevent@
42 tor_LDADD = ../common/libor.a ../common/libor-crypto.a \
43         ../common/libor-event.a \
44         -lz -levent -lssl -lcrypto @TOR_LIB_WS32@ @TOR_LIB_GDI@
45 test_SOURCES = $(COMMON_SRC) test_data.c test.c
47 test_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
48         @TOR_LDFLAGS_libevent@
49 test_LDADD = ../common/libor.a ../common/libor-crypto.a \
50         ../common/libor-event.a \
51         -lz -levent -lssl -lcrypto @TOR_LIB_WS32@ @TOR_LIB_GDI@
53 noinst_HEADERS = or.h eventdns.h eventdns_tor.h micro-revision.i
55 config_codedigest.o: or_sha1.i
57 tor_main.o: micro-revision.i
59 micro-revision.i: FORCE
60         @svkdir=$$SVKROOT;                                      \
61         if test "x$$svkdir" = x ; then                          \
62           svkdir=$$HOME/.svk;                                   \
63         fi;                                                     \
64         if test -d ../../.git && test -x "`which git 2>&1;true`" ; then \
65           if test -d ../../.git/svn && test -x "`which git-svn 2>&1;true`" ; then \
66             git-svn info ../../README |                         \
67             sed -n 's/^Revision: \([0-9][0-9]*\).*/"\1"/p'      \
68                                            > micro-revision.tmp \
69                 || true;                                        \
70           fi;                                                   \
71         elif test -d ../../.svn && test -x "`which svn 2>&1;true`" ; then \
72           svn info ../.. |                                      \
73           sed -n 's/^Revision: \([0-9][0-9]*\).*/"\1"/p' > micro-revision.tmp \
74              || true;                                           \
75         elif test -x "`which svk 2>&1;true`" && test -d $$svkdir/local; then \
76           location=../..;                                       \
77           rev=x;                                                \
78           while test x$$rev = xx; do                            \
79             x=`svk info $$location |                            \
80               sed -n 's/^Mirrored From:.*, Rev\. \([0-9][0-9]*\)/\1/p'`; \
81             if test x$$x != x; then                             \
82               rev=$$x;                                          \
83               break;                                            \
84             else                                                \
85               loc=`svk info $$location |                        \
86                 sed -n 's/^Copied From: \(.*\), Rev\. [0-9][0-9]*/\1/p' | \
87                 head -1`;                                       \
88               if test x$$loc = x; then                          \
89                 break;                                          \
90               else                                              \
91                 location=/$$loc;                                \
92               fi;                                               \
93             fi;                                                 \
94           done;                                                 \
95           if test x$$rev != xx; then                            \
96             echo \"$$rev\" > micro-revision.tmp;                \
97           fi;                                                   \
98         fi;                                                     \
99         if test ! -f micro-revision.tmp ; then                  \
100           if test ! -f micro-revision.i ; then                  \
101             echo '""' > micro-revision.i;                       \
102           fi;                                                   \
103         elif test ! -f micro-revision.i ||                      \
104           test x"`cat micro-revision.tmp`" != x"`cat micro-revision.i`"; then \
105           mv micro-revision.tmp micro-revision.i;               \
106         fi; true
108 or_sha1.i: $(tor_SOURCES) test_data.c test.c
109         if test "@SHA1SUM@" != none; then \
110           @SHA1SUM@ $(tor_SOURCES) test_data.c test.c | @SED@ -n 's/^\(.*\)$$/"\1\\n"/p' > or_sha1.i; \
111         elif test "@OPENSSL@" != none; then \
112           @OPENSSL@ sha1 $(tor_SOURCES) test_data.c test.c | @SED@ -n 's/SHA1(\(.*\))= \(.*\)/"\2  \1\\n"/p' > or_sha1.i; \
113         else \
114           rm or_sha1.i; \
115           touch or_sha1.i; \
116         fi
120 #Dummy target to ensure that micro-revision.i _always_ gets built.
121 FORCE: