summaryrefslogtreecommitdiff
path: root/src/devtools/Makefile
blob: 453f84323b81a8a43665adb17757d4e60b70b19a (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Configuration
DESTDIR=

#prefix=/usr/local
prefix=/usr
exec_prefix=$(prefix)
datarootdir=$(prefix)/share

bindir=$(exec_prefix)/bin
sbindir=$(exec_prefix)/sbin
datadir=$(datarootdir)

pkgdatadir=$(datadir)/devtools

devtoolsdir=../../../devtools-par

default: all
all: build

######################################################################

copy: \
	archroot.in \
	checkpkg.in \
	find-libdeps.in \
	finddeps.in \
	lddd.in \
	lib/common.sh \
	lib/makechrootpkg.sh.in

archroot.in:     $(devtoolsdir)/mkarchroot.in    ; cp $< $@
checkpkg.in:     $(devtoolsdir)/checkpkg.in      ; cp $< $@
find-libdeps.in: $(devtoolsdir)/find-libdeps.in  ; cp $< $@
finddeps.in:     $(devtoolsdir)/finddeps.in      ; cp $< $@
lddd.in:         $(devtoolsdir)/lddd.in          ; cp $< $@
lib/common.sh:   $(devtoolsdir)/lib/common.sh    ; cp $< $@
lib/makechrootpkg.sh.in: $(devtoolsdir)/makechrootpkg.in ; cp $< $@

######################################################################

build: \
	archroot \
	checkpkg \
	find-libdeps \
	finddeps \
	lddd \
	lib/common.sh \
	lib/makechrootpkg.sh

edit = sed -e 's|m4_include(lib/\(.*\))|. @pkgdatadir@/\1|' -e "s|@pkgdatadir[@]|$(pkgdatadir)|g"

indent = emacs --batch $1 \
	--eval '(setq sh-basic-offset 8)' \
	--eval '(indent-region (point-min) (point-max) nil)' \
	-f save-buffer &>/dev/null

M4GEN  = @echo "M4GEN $2 ($1)"; $(edit) <"$1" >"$2"
INDENT = @echo "INDENT $2 ($1)"; cp "$1" "$2"; $(call indent,$2)

%: %.in Makefile
	$(call M4GEN,$<,$@); chmod 755 "$@"

lib/makechrootpkg.sh.ugly: %.ugly: %.in %.patch Makefile
	@echo "PATCH $@"
	@cp $*.in $@
	@patch $@ $*.patch

lib/makechrootpkg.sh: %: %.ugly Makefile
	$(call INDENT,$<,$@)

######################################################################

install: \
	$(DESTDIR)$(sbindir)/archroot \
	$(DESTDIR)$(bindir)/checkpkg \
	$(DESTDIR)$(bindir)/find-libdeps \
	$(DESTDIR)$(bindir)/find-libprovides \
	$(DESTDIR)$(bindir)/finddeps \
	$(DESTDIR)$(bindir)/lddd \
	$(DESTDIR)$(pkgdatadir)/common.sh \
	$(DESTDIR)$(pkgdatadir)/makechrootpkg.sh

$(DESTDIR)$(sbindir)/%: %
	install -Dm755 $< $@

$(DESTDIR)$(bindir)/%: %
	install -Dm755 $< $@

$(DESTDIR)$(pkgdatadir)/%: lib/%
	install -Dm644 $< $@

$(DESTDIR)$(bindir)/find-libprovides:
	install -d $(@D)
	ln -sf find-libdeps $@