summaryrefslogtreecommitdiff
path: root/src/lib/Makefile
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-02-08 16:36:45 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-02-08 16:36:45 -0500
commit7e704d7ac997387341e920e1757c24cac0efe5e9 (patch)
treea9f30eabaaad5496397a91053d3e03bab1ea57e4 /src/lib/Makefile
parent7785a72495e3eb0ea826b41720c241f58a15b601 (diff)
Refactor the build system. Avoid recursive make.
This looks like a lot, but more things should "just work". We have `make dist` now!
Diffstat (limited to 'src/lib/Makefile')
-rw-r--r--src/lib/Makefile44
1 files changed, 25 insertions, 19 deletions
diff --git a/src/lib/Makefile b/src/lib/Makefile
index 97b30eb..f9ec1e8 100644
--- a/src/lib/Makefile
+++ b/src/lib/Makefile
@@ -1,17 +1,17 @@
-copy_files = common.sh.in
-libexecs = $(filter-out librelib,$(progs))
-# include common.sh in libs explicitly, because it might not exist yet
-# when the wildcard is performed
-libs = $(sort $(wildcard *.sh) common.sh conf.sh)
+include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk
+include $(topsrcdir)/automake.head.mk
-include ../../common.mk
+install-libs += common.sh conf.sh
+devtools-files = common.sh.in
# Build ##############################################################
-common.sh: %: %.in %.top Makefile
- @echo "GEN $@"
+$(outdir)/conf.sh: $(var)sysconfdir $(var)pkgconfdir
+
+$(outdir)/common.sh: $(outdir)/%: $(srcdir)/%.in $(srcdir)/%.head $(srcdir)/%.tail $(outdir)/Makefile
+ @echo "OUT $@"
@{ \
- cat '$*.top' && \
+ cat '$(<D)/$*.head' && \
echo && \
sed -r \
-e '/encoding problem/d;/LANG=/d' \
@@ -19,21 +19,27 @@ common.sh: %: %.in %.top Makefile
-e 's/gettext /_l _ /g' \
-e "s/^(\s+)(msg|error) '/\1_l \2 '/" \
-e 's|lock\(\)\s*\{|lock()\n{|' \
- '$*.in' && \
+ '$(<D)/$*.in' && \
echo && \
- cat '$*.bottom' && \
+ cat '$(<D)/$*.tail' && \
:; } > '$@'
# Translate ##########################################################
-LIBREXGETTEXT_FLAGS += --simple=_l:2
-
-libreblacklist.pot: libreblacklist librexgettext
- { \
+$(outdir)/blacklist.sh.pot: $(srcdir)/blacklist.sh $(srcdir)/librexgettext
+ @echo "OUT $@"
+ @{ \
sed -n '/^# Usage:/,/()/{ /^#/ { =; p; } }' $< | \
sed -r -e 's/^# (.*)/msgid "\1"\nmsgstr ""\n/' \
- -e 's/^[0-9]*$$/#. embedded usage text\n#: $<:&/'; \
- ./librexgettext $<; \
- } | $(pofmt) > $@
+ -e 's/^[0-9]*$$/#. embedded usage text\n#: $<:&/' && \
+ $(<D)/librexgettext --simple=_l:2 $< && \
+ :; } | $(pofmt) > $@
+$(outdir)/common.sh.pot : LIBREXGETTEXT_FLAGS += --simple=_l:2
+$(outdir)/conf.sh.pot : LIBREXGETTEXT_FLAGS += --simple=_l:2
+$(outdir)/librelib.pot : LIBREXGETTEXT_FLAGS += --simple=_l:2
+$(outdir)/messages.sh.pot : LIBREXGETTEXT_FLAGS += --simple=_l:2
+$(outdir)/librexgettext.pot: LIBREXGETTEXT_FLAGS += --simple=errusage
+
+######################################################################
-librexgettext.pot: LIBREXGETTEXT_FLAGS += --simple=errusage
+include $(topsrcdir)/automake.tail.mk