summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--discard.mk50
-rwxr-xr-xmove.sh24
-rw-r--r--src/libbasic/Makefile19
-rw-r--r--test/Makefile2
4 files changed, 49 insertions, 46 deletions
diff --git a/discard.mk b/discard.mk
index 9f4fd5578a..54dbd80bb1 100644
--- a/discard.mk
+++ b/discard.mk
@@ -585,11 +585,11 @@ CLEANFILES += \
$(HTML_ALIAS) \
docs/html/man
-docs/html/man:
+$(outdir)/man:
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_LN)$(LN_S) -f ../../man $@
-man/index.html: man/systemd.index.html
+$(outdir)/index.html: man/systemd.index.html
$(AM_V_LN)$(LN_S) -f systemd.index.html $@
ifneq ($(HAVE_PYTHON),)
@@ -612,11 +612,11 @@ update-man-list: $(top_srcdir)/tools/make-man-rules.py $(XML_GLOB) man/custom-en
$(AM_V_at)mv $(top_srcdir)/Makefile-man.tmp $(top_srcdir)/Makefile-man.am
@echo "Makefile-man.am has been regenerated"
-man/systemd.index.xml: $(top_srcdir)/tools/make-man-index.py $(NON_INDEX_XML_FILES)
+$(outdir)/systemd.index.xml: $(top_srcdir)/tools/make-man-index.py $(NON_INDEX_XML_FILES)
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(PYTHON) $< $@ $(filter-out $<,$^)
-man/systemd.directives.xml: $(top_srcdir)/tools/make-directive-index.py man/custom-entities.ent $(SOURCE_XML_FILES)
+$(outdir)/systemd.directives.xml: $(top_srcdir)/tools/make-directive-index.py man/custom-entities.ent $(SOURCE_XML_FILES)
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(PYTHON) $< $@ $(SOURCE_XML_FILES)
@@ -877,13 +877,13 @@ SED_PROCESS = \
$(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
< $< > $@
-units/%: units/%.in
+$(outdir)/%: units/%.in
$(SED_PROCESS)
-man/%: man/%.in
+$(outdir)/%: man/%.in
$(SED_PROCESS)
-sysctl.d/%: sysctl.d/%.in
+$(outdir)/%: sysctl.d/%.in
$(SED_PROCESS)
%.pc: %.pc.in
@@ -892,13 +892,13 @@ sysctl.d/%: sysctl.d/%.in
%.conf: %.conf.in
$(SED_PROCESS)
-src/core/%.systemd: src/core/%.systemd.in
+$(outdir)/%.systemd: src/core/%.systemd.in
$(SED_PROCESS)
-src/%.policy.in: src/%.policy.in.in
+$(outdir)/%.policy.in: src/%.policy.in.in
$(SED_PROCESS)
-shell-completion/%: shell-completion/%.in
+$(outdir)/%: shell-completion/%.in
$(SED_PROCESS)
%.rules: %.rules.in
@@ -911,28 +911,28 @@ shell-completion/%: shell-completion/%.in
$(SED_PROCESS)
$(AM_V_GEN)chmod +x $@
-src/%.c: src/%.gperf
+$(outdir)/%.c: src/%.gperf
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GPERF)$(GPERF) < $< > $@
-src/%: src/%.m4 $(top_builddir)/config.status
+$(outdir)/%: src/%.m4 $(top_builddir)/config.status
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
-sysusers.d/%: sysusers.d/%.m4 $(top_builddir)/config.status
+$(outdir)/%: sysusers.d/%.m4 $(top_builddir)/config.status
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
-tmpfiles.d/%: tmpfiles.d/%.m4 $(top_builddir)/config.status
+$(outdir)/%: tmpfiles.d/%.m4 $(top_builddir)/config.status
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
-units/%: units/%.m4 $(top_builddir)/config.status
+$(outdir)/%: units/%.m4 $(top_builddir)/config.status
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_M4)$(M4) -P $(M4_DEFINES) -DFOR_SYSTEM=1 < $< > $@
-units/user/%: units/user/%.m4 $(top_builddir)/config.status
+$(outdir)/%: units/user/%.m4 $(top_builddir)/config.status
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_M4)$(M4) -P $(M4_DEFINES) -DFOR_USER=1 < $< > $@
@@ -947,7 +947,7 @@ EXTRA_DIST += \
$(polkitpolicy_in_in_files)
# ------------------------------------------------------------------------------
-man/custom-entities.ent: configure.ac
+$(outdir)/custom-entities.ent: configure.ac
$(AM_V_GEN)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)(echo '<?xml version="1.0" encoding="utf-8" ?>' && \
printf '$(subst '|,<!ENTITY ,$(subst =, ",$(subst |',">\n,$(substitutions))))') \
@@ -973,22 +973,22 @@ XSLTPROC_PROCESS_MAN = \
XSLTPROC_PROCESS_HTML = \
$(AM_V_XSLT)$(XSLT) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $<
-man/%.1: man/%.xml man/custom-man.xsl man/custom-entities.ent
+$(outdir)/%.1: man/%.xml man/custom-man.xsl man/custom-entities.ent
$(XSLTPROC_PROCESS_MAN)
-man/%.3: man/%.xml man/custom-man.xsl man/custom-entities.ent
+$(outdir)/%.3: man/%.xml man/custom-man.xsl man/custom-entities.ent
$(XSLTPROC_PROCESS_MAN)
-man/%.5: man/%.xml man/custom-man.xsl man/custom-entities.ent
+$(outdir)/%.5: man/%.xml man/custom-man.xsl man/custom-entities.ent
$(XSLTPROC_PROCESS_MAN)
-man/%.7: man/%.xml man/custom-man.xsl man/custom-entities.ent
+$(outdir)/%.7: man/%.xml man/custom-man.xsl man/custom-entities.ent
$(XSLTPROC_PROCESS_MAN)
-man/%.8: man/%.xml man/custom-man.xsl man/custom-entities.ent
+$(outdir)/%.8: man/%.xml man/custom-man.xsl man/custom-entities.ent
$(XSLTPROC_PROCESS_MAN)
-man/%.html: man/%.xml man/custom-html.xsl man/custom-entities.ent
+$(outdir)/%.html: man/%.xml man/custom-html.xsl man/custom-entities.ent
$(XSLTPROC_PROCESS_HTML)
define html-alias
@@ -1007,10 +1007,10 @@ sysvinit_DATA = \
varlog_DATA = \
docs/var-log/README
-docs/sysvinit/README: docs/sysvinit/README.in
+$(outdir)/README: docs/sysvinit/README.in
$(SED_PROCESS)
-docs/var-log/README: docs/var-log/README.in
+$(outdir)/README: docs/var-log/README.in
$(SED_PROCESS)
CLEANFILES += \
diff --git a/move.sh b/move.sh
index 083298ce63..a31fdc31da 100755
--- a/move.sh
+++ b/move.sh
@@ -128,7 +128,7 @@ breakup_makefile() (
fi
printf '%s\n' "$line" >> "$file"
fi
- done < <(sed -r 's|^if (.*)|ifneq ($(\1),)|' <Makefile.am)
+ done < <(fixup_makefile <Makefile.am)
rm .tmp.move.all
)
@@ -138,17 +138,31 @@ fixup_includes() (
xargs -d $'\n' sed -ri 's|#include "(sd-[^"]*)"|#include <systemd/\1>|'
)
+fixup_makefile() {
+ sed -r \
+ -e '/^[^#]*:/ { s|^(\s*)\S+/|\1$(outdir)/| }' \
+ -e 's|^if (.*)|ifneq ($(\1),)|'
+}
+
fixup_makefiles() (
- find src -type f -name Makefile \
- -exec sed -ri '/^[^#]*:/ { s|^(\s*)\S+/|\1$(outdir)/| }' -- {} +
+ sed -ri \
+ -e '/^ \$\(AM_V_at\)\$\(MKDIR_P\) \$\(dir \$@\)/d' \
+ -e 's/ \$\(CFLAGS\) / /g' \
+ -e 's/ \$\(CPPFLAGS\) / /g' \
+ -e '/^[^#]*:/ { s|\S+/|$(outdir)/| }' \
+ src/libbasic/Makefile
)
-move() {
+move() (
+ >&2 echo ' => move_files'
move_files
+ >&2 echo ' => breakup_makefile'
breakup_makefile
+ >&2 echo ' => fixup_includes'
fixup_includes
+ >&2 echo ' => fixup_makefiles'
fixup_makefiles
-}
+)
main() {
set -e
diff --git a/src/libbasic/Makefile b/src/libbasic/Makefile
index 0a6c94f6c1..f93f8607ea 100644
--- a/src/libbasic/Makefile
+++ b/src/libbasic/Makefile
@@ -242,50 +242,39 @@ libbasic_la_LIBADD = \
-lm
$(outdir)/errno-list.txt:
- $(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - </dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+/ { print $$2; }' >$@
+ $(AM_V_GEN)$(CPP) $(AM_CPPFLAGS) -dM -include errno.h - </dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+/ { print $$2; }' >$@
$(outdir)/errno-to-name.h: src/basic/errno-list.txt
- $(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
$(outdir)/af-list.txt:
- $(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include sys/socket.h - </dev/null | grep -v AF_UNSPEC | grep -v AF_MAX | $(AWK) '/^#define[ \t]+AF_[^ \t]+[ \t]+PF_[^ \t]/ { print $$2; }' >$@
+ $(AM_V_GEN)$(CPP) $(AM_CPPFLAGS) -dM -include sys/socket.h - </dev/null | grep -v AF_UNSPEC | grep -v AF_MAX | $(AWK) '/^#define[ \t]+AF_[^ \t]+[ \t]+PF_[^ \t]/ { print $$2; }' >$@
$(outdir)/af-to-name.h: src/basic/af-list.txt
- $(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const af_names[] = { "} !/AF_FILE/ && !/AF_ROUTE/ && !/AF_LOCAL/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
$(outdir)/arphrd-list.txt:
- $(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include net/if_arp.h - </dev/null | $(AWK) '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $$2; }' | sed -e 's/ARPHRD_//' >$@
+ $(AM_V_GEN)$(CPP) $(AM_CPPFLAGS) -dM -include net/if_arp.h - </dev/null | $(AWK) '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $$2; }' | sed -e 's/ARPHRD_//' >$@
$(outdir)/arphrd-to-name.h: src/basic/arphrd-list.txt
- $(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const arphrd_names[] = { "} !/CISCO/ { printf "[ARPHRD_%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
$(outdir)/arphrd-from-name.gperf: src/basic/arphrd-list.txt
- $(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(AWK) 'BEGIN{ print "struct arphrd_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, ARPHRD_%s\n", $$1, $$1 }' <$< >$@
$(outdir)/cap-list.txt:
- $(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include linux/capability.h -include missing.h - </dev/null | $(AWK) '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $$2; }' | grep -v CAP_LAST_CAP >$@
+ $(AM_V_GEN)$(CPP) $(AM_CPPFLAGS) -dM -include linux/capability.h -include missing.h - </dev/null | $(AWK) '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $$2; }' | grep -v CAP_LAST_CAP >$@
$(outdir)/cap-to-name.h: src/basic/cap-list.txt
- $(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const capability_names[] = { "} { printf "[%s] = \"%s\",\n", $$1, tolower($$1) } END{print "};"}' <$< >$@
$(outdir)/cap-from-name.gperf: src/basic/cap-list.txt
- $(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(AWK) 'BEGIN{ print "struct capability_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@
$(outdir)/cap-from-name.h: src/basic/cap-from-name.gperf
- $(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_capability -H hash_capability_name -p -C <$< >$@
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/test/Makefile b/test/Makefile
index 1d826c0bcd..2b00cff7f7 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -521,7 +521,7 @@ test_signal_util_LDADD = \
BUILT_SOURCES += \
src/test/test-hashmap-ordered.c
-src/test/test-hashmap-ordered.c: src/test/test-hashmap-plain.c
+$(outdir)/test-hashmap-ordered.c: src/test/test-hashmap-plain.c
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(AWK) 'BEGIN { print "/* GENERATED FILE */\n#define ORDERED" } \
{ if (!match($$0, "^#include")) \