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>
This commit is contained in:
Pierre Schmitz 2012-06-18 11:07:37 +02:00
parent 5e33ae2a9e
commit 6fcfe3b268
7 changed files with 40 additions and 6 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
.gitattributes export-ignore
.gitignore export-ignore

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
*~
arch-chroot
genfstab
pacstrap
arch-install-scripts-*.tar.gz*

30
Makefile Normal file
View File

@ -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

2
arch-chroot → arch-chroot.in Executable file → Normal file
View File

@ -2,7 +2,7 @@
shopt -s extglob
. ./common
m4_include(common)
usage() {
cat <<EOF

3
common
View File

@ -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[@]}"
}

2
genfstab → genfstab.in Executable file → Normal file
View File

@ -2,7 +2,7 @@
shopt -s extglob
. ./common
m4_include(common)
# we need this because %q isn't the opposite of %b
mangle() {

2
pacstrap → pacstrap.in Executable file → Normal file
View File

@ -10,7 +10,7 @@
shopt -s extglob
source ./common
m4_include(common)
declare newroot=/mnt