Merge branch 'jk/sha1-file-reduce-useless-warnings' into maint
[git] / contrib / svn-fe / Makefile
1 all:: svn-fe$X
2
3 CC = cc
4 RM = rm -f
5 MV = mv
6
7 CFLAGS = -g -O2 -Wall
8 LDFLAGS =
9 EXTLIBS = -lz
10
11 include ../../config.mak.uname
12 -include ../../config.mak.autogen
13 -include ../../config.mak
14
15 ifeq ($(uname_S),Darwin)
16         ifndef NO_FINK
17                 ifeq ($(shell test -d /sw/lib && echo y),y)
18                         CFLAGS += -I/sw/include
19                         LDFLAGS += -L/sw/lib
20                 endif
21         endif
22         ifndef NO_DARWIN_PORTS
23                 ifeq ($(shell test -d /opt/local/lib && echo y),y)
24                         CFLAGS += -I/opt/local/include
25                         LDFLAGS += -L/opt/local/lib
26                 endif
27         endif
28 endif
29
30 ifndef NO_OPENSSL
31         EXTLIBS += -lssl
32         ifdef NEEDS_CRYPTO_WITH_SSL
33                 EXTLIBS += -lcrypto
34         endif
35 endif
36
37 ifndef NO_PTHREADS
38         CFLAGS += $(PTHREADS_CFLAGS)
39         EXTLIBS += $(PTHREAD_LIBS)
40 endif
41
42 ifdef HAVE_CLOCK_GETTIME
43         CFLAGS += -DHAVE_CLOCK_GETTIME
44         EXTLIBS += -lrt
45 endif
46
47 ifdef NEEDS_LIBICONV
48         EXTLIBS += -liconv
49 endif
50
51 GIT_LIB = ../../libgit.a
52 VCSSVN_LIB = ../../vcs-svn/lib.a
53 XDIFF_LIB = ../../xdiff/lib.a
54
55 LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(XDIFF_LIB)
56
57 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
58 QUIET_SUBDIR1 =
59
60 ifneq ($(findstring $(MAKEFLAGS),w),w)
61 PRINT_DIR = --no-print-directory
62 else # "make -w"
63 NO_SUBDIR = :
64 endif
65
66 ifneq ($(findstring $(MAKEFLAGS),s),s)
67 ifndef V
68         QUIET_CC      = @echo '   ' CC $@;
69         QUIET_LINK    = @echo '   ' LINK $@;
70         QUIET_SUBDIR0 = +@subdir=
71         QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
72                         $(MAKE) $(PRINT_DIR) -C $$subdir
73 endif
74 endif
75
76 svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(XDIFF_LIB) $(GIT_LIB)
77         $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(EXTLIBS) -o $@ svn-fe.o $(LIBS)
78
79 svn-fe.o: svn-fe.c ../../vcs-svn/svndump.h
80         $(QUIET_CC)$(CC) $(CFLAGS) -I../../vcs-svn -o $*.o -c $<
81
82 svn-fe.html: svn-fe.txt
83         $(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
84                 MAN_TXT=../contrib/svn-fe/svn-fe.txt \
85                 ../contrib/svn-fe/$@
86
87 svn-fe.1: svn-fe.txt
88         $(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
89                 MAN_TXT=../contrib/svn-fe/svn-fe.txt \
90                 ../contrib/svn-fe/$@
91         $(MV) ../../Documentation/svn-fe.1 .
92
93 ../../vcs-svn/lib.a: FORCE
94         $(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) vcs-svn/lib.a
95
96 ../../xdiff/lib.a: FORCE
97         $(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) xdiff/lib.a
98
99 ../../libgit.a: FORCE
100         $(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
101
102 clean:
103         $(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1
104
105 .PHONY: all clean FORCE