summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-06-15 17:52:29 -0600
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-06-23 00:06:24 -0600
commit04be9e4ab0bfd1499adda077ecbac21b567e541b (patch)
tree072e64cddfd94e925acaaa22c32da910ca3ccb61
parentdb321a9205d8902f71be4a6e296ff4b1ae5c6573 (diff)
mv src/devtools/lib/common.sh src/lib/ # and add common-devtools.mk
-rw-r--r--Makefile2
-rw-r--r--common-devtools.mk10
-rw-r--r--src/devtools/Makefile20
-rw-r--r--src/lib/.gitignore3
-rw-r--r--src/lib/Makefile43
-rw-r--r--src/lib/common.sh.top (renamed from src/devtools/lib/common.sh.top)0
6 files changed, 53 insertions, 25 deletions
diff --git a/Makefile b/Makefile
index be453fb..273699b 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,8 @@ check:
%-misc: PHONY src
$(MAKE) -C src $*
+copy-%: PHONY src/%
+ $(MAKE) -C src/$* copy
build-%: PHONY src/%
$(MAKE) -C src/$*
install-%: PHONY src/%
diff --git a/common-devtools.mk b/common-devtools.mk
new file mode 100644
index 0000000..c32db52
--- /dev/null
+++ b/common-devtools.mk
@@ -0,0 +1,10 @@
+topdir := $(dir $(lastword $(MAKEFILE_LIST)))
+include $(topdir)/config.mk
+
+edit = sed -e 's|m4_include(lib/\(.*\))|. $$(librelib \1)|'
+
+all: PHONY build
+
+FORCE: PHONY
+PHONY:
+.PHONY: FORCE PHONY
diff --git a/src/devtools/Makefile b/src/devtools/Makefile
index ddfdb0f..bca9780 100644
--- a/src/devtools/Makefile
+++ b/src/devtools/Makefile
@@ -1,13 +1,10 @@
topdir = ../..
-include ../../config.mk
+include ../../common-devtools.mk
######################################################################
pkglibexecdir=$(libexecdir)/libretools
-default: all
-all: build
-
######################################################################
copy: \
@@ -16,7 +13,6 @@ copy: \
find-libdeps.in \
finddeps.in \
lddd.in \
- lib/common.sh.in \
lib/makechrootpkg.sh.in
archroot.in: $(devtoolsdir)/mkarchroot.in ; cp $< $@
@@ -24,7 +20,6 @@ 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 $< $@
######################################################################
@@ -35,11 +30,8 @@ build: \
find-libdeps \
finddeps \
lddd \
- lib/common.sh \
lib/makechrootpkg.sh
-edit = sed -e 's|m4_include(lib/\(.*\))|. $$(librelib \1)|'
-
indent = emacs --batch $1 \
--eval '(setq sh-basic-offset 8)' \
--eval '(indent-region (point-min) (point-max) nil)' \
@@ -50,15 +42,6 @@ indent = emacs --batch $1 \
@$(edit) <"$<" >"$@"
@chmod 755 "$@"
-lib/common.sh: %: %.in %.top Makefile
- @echo "GEN $@"
- @{ \
- cat "$*.top" && \
- echo 'if [[ -z $${_INCLUDE_COMMON_SH:-} ]]; then' && \
- echo '_INCLUDE_COMMON_SH=true' && \
- cat "$*.in" && \
- echo 'fi'; } > "$@"
-
lib/makechrootpkg.sh.ugly: %.ugly: %.in %.patch Makefile
@echo "GEN $@"
@cp $*.in $@
@@ -78,7 +61,6 @@ install: \
$(DESTDIR)$(bindir)/find-libprovides \
$(DESTDIR)$(bindir)/finddeps \
$(DESTDIR)$(bindir)/lddd \
- $(DESTDIR)$(pkglibexecdir)/common.sh \
$(DESTDIR)$(pkglibexecdir)/makechrootpkg.sh
$(DESTDIR)$(sbindir)/%: %
diff --git a/src/lib/.gitignore b/src/lib/.gitignore
new file mode 100644
index 0000000..9a0c402
--- /dev/null
+++ b/src/lib/.gitignore
@@ -0,0 +1,3 @@
+common.sh
+common.sh.in
+common.sh.top
diff --git a/src/lib/Makefile b/src/lib/Makefile
index e1068c1..8683ee1 100644
--- a/src/lib/Makefile
+++ b/src/lib/Makefile
@@ -1,10 +1,41 @@
-libre_execdir=$(bindir)
-libre_datadir=$(libexecdir)/libretools
-include ../../common.mk
+include ../../common-devtools.mk
+pkglibexecdir=$(libexecdir)/libretools
+
+# Copy from devtools #################################################
+
+copy: common.sh.in
+
+common.sh.in: $(devtoolsdir)/lib/common.sh ; cp $< $@
+
+# Build ##############################################################
+
+build: common.sh
+
+lib/common.sh: %: %.in %.top Makefile
+ @echo "GEN $@"
+ @{ \
+ cat "$*.top" && \
+ echo 'if [[ -z $${_INCLUDE_COMMON_SH:-} ]]; then' && \
+ echo '_INCLUDE_COMMON_SH=true' && \
+ cat "$*.in" && \
+ echo 'fi'; } > "$@"
+
+# Install ############################################################
+
+executables = $(wildcard libre*)
+libraries = $(wildcard *.sh)
+
+# relative path to `/` from $(bindir)
rootdir=$(shell sed -r 's|^/||;s|[^/]+|..|g'<<<$(bindir))
-$(DESTDIR)$(libre_execdir)/%: %
- install -Dm755 '$<' '$(DESTDIR)$(libre_datadir)/$(@F)'
+install: \
+ $(addprefix $(DESTDIR)$(bindir)/,$(executables)) \
+ $(addprefix $(DESTDIR)$(pkglibexecdir)/,$(executables) $(libraries))
+
+$(DESTDIR)$(bindir)/%: %
install -d '$(@D)'
- ln -sf '$(rootdir)$(libre_datadir)/$(@F)' "$@"
+ ln -sf '$(rootdir)$(pkglibexecdir)/$(@F)' "$@"
+
+$(DESTDIR)$(pkglibexecdir)/%: %
+ install -Dm755 '$<' '$@'
diff --git a/src/devtools/lib/common.sh.top b/src/lib/common.sh.top
index d59268d..d59268d 100644
--- a/src/devtools/lib/common.sh.top
+++ b/src/lib/common.sh.top