@matheusbsbs / matheus-bagliano / commits / 39c015c556
Fork 0

Fixes for ancient versions of GNU make

Some versions of GNU make do not understand $(call), and have problems to interpret rules like this: some_target: CFLAGS += -Dsome=defs [jc: simplified substitution a bit. ] Signed-off-by: Johannes E. Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>

Johannes Schindelin committed Feb 18, 2006 at 12:40 UTC 39c015c556f285106931e0500f301de462b0e46e
2 files changed +45 -30
Makefile
+43 -25
@@ -204,12 +204,6 @@ LIB_OBJS = \
204 LIBS = $(LIB_FILE)
205 LIBS += -lz
206
207 -# Shell quote;
208 -# Result of this needs to be placed inside ''
209 -shq = $(subst ','\'',$(1))
210 -# This has surrounding ''
211 -shellquote = '$(call shq,$(1))'
212 -
207 #
208 # Platform specific tweaks
209 #
@@ -422,7 +416,21 @@ ifdef NO_ACCURATE_DIFF
416 ALL_CFLAGS += -DNO_ACCURATE_DIFF
417 endif
418
425 -ALL_CFLAGS += -DSHA1_HEADER=$(call shellquote,$(SHA1_HEADER)) $(COMPAT_CFLAGS)
419 +# Shell quote (do not use $(call) to accomodate ancient setups);
420 +
421 +SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
422 +
423 +DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
424 +bindir_SQ = $(subst ','\'',$(bindir))
425 +gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
426 +template_dir_SQ = $(subst ','\'',$(template_dir))
427 +
428 +SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
429 +PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
430 +PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
431 +GIT_PYTHON_DIR_SQ = $(subst ','\'',$(GIT_PYTHON_DIR))
432 +
433 +ALL_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' $(COMPAT_CFLAGS)
434 LIB_OBJS += $(COMPAT_OBJS)
435 export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
436 ### Build rules
@@ -441,7 +449,7 @@ git$X: git.c $(LIB_FILE)
449
450 $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
451 rm -f $@
444 - sed -e '1s|#!.*/sh|#!$(call shq,$(SHELL_PATH))|' \
452 + sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
453 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
454 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
455 -e 's/@@NO_PYTHON@@/$(NO_PYTHON)/g' \
@@ -450,15 +458,15 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
458
459 $(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl
460 rm -f $@
453 - sed -e '1s|#!.*perl|#!$(call shq,$(PERL_PATH))|' \
461 + sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
462 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
463 $@.perl >$@
464 chmod +x $@
465
466 $(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py
467 rm -f $@
460 - sed -e '1s|#!.*python|#!$(call shq,$(PYTHON_PATH))|' \
461 - -e 's|@@GIT_PYTHON_PATH@@|$(call shq,$(GIT_PYTHON_DIR))|g' \
468 + sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
469 + -e 's|@@GIT_PYTHON_PATH@@|$(GIT_PYTHON_DIR_SQ)|g' \
470 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
471 $@.py >$@
472 chmod +x $@
@@ -484,32 +492,42 @@ git$X git.spec \
492 %.o: %.S
493 $(CC) -o $*.o -c $(ALL_CFLAGS) $<
494
487 -exec_cmd.o: ALL_CFLAGS += -DGIT_EXEC_PATH=\"$(gitexecdir)\"
495 +exec_cmd.o: exec_cmd.c
496 + $(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $<
497
498 git-%$X: %.o $(LIB_FILE)
499 $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
500
492 -git-mailinfo$X : SIMPLE_LIB += $(LIB_4_ICONV)
501 $(SIMPLE_PROGRAMS) : $(LIB_FILE)
502 $(SIMPLE_PROGRAMS) : git-%$X : %.o
503 $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
504 $(LIB_FILE) $(SIMPLE_LIB)
505
498 -git-http-fetch$X: fetch.o http.o
499 -git-http-push$X: http.o
506 +git-mailinfo$X: mailinfo.o $(LIB_FILE)
507 + $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
508 + $(LIB_FILE) $(SIMPLE_LIB) $(LIB_4_ICONV)
509 +
510 git-local-fetch$X: fetch.o
511 git-ssh-fetch$X: rsh.o fetch.o
512 git-ssh-upload$X: rsh.o
513 git-ssh-pull$X: rsh.o fetch.o
514 git-ssh-push$X: rsh.o
515
506 -git-http-fetch$X: LIBS += $(CURL_LIBCURL)
507 -git-http-push$X: LIBS += $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
508 -git-rev-list$X: LIBS += $(OPENSSL_LIBSSL)
516 +git-http-fetch$X: fetch.o http.o http-fetch.o
517 + $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
518 + $(LIBS) $(CURL_LIBCURL)
519 +
520 +git-http-push$X: http.o http-push.o
521 + $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
522 + $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
523 +
524 +git-rev-list$X: rev-list.o
525 + $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
526 + $(LIBS) $(OPENSSL_LIBSSL)
527
528 init-db.o: init-db.c
529 $(CC) -c $(ALL_CFLAGS) \
512 - -DDEFAULT_GIT_TEMPLATE_DIR=$(call shellquote,"$(template_dir)") $*.c
530 + -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $*.c
531
532 $(LIB_OBJS): $(LIB_H)
533 $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H)
@@ -547,13 +565,13 @@ check:
565 ### Installation rules
566
567 install: all
550 - $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(bindir))
551 - $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(gitexecdir))
552 - $(INSTALL) $(ALL_PROGRAMS) $(call shellquote,$(DESTDIR)$(gitexecdir))
553 - $(INSTALL) git$X gitk $(call shellquote,$(DESTDIR)$(bindir))
568 + $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(bindir_SQ)'
569 + $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
570 + $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
571 + $(INSTALL) git$X gitk '$(DESTDIR_SQ)$(bindir_SQ)'
572 $(MAKE) -C templates install
555 - $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(GIT_PYTHON_DIR))
556 - $(INSTALL) $(PYMODULES) $(call shellquote,$(DESTDIR)$(GIT_PYTHON_DIR))
573 + $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
574 + $(INSTALL) $(PYMODULES) '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
575
576 install-doc:
577 $(MAKE) -C Documentation install
t/Makefile
+2 -5
@@ -8,10 +8,7 @@ SHELL_PATH ?= $(SHELL)
8 TAR ?= $(TAR)
9
10 # Shell quote;
11 -# Result of this needs to be placed inside ''
12 -shq = $(subst ','\'',$(1))
13 -# This has surrounding ''
14 -shellquote = '$(call shq,$(1))'
11 +SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
12
13 T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
14
@@ -22,7 +19,7 @@ endif
19 all: $(T) clean
20
21 $(T):
25 - @echo "*** $@ ***"; $(call shellquote,$(SHELL_PATH)) $@ $(GIT_TEST_OPTS)
22 + @echo "*** $@ ***"; '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
23
24 clean:
25 rm -fr trash