Skip to content
Browse files

More portable Makefile

Fix #512 (thx to @avsm)
  • Loading branch information...
1 parent ca14f6f commit 1e6ab008b8ec6ef287259b04e7ca174e12218fd2 @samoht samoht committed Mar 6, 2013
Showing with 15 additions and 12 deletions.
  1. +6 −12 Makefile
  2. 0 { → shell}/crunch.ml
  3. +9 −0 shell/get-git-id.sh
View
18 Makefile
@@ -44,7 +44,8 @@ clean:
distclean: clean
$(MAKE) -C $(SRC_EXT) distclean
- rm -f META Makefile.config src/core/opamVersion.ml config.log config.status
+ rm -f META Makefile.config config.log config.status
+ rm -f src/core/opamVersion.ml src/core/opamGitVersion.ml src/core/opamScript.ml
.PHONY: tests
@@ -69,20 +70,13 @@ tests-git:
META: META.in
sed 's/@VERSION@/$(version)/g' < $< > $@
-ISGIT = $(shell if [ -e .git ]; then echo "1"; else echo "0"; fi)
-
-ifeq ($(ISGIT), 1)
-src/core/opamGitVersion.ml: .git/logs/HEAD
- @echo 'let version = Some "$(shell git describe)"' > $@
-else
src/core/opamGitVersion.ml:
- @echo "let version = None" > $@
-endif
+ ./shell/get-git-id.sh > $@
src/core/opamScript.ml: shell/
- ocaml crunch.ml "complete" < shell/opam_completion.sh > $@
- ocaml crunch.ml "complete_zsh" < shell/opam_completion_zsh.sh >> $@
- ocaml crunch.ml "switch_eval" < shell/opam_switch_eval.sh >> $@
+ ocaml shell/crunch.ml "complete" < shell/opam_completion.sh > $@
+ ocaml shell/crunch.ml "complete_zsh" < shell/opam_completion_zsh.sh >> $@
+ ocaml shell/crunch.ml "switch_eval" < shell/opam_switch_eval.sh >> $@
.PHONY: uninstall install
install:
View
0 crunch.ml → shell/crunch.ml
File renamed without changes.
View
9 shell/get-git-id.sh
@@ -0,0 +1,9 @@
+#!/bin/sh -e
+
+if [ -e .git/logs/HEAD ]; then
+ describe=$(git describe)
+ echo let version = Some \"${describe}\"
+else
+ echo "let version = None"
+
+fi

0 comments on commit 1e6ab00

Please sign in to comment.
Something went wrong with that request. Please try again.