Permalink
Browse files

Create a project Makefile

* the Makefile uses m4 to build the common lib into the scripts
* it includes install, uninstall and clean targets
* the dist target creates a source tar from a tag

Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
  • Loading branch information...
pierres committed Jun 18, 2012
1 parent 5e33ae2 commit 6fcfe3b26895240d6498a46c1fa3eebda707537e
Showing with 40 additions and 6 deletions.
  1. +2 −0 .gitattributes
  2. +5 −0 .gitignore
  3. +30 −0 Makefile
  4. +1 −1 arch-chroot → arch-chroot.in
  5. +0 −3 common
  6. +1 −1 genfstab → genfstab.in
  7. +1 −1 pacstrap → pacstrap.in
View
@@ -0,0 +1,2 @@
+.gitattributes export-ignore
+.gitignore export-ignore
View
@@ -0,0 +1,5 @@
+*~
+arch-chroot
+genfstab
+pacstrap
+arch-install-scripts-*.tar.gz*
View
@@ -0,0 +1,30 @@
+V=20120618
+
+PREFIX = /usr/local
+
+BINPROGS = arch-chroot genfstab pacstrap
+
+all: $(BINPROGS)
+
+%: %.in Makefile common
+ @echo "GEN $@"
+ @$(RM) "$@"
+ @m4 -P $@.in >$@
+ @chmod a-w "$@"
+ @chmod +x "$@"
+
+clean:
+ rm -f $(BINPROGS)
+
+install:
+ install -dm0755 $(DESTDIR)$(PREFIX)/bin
+ install -m0755 ${BINPROGS} $(DESTDIR)$(PREFIX)/bin
+
+uninstall:
+ for f in ${BINPROGS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done
+
+dist:
+ git archive --format=tar --prefix=arch-install-scripts-$(V)/ $(V) | gzip -9 > arch-install-scripts-$(V).tar.gz
+ gpg --detach-sign --use-agent arch-install-scripts-$(V).tar.gz
+
+.PHONY: all clean install uninstall dist
View
2 arch-chroot → arch-chroot.in 100755 → 100644
@@ -2,7 +2,7 @@
shopt -s extglob
-. ./common
+m4_include(common)
usage() {
cat <<EOF
View
3 common
@@ -1,5 +1,3 @@
-#!/bin/bash
-
out() { printf "$1 $2\n" "${@:3}"; }
error() { out "==> ERROR:" "$@"; }
msg() { out "==>" "$@"; }
@@ -71,7 +69,6 @@ fstype_is_pseudofs() {
'spufs'
'sysfs'
'tmpfs')
-
in_array "$1" "${pseudofs_types[@]}"
}
View
2 genfstab → genfstab.in 100755 → 100644
@@ -2,7 +2,7 @@
shopt -s extglob
-. ./common
+m4_include(common)
# we need this because %q isn't the opposite of %b
mangle() {
View
2 pacstrap → pacstrap.in 100755 → 100644
@@ -10,7 +10,7 @@
shopt -s extglob
-source ./common
+m4_include(common)
declare newroot=/mnt

0 comments on commit 6fcfe3b

Please sign in to comment.