Skip to content

Commit 6fcfe3b

Browse files
committed
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 <[email protected]>
1 parent 5e33ae2 commit 6fcfe3b

7 files changed

+40
-6
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.gitattributes export-ignore
2+
.gitignore export-ignore

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*~
2+
arch-chroot
3+
genfstab
4+
pacstrap
5+
arch-install-scripts-*.tar.gz*

Makefile

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
V=20120618
2+
3+
PREFIX = /usr/local
4+
5+
BINPROGS = arch-chroot genfstab pacstrap
6+
7+
all: $(BINPROGS)
8+
9+
%: %.in Makefile common
10+
@echo "GEN $@"
11+
@$(RM) "$@"
12+
@m4 -P $@.in >$@
13+
@chmod a-w "$@"
14+
@chmod +x "$@"
15+
16+
clean:
17+
rm -f $(BINPROGS)
18+
19+
install:
20+
install -dm0755 $(DESTDIR)$(PREFIX)/bin
21+
install -m0755 ${BINPROGS} $(DESTDIR)$(PREFIX)/bin
22+
23+
uninstall:
24+
for f in ${BINPROGS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done
25+
26+
dist:
27+
git archive --format=tar --prefix=arch-install-scripts-$(V)/ $(V) | gzip -9 > arch-install-scripts-$(V).tar.gz
28+
gpg --detach-sign --use-agent arch-install-scripts-$(V).tar.gz
29+
30+
.PHONY: all clean install uninstall dist

arch-chroot arch-chroot.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
shopt -s extglob
44

5-
. ./common
5+
m4_include(common)
66

77
usage() {
88
cat <<EOF

common

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/bin/bash
2-
31
out() { printf "$1 $2\n" "${@:3}"; }
42
error() { out "==> ERROR:" "$@"; }
53
msg() { out "==>" "$@"; }
@@ -71,7 +69,6 @@ fstype_is_pseudofs() {
7169
'spufs'
7270
'sysfs'
7371
'tmpfs')
74-
7572
in_array "$1" "${pseudofs_types[@]}"
7673
}
7774

genfstab genfstab.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
shopt -s extglob
44

5-
. ./common
5+
m4_include(common)
66

77
# we need this because %q isn't the opposite of %b
88
mangle() {

pacstrap pacstrap.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
shopt -s extglob
1212

13-
source ./common
13+
m4_include(common)
1414

1515
declare newroot=/mnt
1616

0 commit comments

Comments
 (0)