summaryrefslogtreecommitdiff
path: root/src/chroot-tools/Makefile
blob: b42d28d0478a7d1f91f4ab61ee334ce869de6f80 (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
# These files are coming from devtools
copy_files = makechrootpkg.sh.in mkarchroot.in arch-nspawn.in
# These are programs that we will use internally, but shouldn't be in PATH
libexecs = mkarchroot arch-nspawn distcc-tool chcleanup
no-progs = $(libexecs)
# These are the shell libraries we will use
libs = makechrootpkg.sh $(wildcard hooks-*.sh)

pots = $(libexecs) $(libs)

pkglibexecdir = $(libexecdir)/libretools/chroot
clean_files = makechrootpkg.sh.ugly* *~
include ../../common.mk

# Usage: $(call indent,FILENAME)
# Command to auto-indent a file.
indent = emacs --batch $1 \
	--eval '(setq sh-basic-offset 8)' \
	--eval '(indent-region (point-min) (point-max) nil)' \
	-f save-buffer &>/dev/null

# makechrootpkg.sh is special, we patch it and do fancy stuff
# The flow is:
# $(devtoolsdir)/*.in -> *.sh.in + *.sh.patch -> *.sh.ugly -> *.sh

makechrootpkg.sh.in: %.sh.in: $(devtoolsdir)/%.in
	cp $< $@
makechrootpkg.sh.ugly: %.ugly: %.in %.patch Makefile
	cp $*.in $@
	@echo 'PATCH $@ $*.patch'; patch $@ $*.patch || { rm -f -- '$@'; false; }
makechrootpkg.sh: %: %.ugly Makefile
	@echo 'EDIT < $< > $@'; $(edit) <'$<' >'$@' || { rm -f -- '$@'; false; }
	@echo 'INDENT $@'; $(call indent,$@) || { rm -f -- '$@'; false; }

mkarchroot: mkarchroot.in Makefile
	@echo '< $< M4_EDIT | SED > $@'
	@<'$<' $(edit) | sed 's|arch-nspawn|$$(librelib chroot/&)|' >'$@' || { rm -f -- '$@'; false; }
	@echo 'CHMOD $<'; chmod 755 "$@" || { rm -f -- '$@'; false; }

archroot: %: %.in Makefile
	@echo "GEN $@"
	@$(edit) <"$<" >"$@" || { rm -f -- '$@'; false; }
	@chmod 755 "$@" || { rm -f -- '$@'; false; }

distcc-tool.pot: xgettext-keywords-sh+=--keyword=errusage