2022-10-10 00:37:51 +02:00
|
|
|
SHELL=/bin/bash
|
|
|
|
|
2023-09-27 00:38:17 +02:00
|
|
|
V=1.0.4
|
2021-11-29 20:43:22 +01:00
|
|
|
BUILDTOOLVER ?= $(V)
|
2010-05-02 15:46:51 +02:00
|
|
|
|
2011-08-12 16:44:36 +02:00
|
|
|
PREFIX = /usr/local
|
2018-09-09 21:02:43 +02:00
|
|
|
MANDIR = $(PREFIX)/share/man
|
2022-10-10 00:37:51 +02:00
|
|
|
DATADIR = $(PREFIX)/share/devtools
|
2022-05-18 00:35:08 +02:00
|
|
|
BUILDDIR = build
|
2011-08-12 16:44:36 +02:00
|
|
|
|
2022-10-10 00:37:51 +02:00
|
|
|
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
|
|
|
|
|
|
|
|
BINPROGS_SRC = $(wildcard src/*.in)
|
|
|
|
BINPROGS = $(addprefix $(BUILDDIR)/,$(patsubst src/%,bin/%,$(patsubst %.in,%,$(BINPROGS_SRC))))
|
|
|
|
LIBRARY_SRC = $(call rwildcard,src/lib,*.sh)
|
|
|
|
LIBRARY = $(addprefix $(BUILDDIR)/,$(patsubst src/%,%,$(patsubst %.in,%,$(LIBRARY_SRC))))
|
2022-05-18 02:24:58 +02:00
|
|
|
MAKEPKG_CONFIGS=$(wildcard config/makepkg/*)
|
|
|
|
PACMAN_CONFIGS=$(wildcard config/pacman/*)
|
|
|
|
SETARCH_ALIASES = $(wildcard config/setarch-aliases.d/*)
|
2022-06-20 01:15:34 +02:00
|
|
|
MANS = $(addprefix $(BUILDDIR)/,$(patsubst %.asciidoc,%,$(wildcard doc/man/*.asciidoc)))
|
2020-04-09 21:27:11 +02:00
|
|
|
|
2011-03-12 22:25:09 +01:00
|
|
|
COMMITPKG_LINKS = \
|
2022-12-13 20:41:37 +01:00
|
|
|
core-testingpkg \
|
|
|
|
core-stagingpkg \
|
2011-03-12 22:25:09 +01:00
|
|
|
extrapkg \
|
2022-12-13 20:41:37 +01:00
|
|
|
extra-testingpkg \
|
|
|
|
extra-stagingpkg \
|
2011-03-12 22:25:09 +01:00
|
|
|
multilibpkg \
|
2011-12-04 17:48:46 +01:00
|
|
|
multilib-testingpkg \
|
2012-01-14 20:22:26 +01:00
|
|
|
multilib-stagingpkg \
|
2011-12-04 17:48:46 +01:00
|
|
|
kde-unstablepkg \
|
|
|
|
gnome-unstablepkg
|
2011-03-12 22:25:09 +01:00
|
|
|
|
|
|
|
ARCHBUILD_LINKS = \
|
2023-05-03 13:33:14 +02:00
|
|
|
core-testing-x86_64-build \
|
|
|
|
core-testing-x86_64_v3-build \
|
|
|
|
core-staging-x86_64-build \
|
|
|
|
core-staging-x86_64_v3-build \
|
2011-03-12 22:25:09 +01:00
|
|
|
extra-x86_64-build \
|
2022-01-29 01:30:35 +01:00
|
|
|
extra-x86_64_v3-build \
|
2023-05-03 13:33:14 +02:00
|
|
|
extra-testing-x86_64-build \
|
|
|
|
extra-testing-x86_64_v3-build \
|
|
|
|
extra-staging-x86_64-build \
|
|
|
|
extra-staging-x86_64_v3-build \
|
2011-03-12 22:25:09 +01:00
|
|
|
multilib-build \
|
2011-12-04 17:48:46 +01:00
|
|
|
multilib-testing-build \
|
2012-01-14 20:22:26 +01:00
|
|
|
multilib-staging-build \
|
2011-12-04 17:48:46 +01:00
|
|
|
kde-unstable-x86_64-build \
|
|
|
|
gnome-unstable-x86_64-build
|
2011-03-12 22:25:09 +01:00
|
|
|
|
2022-05-18 02:07:01 +02:00
|
|
|
COMPLETIONS = $(addprefix $(BUILDDIR)/,$(patsubst %.in,%,$(wildcard contrib/completion/*/*)))
|
2012-06-24 23:50:22 +02:00
|
|
|
|
2022-05-18 00:35:08 +02:00
|
|
|
|
2022-12-30 16:49:58 +01:00
|
|
|
all: binprogs library conf completion man
|
2022-05-18 00:35:08 +02:00
|
|
|
binprogs: $(BINPROGS)
|
2022-10-10 00:37:51 +02:00
|
|
|
library: $(LIBRARY)
|
2022-05-18 00:35:08 +02:00
|
|
|
completion: $(COMPLETIONS)
|
2018-09-09 21:02:43 +02:00
|
|
|
man: $(MANS)
|
2011-08-29 10:53:50 +02:00
|
|
|
|
2022-05-18 02:24:58 +02:00
|
|
|
|
2022-05-18 02:31:26 +02:00
|
|
|
ifneq ($(wildcard *.in),)
|
|
|
|
$(error Legacy in prog file found: $(wildcard *.in) - please migrate to src/*)
|
|
|
|
endif
|
2022-05-18 02:24:58 +02:00
|
|
|
ifneq ($(wildcard pacman-*.conf),)
|
|
|
|
$(error Legacy pacman config file found: $(wildcard pacman-*.conf) - please migrate to config/pacman/*)
|
|
|
|
endif
|
|
|
|
ifneq ($(wildcard makepkg-*.conf),)
|
|
|
|
$(error Legacy makepkg config files found: $(wildcard makepkg-*.conf) - please migrate to config/makepkg/*)
|
|
|
|
endif
|
|
|
|
ifneq ($(wildcard setarch-aliases.d/*),)
|
|
|
|
$(error Legacy setarch aliase found: $(wildcard setarch-aliases.d/*) - please migrate to config/setarch-aliases.d/*)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2023-01-09 21:40:45 +01:00
|
|
|
edit = sed \
|
|
|
|
-e "s|@pkgdatadir[@]|$(DATADIR)|g" \
|
|
|
|
-e "s|@buildtoolver[@]|$(BUILDTOOLVER)|g"
|
2022-05-21 16:46:47 +02:00
|
|
|
GEN_MSG = @echo "GEN $(patsubst $(BUILDDIR)/%,%,$@)"
|
2011-11-01 15:33:08 +01:00
|
|
|
|
2022-05-18 02:07:01 +02:00
|
|
|
define buildInScript
|
2022-10-10 00:37:51 +02:00
|
|
|
$(1)/%: $(2)%$(3)
|
2022-05-21 16:46:47 +02:00
|
|
|
$$(GEN_MSG)
|
2022-05-18 02:07:01 +02:00
|
|
|
@mkdir -p $$(dir $$@)
|
|
|
|
@$(RM) "$$@"
|
2023-01-09 21:40:45 +01:00
|
|
|
@cat $$< | $(edit) >$$@
|
2022-10-10 00:37:51 +02:00
|
|
|
@chmod $(4) "$$@"
|
2023-01-31 09:43:15 +01:00
|
|
|
@bash -O extglob -n "$$@"
|
2022-05-18 02:07:01 +02:00
|
|
|
endef
|
|
|
|
|
2022-10-10 00:37:51 +02:00
|
|
|
$(eval $(call buildInScript,build/bin,src/,.in,755))
|
|
|
|
$(eval $(call buildInScript,build/lib,src/lib/,,644))
|
|
|
|
$(foreach completion,$(wildcard contrib/completion/*),$(eval $(call buildInScript,build/$(completion),$(completion)/,.in,444)))
|
2004-07-19 07:26:30 +02:00
|
|
|
|
2022-06-20 01:15:34 +02:00
|
|
|
$(BUILDDIR)/doc/man/%: doc/man/%.asciidoc doc/asciidoc.conf doc/man/include/footer.asciidoc
|
2022-05-21 16:46:47 +02:00
|
|
|
$(GEN_MSG)
|
2022-06-20 01:15:34 +02:00
|
|
|
@mkdir -p $(BUILDDIR)/doc/man
|
2022-10-10 00:37:51 +02:00
|
|
|
@a2x --no-xmllint --asciidoc-opts="-f doc/asciidoc.conf" -d manpage -f manpage --destination-dir=$(BUILDDIR)/doc/man -a pkgdatadir=$(DATADIR) $<
|
2018-09-09 21:02:43 +02:00
|
|
|
|
2022-12-30 16:49:58 +01:00
|
|
|
conf:
|
|
|
|
@install -d $(BUILDDIR)/makepkg.conf.d $(BUILDDIR)/pacman.conf.d
|
|
|
|
@cp -a $(MAKEPKG_CONFIGS) $(BUILDDIR)/makepkg.conf.d
|
|
|
|
@cp -a $(PACMAN_CONFIGS) $(BUILDDIR)/pacman.conf.d
|
|
|
|
|
2011-08-29 10:53:51 +02:00
|
|
|
clean:
|
2022-05-18 00:35:08 +02:00
|
|
|
rm -rf $(BUILDDIR)
|
2011-08-29 10:53:51 +02:00
|
|
|
|
2022-05-18 00:45:00 +02:00
|
|
|
install: all
|
2011-08-12 16:44:36 +02:00
|
|
|
install -dm0755 $(DESTDIR)$(PREFIX)/bin
|
2022-10-10 00:37:51 +02:00
|
|
|
install -dm0755 $(DESTDIR)$(DATADIR)/setarch-aliases.d
|
2022-12-30 16:49:58 +01:00
|
|
|
install -dm0755 $(DESTDIR)$(DATADIR)/makepkg.conf.d
|
|
|
|
install -dm0755 $(DESTDIR)$(DATADIR)/pacman.conf.d
|
2011-08-12 16:44:36 +02:00
|
|
|
install -m0755 ${BINPROGS} $(DESTDIR)$(PREFIX)/bin
|
2022-10-10 00:37:51 +02:00
|
|
|
install -dm0755 $(DESTDIR)$(DATADIR)/lib
|
|
|
|
cp -ra $(BUILDDIR)/lib/* $(DESTDIR)$(DATADIR)/lib
|
2022-12-30 16:49:58 +01:00
|
|
|
for conf in $(notdir $(MAKEPKG_CONFIGS)); do install -Dm0644 $(BUILDDIR)/makepkg.conf.d/$$conf $(DESTDIR)$(DATADIR)/makepkg.conf.d/$${conf##*/}; done
|
|
|
|
for conf in $(notdir $(PACMAN_CONFIGS)); do install -Dm0644 $(BUILDDIR)/pacman.conf.d/$$conf $(DESTDIR)$(DATADIR)/pacman.conf.d/$${conf##*/}; done
|
2022-10-10 00:37:51 +02:00
|
|
|
for a in ${SETARCH_ALIASES}; do install -m0644 $$a -t $(DESTDIR)$(DATADIR)/setarch-aliases.d; done
|
2011-08-12 16:44:36 +02:00
|
|
|
for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)$(PREFIX)/bin/$$l; done
|
|
|
|
for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)$(PREFIX)/bin/$$l; done
|
2011-08-08 17:58:12 +02:00
|
|
|
ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides
|
2022-05-18 02:07:01 +02:00
|
|
|
install -Dm0644 $(BUILDDIR)/contrib/completion/bash/devtools $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools
|
2022-10-10 00:37:51 +02:00
|
|
|
for f in $(notdir $(BINPROGS)); do ln -sf devtools $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$$f; done
|
2022-05-18 02:07:01 +02:00
|
|
|
install -Dm0644 $(BUILDDIR)/contrib/completion/zsh/_devtools $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
|
2018-09-09 21:02:43 +02:00
|
|
|
for manfile in $(MANS); do \
|
|
|
|
install -Dm644 $$manfile -t $(DESTDIR)$(MANDIR)/man$${manfile##*.}; \
|
|
|
|
done;
|
2007-11-28 00:54:57 +01:00
|
|
|
|
|
|
|
uninstall:
|
2022-05-18 00:35:08 +02:00
|
|
|
for f in $(notdir $(BINPROGS)); do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done
|
2022-10-10 00:37:51 +02:00
|
|
|
for f in $(notdir $(LIBRARY)); do rm -f $(DESTDIR)$(DATADIR)/lib/$$f; done
|
|
|
|
rm -rf $(DESTDIR)$(DATADIR)/lib
|
2022-12-30 16:49:58 +01:00
|
|
|
for conf in $(notdir $(MAKEPKG_CONFIGS)); do rm -f $(DESTDIR)$(DATADIR)/makepkg.conf.d/$${conf##*/}; done
|
|
|
|
for conf in $(notdir $(PACMAN_CONFIGS)); do rm -f $(DESTDIR)$(DATADIR)/pacman.conf.d/$${conf##*/}; done
|
2022-10-10 00:37:51 +02:00
|
|
|
for f in $(notdir $(SETARCH_ALIASES)); do rm -f $(DESTDIR)$(DATADIR)/setarch-aliases.d/$$f; done
|
2011-08-12 16:44:36 +02:00
|
|
|
for l in ${COMMITPKG_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
|
|
|
|
for l in ${ARCHBUILD_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
|
2022-10-10 00:37:51 +02:00
|
|
|
rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools
|
|
|
|
for f in $(notdir $(BINPROGS)); do rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$$f; done
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
|
2011-08-08 17:58:12 +02:00
|
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/find-libprovides
|
2022-05-18 00:35:08 +02:00
|
|
|
for manfile in $(notdir $(MANS)); do rm -f $(DESTDIR)$(MANDIR)/man$${manfile##*.}/$${manfile}; done;
|
2022-10-10 00:37:51 +02:00
|
|
|
rmdir --ignore-fail-on-non-empty \
|
|
|
|
$(DESTDIR)$(DATADIR)/setarch-aliases.d \
|
2022-12-30 16:49:58 +01:00
|
|
|
$(DESTDIR)$(DATADIR)/makepkg.conf.d \
|
|
|
|
$(DESTDIR)$(DATADIR)/pacman.conf.d \
|
2022-10-10 00:37:51 +02:00
|
|
|
$(DESTDIR)$(DATADIR)
|
2010-02-13 20:57:34 +01:00
|
|
|
|
2019-09-13 02:13:27 +02:00
|
|
|
tag:
|
2023-05-28 01:15:48 +02:00
|
|
|
@echo "current version: v$(V)"
|
|
|
|
@read -r -p "tag version: v" VERSION && \
|
|
|
|
sed -E "s|^V=.+|V=$$VERSION|" -i Makefile && \
|
|
|
|
git commit --gpg-sign --message "chore(release): version v$$VERSION" Makefile && \
|
|
|
|
git tag --sign --message "Version v$$VERSION" v$$VERSION
|
|
|
|
|
|
|
|
release: dist
|
2023-07-05 18:45:54 +02:00
|
|
|
glab release create v$(V) devtools-$(V).tar.gz*
|
2019-09-13 02:13:27 +02:00
|
|
|
|
2010-02-13 20:57:34 +01:00
|
|
|
dist:
|
2023-05-28 01:15:48 +02:00
|
|
|
git archive --format=tar --prefix=devtools-$(V)/ v$(V) | gzip > devtools-$(V).tar.gz
|
2011-10-31 14:04:35 +01:00
|
|
|
gpg --detach-sign --use-agent devtools-$(V).tar.gz
|
2011-03-12 21:53:52 +01:00
|
|
|
|
2022-10-10 00:37:51 +02:00
|
|
|
check: $(BINPROGS_SRC) $(LIBRARY_SRC) contrib/completion/bash/devtools.in config/makepkg/x86_64.conf contrib/makepkg/PKGBUILD.proto
|
2017-05-06 00:41:06 +02:00
|
|
|
shellcheck $^
|
|
|
|
|
2022-12-30 16:49:58 +01:00
|
|
|
.PHONY: all binprogs library completion conf man clean install uninstall tag dist upload check
|
2017-05-06 00:41:03 +02:00
|
|
|
.DELETE_ON_ERROR:
|