summaryrefslogtreecommitdiff
path: root/src/devtools/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/devtools/Makefile')
-rw-r--r--src/devtools/Makefile115
1 files changed, 76 insertions, 39 deletions
diff --git a/src/devtools/Makefile b/src/devtools/Makefile
index 94f1f6b..d78e5f3 100644
--- a/src/devtools/Makefile
+++ b/src/devtools/Makefile
@@ -1,57 +1,94 @@
-V=20121128.6
+# Configuration
+DESTDIR=
-#prefix = /usr/local
-prefix = /usr
-PREFIX = $(prefix)
-pkgdatadir=$(PREFIX)/share/devtools
+#prefix=/usr/local
+prefix=/usr
+exec_prefix=$(prefix)
+datarootdir=$(prefix)/share
-BINPROGS = \
+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
+ lddd \
+ lib/common.sh \
+ lib/makechrootpkg.sh
-SBINPROGS = \
- mkarchroot
+edit = sed -e 's|m4_include(lib/\(.*\))|. @pkgdatadir@/\1|' -e "s|@pkgdatadir[@]|$(pkgdatadir)|g"
-all: $(BINPROGS) $(SBINPROGS) bash_completion zsh_completion
+indent = emacs --batch $1 \
+ --eval '(setq sh-basic-offset 8)' \
+ --eval '(indent-region (point-min) (point-max) nil)' \
+ -f save-buffer &>/dev/null
-edit = sed -e "s|@pkgdatadir[@]|$(pkgdatadir)|g"
+M4GEN = @echo "M4GEN $2 ($1)"; $(edit) <"$1" >"$2"
+INDENT = @echo "INDENT $2 ($1)"; cp "$1" "$2"; $(call indent,$2)
%: %.in Makefile
- @echo "GEN $@"
- @$(RM) "$@"
- @m4 -P $@.in | $(edit) >$@
- @chmod a-w "$@"
- @chmod +x "$@"
-
-clean:
- rm -f $(BINPROGS) $(SBINPROGS) bash_completion zsh_completion
+ $(call M4GEN,$<,$@); chmod 755 "$@"
-install: all
- install -dm0755 $(DESTDIR)$(PREFIX)/bin
- install -dm0755 $(DESTDIR)$(PREFIX)/sbin
- install -dm0755 $(DESTDIR)$(pkgdatadir)
+lib/makechrootpkg.sh.ugly: %.ugly: %.in %.patch Makefile
+ @echo "PATCH $@"
+ @cp $*.in $@
+ @patch $@ $*.patch
- install -m0755 ${BINPROGS} $(DESTDIR)$(PREFIX)/bin
-# install -m0755 ${SBINPROGS} $(DESTDIR)$(PREFIX)/sbin
- install -m0755 mkarchroot $(DESTDIR)$(PREFIX)/sbin/archroot
+lib/makechrootpkg.sh: %: %.ugly Makefile
+ $(call INDENT,$<,$@)
- ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides
+######################################################################
- install -m0644 lib/common.sh $(DESTDIR)$(pkgdatadir)/common.sh
- install -m0644 makechrootpkg.in $(DESTDIR)$(pkgdatadir)/makechrootpkg.sh
- install -Dm0644 bash_completion $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools
- install -Dm0644 zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
+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
-uninstall:
- for f in ${BINPROGS} ; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done
-# for f in ${SBINPROGS} ; do rm -f $(DESTDIR)$(PREFIX)/sbin/$$f; done
- rm -f $(DESTDIR)$(PREFIX)/sbin/archroot
+$(DESTDIR)$(PREFIX)/sbin/%: %
+ install -Dm755 $< $@
- rm -f $(DESTDIR)$(PREFIX)/bin/find-libprovides
+$(DESTDIR)$(PREFIX)/bin/%: %
+ install -Dm755 $< $@
- rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools
- rm -f $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
+$(DESTDIR)$(pkgdatadir)/%: lib/%
+ install -Dm644 $< $@
-.PHONY: all clean install uninstall
+$(DESTDIR)$(PREFIX)/bin/find-libprovides:
+ install -d $(@D)
+ ln -sf find-libdeps $@