libgit-thin: Makefile: No need to use ':=' on a static line
[git/libgit-gsoc.git] / libgit-thin / Makefile
blobda9d292150c831f83d7194267fe78542fee33930
1 AR = ar
2 CC = gcc
3 INSTALL = install
4 CFLAGS = -O0 -Wall -W -Wmissing-declarations -Wmissing-prototypes \
5 -Wshadow -Wbad-function-cast -Wcast-qual
6 GIT_SRC_DIR = ..
7 GIT_ADD_HEADERS = -DSHA1_HEADER=\<openssl/sha.h\>
8 DOXYGEN_CONFIG = doxygen.conf
9 DOXYGEN_DIR = Documentation
10 DESTDIR := $(HOME)/libgit-thin
12 export CC CFLAGS
14 LIB_ARCHIVE = libgit-thin.a
15 LIB_OBJ = ltcommit.o ltrevlist.o ltrepo.o ltsha1.o
16 LIB_H = libgit-thin.h ltcommit.h ltrepo.h ltrevlist.h ltsha1.h
18 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
19 QUIET_SUBDIR1 =
21 ifneq ($(findstring $(MAKEFLAGS),s),s)
22 ifndef V
23 QUIET_CC = @echo ' ' CC $@;
24 QUIET_AR = @echo ' ' AR $@;
25 QUIET_SUBDIR0 = +@subdir=
26 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
27 $(MAKE) $(PRINT_DIR) -C $$subdir
28 export V
29 endif
30 endif
32 all: $(LIB_ARCHIVE) tests examples
34 $(LIB_ARCHIVE): $(LIB_OBJ) libgit-thin.h
35 $(QUIET_AR)rm -f $@ && $(AR) rcs $@ $(LIB_OBJ)
37 ltcommit.o: ltcommit.c ltcommit.h
38 $(QUIET_CC)$(CC) -c $< -I$(GIT_SRC_DIR) $(GIT_ADD_HEADERS) $(CFLAGS)
40 ltrevlist.o: ltrevlist.c ltrevlist.h ltcommit.o
41 $(QUIET_CC)$(CC) -c $< -I$(GIT_SRC_DIR) $(GIT_ADD_HEADERS) $(CFLAGS)
43 ltrepo.o: ltrepo.c ltrepo.h
44 $(QUIET_CC)$(CC) -c $< -I$(GIT_SRC_DIR) $(GIT_ADD_HEADERS) $(CFLAGS)
46 ltsha1.o: ltsha1.c ltsha1.h
47 $(QUIET_CC)$(CC) -c $< -I$(GIT_SRC_DIR) $(GIT_ADD_HEADERS) $(CFLAGS)
49 .PHONY: pygit doc clean tests test check examples
51 pygit: $(LIB_ARCHIVE)
52 $(QUIET_SUBDIR0)pygit $(QUIET_SUBDIR1)
54 tests: $(LIB_ARCHIVE)
55 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1)
57 examples: $(LIB_ARCHIVE)
58 $(QUIET_SUBDIR0)examples $(QUIET_SUBDIR1)
60 test check: tests
61 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) check
63 doc:
64 @doxygen $(DOXYGEN_CONFIG)
66 # FIXME: We should not copy GIT's files...
67 install: all
68 $(INSTALL) -d $(DESTDIR)
69 $(INSTALL) -m 644 libgit-thin.a $(DESTDIR)
70 $(INSTALL) -m 644 $(LIB_H) $(DESTDIR)
71 $(INSTALL) -m 644 $(GIT_SRC_DIR)/libgit.a $(DESTDIR)
72 $(INSTALL) -m 644 $(GIT_SRC_DIR)/xdiff/lib.a $(DESTDIR)/libxdiff.a
74 clean:
75 rm -f $(PROGRAMS) *.o *~ *.a core.*
76 $(MAKE) -C tests clean
77 $(MAKE) -C examples clean
78 rm -rf $(DOXYGEN_DIR)