aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile124
1 files changed, 5 insertions, 119 deletions
diff --git a/Makefile b/Makefile
index 1127961..8c00190 100644
--- a/Makefile
+++ b/Makefile
@@ -23,13 +23,6 @@ DOC_MAN5 = $(patsubst %.txt,%,$(MAN5_TXT))
23DOC_HTML = $(patsubst %.txt,%.html,$(MAN_TXT)) 23DOC_HTML = $(patsubst %.txt,%.html,$(MAN_TXT))
24DOC_PDF = $(patsubst %.txt,%.pdf,$(MAN_TXT)) 24DOC_PDF = $(patsubst %.txt,%.pdf,$(MAN_TXT))
25 25
26# Define NO_STRCASESTR if you don't have strcasestr.
27#
28# Define NO_OPENSSL to disable linking with OpenSSL and use bundled SHA1
29# implementation (slower).
30#
31# Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin).
32#
33# Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.) 26# Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
34# do not support the 'size specifiers' introduced by C99, namely ll, hh, 27# do not support the 'size specifiers' introduced by C99, namely ll, hh,
35# j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t). 28# j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
@@ -39,22 +32,12 @@ DOC_PDF = $(patsubst %.txt,%.pdf,$(MAN_TXT))
39#-include config.mak 32#-include config.mak
40 33
41# 34#
42# Platform specific tweaks
43#
44
45VERSION: force-version
46 @./gen-version.sh "$(CGIT_VERSION)"
47-include VERSION
48
49uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
50uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
51uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
52
53#
54# Let the user override the above settings. 35# Let the user override the above settings.
55# 36#
56-include cgit.conf 37-include cgit.conf
57 38
39export CGIT_SCRIPT_NAME CGIT_SCRIPT_PATH CGIT_DATA_PATH CGIT_CONFIG CACHE_ROOT
40
58# 41#
59# Define a way to invoke make in subdirs quietly, shamelessly ripped 42# Define a way to invoke make in subdirs quietly, shamelessly ripped
60# from git.git 43# from git.git
@@ -69,8 +52,6 @@ NO_SUBDIR = :
69endif 52endif
70 53
71ifndef V 54ifndef V
72 QUIET_CC = @echo ' ' CC $@;
73 QUIET_LINK = @echo ' ' LINK $@;
74 QUIET_SUBDIR0 = +@subdir= 55 QUIET_SUBDIR0 = +@subdir=
75 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ 56 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
76 $(MAKE) $(PRINT_DIR) -C $$subdir 57 $(MAKE) $(PRINT_DIR) -C $$subdir
@@ -78,107 +59,12 @@ ifndef V
78 export V 59 export V
79endif 60endif
80 61
81LDFLAGS ?=
82CFLAGS ?= -g -Wall
83CFLAGS += -Igit
84CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)'
85CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"'
86CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"'
87CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"'
88CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"'
89
90ifeq ($(uname_O),Cygwin)
91 NO_STRCASESTR = YesPlease
92 NEEDS_LIBICONV = YesPlease
93endif
94
95ifeq ($(uname_S),$(filter $(uname_S),FreeBSD OpenBSD))
96 # Apparantly libiconv is installed in /usr/local on BSD
97 LDFLAGS += -L/usr/local/lib
98 CFLAGS += -I/usr/local/include
99 NEEDS_LIBICONV = yes
100endif
101
102GIT_OPTIONS = prefix=/usr NO_GETTEXT=1
103OBJECTS =
104
105ifdef NO_ICONV
106 CFLAGS += -DNO_ICONV
107endif
108ifdef NO_STRCASESTR
109 CFLAGS += -DNO_STRCASESTR
110endif
111ifdef NO_C99_FORMAT
112 CFLAGS += -DNO_C99_FORMAT
113endif
114ifdef NO_OPENSSL
115 CFLAGS += -DNO_OPENSSL
116 GIT_OPTIONS += NO_OPENSSL=1
117else
118 LDLIBS += -lcrypto
119endif
120
121ifdef NEEDS_LIBICONV
122 LDLIBS += -liconv
123endif
124
125LDLIBS += git/libgit.a git/xdiff/lib.a -lz -lpthread
126
127OBJECTS += cgit.o
128OBJECTS += cache.o
129OBJECTS += cmd.o
130OBJECTS += configfile.o
131OBJECTS += html.o
132OBJECTS += parsing.o
133OBJECTS += scan-tree.o
134OBJECTS += shared.o
135OBJECTS += ui-atom.o
136OBJECTS += ui-blob.o
137OBJECTS += ui-clone.o
138OBJECTS += ui-commit.o
139OBJECTS += ui-diff.o
140OBJECTS += ui-log.o
141OBJECTS += ui-patch.o
142OBJECTS += ui-plain.o
143OBJECTS += ui-refs.o
144OBJECTS += ui-repolist.o
145OBJECTS += ui-shared.o
146OBJECTS += ui-snapshot.o
147OBJECTS += ui-ssdiff.o
148OBJECTS += ui-stats.o
149OBJECTS += ui-summary.o
150OBJECTS += ui-tag.o
151OBJECTS += ui-tree.o
152OBJECTS += vector.o
153
154dep_files := $(foreach f,$(OBJECTS),$(dir $f).deps/$(notdir $f).d)
155dep_dirs := $(addsuffix .deps,$(sort $(dir $OBJECTS)))
156
157$(dep_dirs):
158 @mkdir -p $@
159
160missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))
161dep_file = $(dir $@).deps/$(notdir $@).d
162dep_args = -MF $(dep_file) -MMD -MP
163
164.SUFFIXES: 62.SUFFIXES:
165 63
166$(OBJECTS): %.o: %.c $(missing_dep_dirs)
167 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(CFLAGS) $<
168
169dep_files_present := $(wildcard $(dep_files))
170ifneq ($(dep_files_present),)
171include $(dep_files_present)
172endif
173
174all:: cgit 64all:: cgit
175 65
176cgit: VERSION $(OBJECTS) libgit 66cgit:
177 $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS) 67 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) -f ../cgit.mk ../cgit NO_CURL=1
178
179libgit:
180 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) libgit.a
181 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) xdiff/lib.a
182 68
183test: all 69test: all
184 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all 70 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all
@@ -259,7 +145,7 @@ get-git:
259tags: 145tags:
260 $(QUIET_TAGS)find . -name '*.[ch]' | xargs ctags 146 $(QUIET_TAGS)find . -name '*.[ch]' | xargs ctags
261 147
262.PHONY: all cgit get-git libgit force-version 148.PHONY: all cgit get-git
263.PHONY: clean clean-doc cleanall 149.PHONY: clean clean-doc cleanall
264.PHONY: doc doc-html doc-man doc-pdf 150.PHONY: doc doc-html doc-man doc-pdf
265.PHONY: install install-doc install-html install-man install-pdf 151.PHONY: install install-doc install-html install-man install-pdf