'build' scripts before installing.
Earlier we renamed git-foo.sh to git-foo while installing, which was mostly done by inertia than anything else. This however made writing tests to use scripts harder. This patch builds the scripts the same way as we build binaries from their sources. As a side effect, you can now specify non-standard paths you have your Perl binary is in when running the make. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Sep 8, 2005 at 18:50 UTC
bc6146d2abcf3800eb3683cfe972cabd38ff4796
5 files changed
+33
-25
Makefile
+26
-18
@@ -142,6 +142,13 @@ ifeq ($(shell uname -s),SunOS)
142
PLATFORM_DEFINES += -DNO_GETDOMAINNAME=1
143
endif
144
145
+ifndef SHELL_PATH
146
+ SHELL_PATH = /bin/sh
147
+endif
148
+ifndef PERL_PATH
149
+ PERL_PATH = /usr/bin/perl
150
+endif
151
+
152
ifndef NO_OPENSSL
153
LIB_OBJS += epoch.o
154
OPENSSL_LIBSSL = -lssl
@@ -179,21 +186,32 @@ endif
186
187
DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
188
182
-SCRIPTS = $(SCRIPT_SH) $(SCRIPT_PERL) gitk
189
+SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
190
+ $(patsubst %.perl,%,$(SCRIPT_PERL)) gitk
191
192
### Build rules
193
186
-all: $(PROGRAMS) git.sh
194
+all: $(PROGRAMS) $(SCRIPTS)
195
196
all:
197
$(MAKE) -C templates
198
191
-git.sh: git.sh.in Makefile
199
+git: git.sh Makefile
200
rm -f $@+ $@
193
- sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.in >$@+
201
+ sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.sh >$@+
202
chmod +x $@+
203
mv $@+ $@
204
205
+$(filter-out git,$(patsubst %.sh,%,$(SCRIPT_SH))) : % : %.sh
206
+ rm -f $@
207
+ sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' $@.sh >$@
208
+ chmod +x $@
209
+
210
+$(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl
211
+ rm -f $@
212
+ sed -e '1s|#!.*perl|#!$(PERL_PATH)|' $@.perl >$@
213
+ chmod +x $@
214
+
215
%.o: %.c
216
$(CC) -o $*.o -c $(ALL_CFLAGS) $<
217
%.o: %.S
@@ -250,19 +268,8 @@ check:
268
269
install: $(PROGRAMS) $(SCRIPTS)
270
$(INSTALL) -m755 -d $(DESTDIR)$(bindir)
253
- $(INSTALL) $(PROGRAMS) $(DESTDIR)$(bindir)
254
- @for s in $(SCRIPTS); \
255
- do \
256
- case "$$s" in \
257
- *.*) \
258
- e=`expr "$$s" : '\(.*\)\.[^.]*$$'` ;; \
259
- *) \
260
- e="$$s" ;; \
261
- esac && \
262
- echo ": install $$s $(DESTDIR)$(bindir)/$$e" && \
263
- $(INSTALL) $$s $(DESTDIR)$(bindir)/$$e || exit; \
264
- done
265
- $(INSTALL) git-revert.sh $(DESTDIR)$(bindir)/git-cherry-pick
271
+ $(INSTALL) $(PROGRAMS) $(SCRIPTS) $(DESTDIR)$(bindir)
272
+ $(INSTALL) git-revert $(DESTDIR)$(bindir)/git-cherry-pick
273
sh ./cmd-rename.sh $(DESTDIR)$(bindir)
274
$(MAKE) -C templates install
275
@@ -299,7 +306,8 @@ deb: dist
306
307
clean:
308
rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROGRAMS) $(LIB_FILE)
302
- rm -f git-core.spec git.sh
309
+ rm -f $(filter-out gitk,$(SCRIPTS))
310
+ rm -f git-core.spec
311
rm -rf $(GIT_TARNAME)
312
rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
313
rm -f git-core_$(GIT_VERSION)-*.deb git-core_$(GIT_VERSION)-*.dsc
git.sh
renamed
t/t1005-read-tree-m-2way-emu23.sh
+1
-1
@@ -25,7 +25,7 @@ In the test, these paths are used:
25
read_tree_twoway () {
26
git-read-tree --emu23 "$1" "$2" &&
27
git-ls-files --stage &&
28
- git-merge-index ../../git-merge-one-file.sh -a &&
28
+ git-merge-index git-merge-one-file -a &&
29
git-ls-files --stage
30
}
31
t/t3200-branch.sh
+3
-3
@@ -13,12 +13,12 @@ handled. Specifically, that a bogus branch is not created.
13
test_expect_success \
14
'prepare an trivial repository' \
15
'echo Hello > A &&
16
- ../../git-update-index --add A &&
17
- ../../git-commit.sh -m "Initial commit."'
16
+ git-update-index --add A &&
17
+ git-commit -m "Initial commit."'
18
19
test_expect_failure \
20
'git branch --help should return error code' \
21
- '../../git-branch.sh --help'
21
+ 'git-branch --help'
22
23
test_expect_failure \
24
'git branch --help should not have created a bogus branch' \
t/t5400-send-pack.sh
+3
-3
@@ -21,9 +21,9 @@ test_expect_success setup '
21
parent=$commit || return 1
22
done &&
23
echo "$commit" >.git/HEAD &&
24
- git-clone.sh -l ./. victim &&
24
+ git-clone -l ./. victim &&
25
cd victim &&
26
- git-log.sh &&
26
+ git-log &&
27
cd .. &&
28
echo $zero >.git/HEAD &&
29
parent=$zero &&
@@ -35,7 +35,7 @@ test_expect_success setup '
35
done &&
36
echo "$commit" >.git/HEAD &&
37
echo Rebase &&
38
- git-log.sh'
38
+ git-log'
39
40
test_expect_success \
41
'pushing rewound head should not barf but require --force' '