summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 1079e9d3c0374e22145a9859bd64f343837385ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Makefile for mkinitcpio

VERSION = 0.7

DIRS = \
	/bin \
	/sbin \
	/etc/bash_completion.d \
	/etc/mkinitcpio.d \
	/lib/initcpio/hooks \
	/lib/initcpio/install \
	/lib/initcpio/udev \
	/usr/share/man/man5

DIST_EXTRA = \
	mkinitcpio.5

all: doc

install: all
	$(foreach dir,${DIRS},install -dm755 ${DESTDIR}${dir};)

	sed -e 's|^CONFIG=.*|CONFIG=/etc/mkinitcpio.conf|' \
	    -e 's|^FUNCTIONS=.*|FUNCTIONS=/lib/initcpio/functions|' \
	    -e 's|^HOOKDIR=.*|HOOKDIR=/lib/initcpio/hooks|' \
	    -e 's|^INSTDIR=.*|INSTDIR=/lib/initcpio/install|' \
	    -e 's|^PRESETDIR=.*|PRESETDIR=/etc/mkinitcpio.d|' \
	    < mkinitcpio > ${DESTDIR}/sbin/mkinitcpio

	sed "s|%VERSION%|${VERSION}|g" < lsinitcpio > ${DESTDIR}/bin/lsinitcpio

	chmod 755 ${DESTDIR}/bin/lsinitcpio ${DESTDIR}/sbin/mkinitcpio

	install -m644 mkinitcpio.conf ${DESTDIR}/etc/mkinitcpio.conf
	install -m755 -t ${DESTDIR}/lib/initcpio init
	install -m644 -t ${DESTDIR}/lib/initcpio init_functions functions
	install -m644 01-memdisk.rules ${DESTDIR}/lib/initcpio/udev/01-memdisk.rules

	install -m644 -t ${DESTDIR}/lib/initcpio/hooks hooks/*
	install -m644 -t ${DESTDIR}/lib/initcpio/install install/*
	install -m644 -t ${DESTDIR}/etc/mkinitcpio.d mkinitcpio.d/*

	install -m644 mkinitcpio.5 ${DESTDIR}/usr/share/man/man5/mkinitcpio.5
	install -m644 bash-completion ${DESTDIR}/etc/bash_completion.d/mkinitcpio

doc: mkinitcpio.5
mkinitcpio.5: mkinitcpio.5.txt Makefile
	a2x -d manpage \
		-f manpage \
		-a mansource=mkinitcpio \
		-a manversion=${VERSION} \
		-a manmanual=mkinitcpio mkinitcpio.5.txt

clean:
	${RM} -r build mkinitcpio-${VERSION}
	${RM} mkinitcpio-${VERSION}.tar.gz mkinitcpio.5 mkinitcpio.5.gz

tarball: dist
dist: doc
	git archive --prefix=mkinitcpio-${VERSION}/ -o mkinitcpio-${VERSION}.tar HEAD
	mkdir mkinitcpio-${VERSION}; \
		cp -t mkinitcpio-${VERSION} ${DIST_EXTRA}; \
		tar uf mkinitcpio-${VERSION}.tar mkinitcpio-${VERSION}; \
		${RM} -r mkinitcpio-${VERSION}
	gzip -9 mkinitcpio-${VERSION}.tar

.PHONY: clean dist install tarball