3 # Define NO_VISIBILITY if your compiler does not support symbol
4 # visibility in general (and the -fvisibility switch in particular).
6 # Define NO_OPENSSL if you do not have OpenSSL, or if you simply want
7 # to use the bundled (Mozilla) SHA1 routines. (The bundled SHA1
8 # routines are reported to be faster than OpenSSL on some platforms)
19 uname_S
:= $(shell sh
-c
'uname -s 2>/dev/null || echo no')
27 # Platform specific tweaks
29 ifneq (,$(findstring CYGWIN
,$(uname_S
)))
30 NO_VISIBILITY
=YesPlease
33 SRC_C
= $(wildcard src
/*.c
)
34 OS_SRC
= $(wildcard src
/$(OS
)/*.c
)
36 OBJS
= $(patsubst %.c
,%.o
,$(SRC_C
))
37 HDRS
= $(wildcard src
/*.h
)
38 PUBLIC_HEADERS
= $(wildcard src
/git
/*.h
)
39 HDRS
+= $(PUBLIC_HEADERS
)
43 TEST_OBJ
= $(patsubst %.c
,%.o
,\
44 $(wildcard tests
/t
[0-9][0-9][0-9][0-9]-*.c
))
45 TEST_EXE
= $(patsubst %.o
,%.exe
,$(TEST_OBJ
))
46 TEST_RUN
= $(patsubst %.exe
,%.run
,$(TEST_EXE
))
49 SHA1_HEADER
= <openssl
/sha.h
>
51 SHA1_HEADER
= "sha1/sha1.h"
52 EXTRA_SRC
+= src
/sha1
/sha1.c
53 EXTRA_OBJ
+= src
/sha1
/sha1.o
56 BASIC_CFLAGS
:= -Isrc
-DSHA1_HEADER
='$(SHA1_HEADER)'
58 BASIC_CFLAGS
+= -fvisibility
=hidden
61 ALL_CFLAGS
= $(CFLAGS
) $(BASIC_CFLAGS
)
70 rm -f src
/*.o src
/sha1
/*.o src
/unix
/*.o
72 rm -f
*~ src
/*~ src
/git
/*~ src
/sha1
/*~ src
/unix
/*~ src
/win32
/*~
73 @
$(MAKE
) -C tests
-s
--no-print-directory
clean
76 @
$(MAKE
) -C tests
-s
--no-print-directory
clean
79 $(DOXYGEN
) api.doxygen
80 cp CONVENTIONS apidocs
/
83 @
$(MAKE
) -C tests
--no-print-directory
test
86 cgcc
-no-compile
$(ALL_CFLAGS
) $(SPARSE_FLAGS
) $(SRC_C
)
88 install-headers
: $(PUBLIC_HEADERS
)
89 @
$(INSTALL
) -d
/tmp
/gitinc
/git
90 @for i in
$^
; do cat .HEADER
$$i > /tmp
/gitinc
/$${i
##src/}; done
92 install: $(GIT_LIB
) $(PUBLIC_HEADERS
) libgit2.
pc
93 @
$(INSTALL
) -d
$(DESTDIR
)/$(prefix)/include/git
94 @for i in
$(PUBLIC_HEADERS
); do \
95 cat .HEADER
$$i > $(DESTDIR
)/$(prefix)/include/$${i
##src/}; \
97 @
$(INSTALL
) -d
$(DESTDIR
)/$(libdir)
98 @
$(INSTALL
) $(GIT_LIB
) $(DESTDIR
)/$(libdir)/libgit2.a
99 @
$(INSTALL
) -d
$(DESTDIR
)/$(libdir)/pkgconfig
100 @
$(INSTALL
) libgit2.
pc $(DESTDIR
)/$(libdir)/pkgconfig
/libgit2.
pc
103 @
rm -f
$(DESTDIR
)/$(libdir)/libgit2.a
104 @
rm -f
$(DESTDIR
)/$(libdir)/pkgconfig
/libgit2.
pc
105 @for i in
$(PUBLIC_HEADERS
); do \
106 rm -f
$(DESTDIR
)/$(prefix)/include/$${i
##src/}; \
108 @rmdir
$(DESTDIR
)/$(prefix)/include/git
111 $(CC
) $(ALL_CFLAGS
) -c
$< -o
$@
116 $(AR
) $(GIT_LIB
) $(OBJS
)
119 $(TEST_OBJ
) $(TEST_EXE
) $(TEST_RUN
):
120 @
$(MAKE
) -C tests
--no-print-directory \
121 OS
=$(OS
) NO_OPENSSL
=$(NO_OPENSSL
) $(@F
)
123 libgit2.
pc: libgit2.
pc.in
124 sed
-e
's#@prefix@#$(prefix)#' -e
's#@libdir@#$(libdir)#' $< > $@
128 .PHONY
: test $(TEST_RUN
) $(TEST_EXE
) $(TEST_OBJ
)
130 .PHONY
: install-headers
131 .PHONY
: install uninstall