diff options
Diffstat (limited to 'src/devtools/Makefile')
-rw-r--r-- | src/devtools/Makefile | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/src/devtools/Makefile b/src/devtools/Makefile new file mode 100644 index 0000000..e357675 --- /dev/null +++ b/src/devtools/Makefile @@ -0,0 +1,103 @@ +# 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.in \ + 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.in: $(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 + +%: %.in Makefile + @echo "GEN $@" + @$(edit) <"$<" >"$@" + @chmod 755 "$@" + +lib/common.sh: %: %.in Makefile + @echo "GEN $@" + @{ \ + echo 'if [[ -z $${_INCLUDE_COMMON_SH:-} ]]; then' && \ + echo '_INCLUDE_COMMON_SH=true' && \ + cat "$<" && \ + echo 'fi'; } > "$@" + +lib/makechrootpkg.sh.ugly: %.ugly: %.in %.patch Makefile + @echo "GEN $@" + @cp $*.in $@ + @patch $@ $*.patch + +lib/makechrootpkg.sh: %: %.ugly Makefile + @echo "GEN $@" + @$(edit) <"$<" >"$@" + $(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 $@ |