author | Lars Hjemli <hjemli@gmail.com> | 2007-05-14 22:48:31 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-05-14 22:48:31 (UTC) |
commit | ea2831f1c826d92c0158474c2d07837ec2f9fd6c (patch) (unidiff) | |
tree | e8d6a89bf0f50835f9c86dd642e7906e1d050df7 /Makefile | |
parent | 6fb7d09fea94b3dd6932469283358cb24f1e7e29 (diff) | |
download | cgit-ea2831f1c826d92c0158474c2d07837ec2f9fd6c.zip cgit-ea2831f1c826d92c0158474c2d07837ec2f9fd6c.tar.gz cgit-ea2831f1c826d92c0158474c2d07837ec2f9fd6c.tar.bz2 |
Don't hardcode urls when SCRIPT_NAME is available
Also, let the makefile define the name of the installed cgi and
use that definition as a default value for cgit_script_name variable.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | Makefile | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1,83 +1,85 @@ | |||
1 | CGIT_VERSION = 0.4 | 1 | CGIT_VERSION = 0.4 |
2 | 2 | ||
3 | prefix = /var/www/htdocs/cgit | 3 | prefix = /var/www/htdocs/cgit |
4 | 4 | ||
5 | SHA1_HEADER = <openssl/sha.h> | 5 | SHA1_HEADER = <openssl/sha.h> |
6 | CACHE_ROOT = /var/cache/cgit | 6 | CACHE_ROOT = /var/cache/cgit |
7 | CGIT_CONFIG = /etc/cgitrc | 7 | CGIT_CONFIG = /etc/cgitrc |
8 | CGIT_SCRIPT_NAME = cgit.cgi | ||
8 | 9 | ||
9 | EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto | 10 | EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto |
10 | OBJECTS = shared.o cache.o parsing.o html.o ui-shared.o ui-repolist.o \ | 11 | OBJECTS = shared.o cache.o parsing.o html.o ui-shared.o ui-repolist.o \ |
11 | ui-summary.o ui-log.o ui-view.o ui-tree.o ui-commit.o ui-diff.o \ | 12 | ui-summary.o ui-log.o ui-view.o ui-tree.o ui-commit.o ui-diff.o \ |
12 | ui-snapshot.o ui-blob.o | 13 | ui-snapshot.o ui-blob.o |
13 | 14 | ||
14 | CFLAGS += -Wall | 15 | CFLAGS += -Wall |
15 | 16 | ||
16 | ifdef DEBUG | 17 | ifdef DEBUG |
17 | CFLAGS += -g | 18 | CFLAGS += -g |
18 | endif | 19 | endif |
19 | 20 | ||
20 | CFLAGS += -Igit | 21 | CFLAGS += -Igit |
21 | CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)' | 22 | CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)' |
22 | CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' | 23 | CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' |
23 | CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' | 24 | CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' |
25 | CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' | ||
24 | 26 | ||
25 | 27 | ||
26 | # | 28 | # |
27 | # If make is run on a nongit platform, we need to get the git sources as a tarball. | 29 | # If make is run on a nongit platform, we need to get the git sources as a tarball. |
28 | # But there is currently no recent enough tarball available on kernel.org, so download | 30 | # But there is currently no recent enough tarball available on kernel.org, so download |
29 | # a zipfile from hjemli.net instead | 31 | # a zipfile from hjemli.net instead |
30 | # | 32 | # |
31 | GITVER = $(shell git version 2>/dev/null || echo nogit) | 33 | GITVER = $(shell git version 2>/dev/null || echo nogit) |
32 | ifeq ($(GITVER),nogit) | 34 | ifeq ($(GITVER),nogit) |
33 | GITURL = http://hjemli.net/git/git/snapshot/?id=v1.5.2-rc2 | 35 | GITURL = http://hjemli.net/git/git/snapshot/?id=v1.5.2-rc2 |
34 | INITGIT = test -e git/git.c || (curl "$(GITURL)" > tmp.zip && unzip tmp.zip) | 36 | INITGIT = test -e git/git.c || (curl "$(GITURL)" > tmp.zip && unzip tmp.zip) |
35 | else | 37 | else |
36 | INITGIT = ./submodules.sh -i | 38 | INITGIT = ./submodules.sh -i |
37 | endif | 39 | endif |
38 | 40 | ||
39 | 41 | ||
40 | # | 42 | # |
41 | # basic build rules | 43 | # basic build rules |
42 | # | 44 | # |
43 | all: cgit | 45 | all: cgit |
44 | 46 | ||
45 | cgit: cgit.c cgit.h $(OBJECTS) | 47 | cgit: cgit.c cgit.h $(OBJECTS) |
46 | $(CC) $(CFLAGS) cgit.c -o cgit $(OBJECTS) $(EXTLIBS) | 48 | $(CC) $(CFLAGS) cgit.c -o cgit $(OBJECTS) $(EXTLIBS) |
47 | 49 | ||
48 | $(OBJECTS): cgit.h git/libgit.a | 50 | $(OBJECTS): cgit.h git/libgit.a |
49 | 51 | ||
50 | git/libgit.a: | 52 | git/libgit.a: |
51 | $(INITGIT) | 53 | $(INITGIT) |
52 | $(MAKE) -C git | 54 | $(MAKE) -C git |
53 | 55 | ||
54 | # | 56 | # |
55 | # phony targets | 57 | # phony targets |
56 | # | 58 | # |
57 | install: all clean-cache | 59 | install: all clean-cache |
58 | mkdir -p $(prefix) | 60 | mkdir -p $(prefix) |
59 | install cgit $(prefix)/cgit.cgi | 61 | install cgit $(prefix)/$(CGIT_SCRIPT_NAME) |
60 | install cgit.css $(prefix)/cgit.css | 62 | install cgit.css $(prefix)/cgit.css |
61 | install add.png del.png $(prefix)/ | 63 | install add.png del.png $(prefix)/ |
62 | 64 | ||
63 | clean-cgit: | 65 | clean-cgit: |
64 | rm -f cgit *.o | 66 | rm -f cgit *.o |
65 | 67 | ||
66 | distclean-cgit: clean-cgit | 68 | distclean-cgit: clean-cgit |
67 | git clean -d -x | 69 | git clean -d -x |
68 | 70 | ||
69 | clean-sub: | 71 | clean-sub: |
70 | $(MAKE) -C git clean | 72 | $(MAKE) -C git clean |
71 | 73 | ||
72 | distclean-sub: clean-sub | 74 | distclean-sub: clean-sub |
73 | $(shell cd git && git clean -d -x) | 75 | $(shell cd git && git clean -d -x) |
74 | 76 | ||
75 | clean-cache: | 77 | clean-cache: |
76 | rm -rf $(CACHE_ROOT)/* | 78 | rm -rf $(CACHE_ROOT)/* |
77 | 79 | ||
78 | clean: clean-cgit clean-sub | 80 | clean: clean-cgit clean-sub |
79 | 81 | ||
80 | distclean: distclean-cgit distclean-sub | 82 | distclean: distclean-cgit distclean-sub |
81 | 83 | ||
82 | .PHONY: all install clean clean-cgit clean-sub clean-cache \ | 84 | .PHONY: all install clean clean-cgit clean-sub clean-cache \ |
83 | distclean distclean-cgit distclean-sub | 85 | distclean distclean-cgit distclean-sub |