diff options
Diffstat (limited to 'share')
85 files changed, 3662 insertions, 5 deletions
diff --git a/share/colldef/Makefile.depend b/share/colldef/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/colldef/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/dict/Makefile.depend b/share/dict/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/dict/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/doc/IPv6/Makefile.depend b/share/doc/IPv6/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/doc/IPv6/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/doc/bind9/Makefile.depend b/share/doc/bind9/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/doc/bind9/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/doc/legal/intel_ipw/Makefile.depend b/share/doc/legal/intel_ipw/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/doc/legal/intel_ipw/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/doc/legal/intel_iwi/Makefile.depend b/share/doc/legal/intel_iwi/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/doc/legal/intel_iwi/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/doc/legal/intel_iwn/Makefile.depend b/share/doc/legal/intel_iwn/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/doc/legal/intel_iwn/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/doc/legal/intel_wpi/Makefile.depend b/share/doc/legal/intel_wpi/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/doc/legal/intel_wpi/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/doc/llvm/Makefile.depend b/share/doc/llvm/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/doc/llvm/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/doc/llvm/clang/Makefile.depend b/share/doc/llvm/clang/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/doc/llvm/clang/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/examples/libvgl/Makefile.depend b/share/examples/libvgl/Makefile.depend new file mode 100644 index 0000000..a839545 --- /dev/null +++ b/share/examples/libvgl/Makefile.depend @@ -0,0 +1,19 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/APPLE/Makefile.depend b/share/i18n/csmapper/APPLE/Makefile.depend new file mode 100644 index 0000000..8b6d5ba --- /dev/null +++ b/share/i18n/csmapper/APPLE/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + usr.bin/mkcsmapper_static \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/AST/Makefile.depend b/share/i18n/csmapper/AST/Makefile.depend new file mode 100644 index 0000000..8b6d5ba --- /dev/null +++ b/share/i18n/csmapper/AST/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + usr.bin/mkcsmapper_static \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/BIG5/Makefile.depend b/share/i18n/csmapper/BIG5/Makefile.depend new file mode 100644 index 0000000..8b6d5ba --- /dev/null +++ b/share/i18n/csmapper/BIG5/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + usr.bin/mkcsmapper_static \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/CNS/Makefile.depend b/share/i18n/csmapper/CNS/Makefile.depend new file mode 100644 index 0000000..8b6d5ba --- /dev/null +++ b/share/i18n/csmapper/CNS/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + usr.bin/mkcsmapper_static \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/CP/Makefile.depend b/share/i18n/csmapper/CP/Makefile.depend new file mode 100644 index 0000000..8b6d5ba --- /dev/null +++ b/share/i18n/csmapper/CP/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + usr.bin/mkcsmapper_static \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/EBCDIC/Makefile.depend b/share/i18n/csmapper/EBCDIC/Makefile.depend new file mode 100644 index 0000000..8b6d5ba --- /dev/null +++ b/share/i18n/csmapper/EBCDIC/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + usr.bin/mkcsmapper_static \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/GB/Makefile.depend b/share/i18n/csmapper/GB/Makefile.depend new file mode 100644 index 0000000..8b6d5ba --- /dev/null +++ b/share/i18n/csmapper/GB/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + usr.bin/mkcsmapper_static \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/GEORGIAN/Makefile.depend b/share/i18n/csmapper/GEORGIAN/Makefile.depend new file mode 100644 index 0000000..8b6d5ba --- /dev/null +++ b/share/i18n/csmapper/GEORGIAN/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + usr.bin/mkcsmapper_static \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/ISO-8859/Makefile.depend b/share/i18n/csmapper/ISO-8859/Makefile.depend new file mode 100644 index 0000000..8b6d5ba --- /dev/null +++ b/share/i18n/csmapper/ISO-8859/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + usr.bin/mkcsmapper_static \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/ISO646/Makefile.depend b/share/i18n/csmapper/ISO646/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/i18n/csmapper/ISO646/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/JIS/Makefile.depend b/share/i18n/csmapper/JIS/Makefile.depend new file mode 100644 index 0000000..8b6d5ba --- /dev/null +++ b/share/i18n/csmapper/JIS/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + usr.bin/mkcsmapper_static \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/KAZAKH/Makefile.depend b/share/i18n/csmapper/KAZAKH/Makefile.depend new file mode 100644 index 0000000..8b6d5ba --- /dev/null +++ b/share/i18n/csmapper/KAZAKH/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + usr.bin/mkcsmapper_static \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/KOI/Makefile.depend b/share/i18n/csmapper/KOI/Makefile.depend new file mode 100644 index 0000000..8b6d5ba --- /dev/null +++ b/share/i18n/csmapper/KOI/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + usr.bin/mkcsmapper_static \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/KS/Makefile.depend b/share/i18n/csmapper/KS/Makefile.depend new file mode 100644 index 0000000..8b6d5ba --- /dev/null +++ b/share/i18n/csmapper/KS/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + usr.bin/mkcsmapper_static \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/MISC/Makefile.depend b/share/i18n/csmapper/MISC/Makefile.depend new file mode 100644 index 0000000..8b6d5ba --- /dev/null +++ b/share/i18n/csmapper/MISC/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + usr.bin/mkcsmapper_static \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/i18n/csmapper/TCVN/Makefile.depend b/share/i18n/csmapper/TCVN/Makefile.depend new file mode 100644 index 0000000..8b6d5ba --- /dev/null +++ b/share/i18n/csmapper/TCVN/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + usr.bin/mkcsmapper_static \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/man/man1/Makefile.depend b/share/man/man1/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/man/man1/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/man/man3/Makefile.depend b/share/man/man3/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/man/man3/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/man/man4/Makefile.depend b/share/man/man4/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/man/man4/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/man/man4/man4.arm/Makefile.depend b/share/man/man4/man4.arm/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/man/man4/man4.arm/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/man/man4/man4.i386/Makefile.depend b/share/man/man4/man4.i386/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/man/man4/man4.i386/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/man/man4/man4.powerpc/Makefile.depend b/share/man/man4/man4.powerpc/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/man/man4/man4.powerpc/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/man/man4/man4.sparc64/Makefile.depend b/share/man/man4/man4.sparc64/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/man/man4/man4.sparc64/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/man/man5/Makefile.depend b/share/man/man5/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/man/man5/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/man/man6/Makefile.depend b/share/man/man6/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/man/man6/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/man/man7/Makefile.depend b/share/man/man7/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/man/man7/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/man/man8/Makefile.depend b/share/man/man8/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/man/man8/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/man/man9/Makefile.depend b/share/man/man9/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/man/man9/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/me/Makefile.depend b/share/me/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/me/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/misc/Makefile.depend b/share/misc/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/misc/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/mk/Makefile.depend b/share/mk/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/mk/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/mk/auto.obj.mk b/share/mk/auto.obj.mk new file mode 100644 index 0000000..cd4b2b0 --- /dev/null +++ b/share/mk/auto.obj.mk @@ -0,0 +1,57 @@ +# $Id: auto.obj.mk,v 1.8 2011/08/08 17:35:20 sjg Exp $ +# +# @(#) Copyright (c) 2004, Simon J. Gerraty +# +# This file is provided in the hope that it will +# be of use. There is absolutely NO WARRANTY. +# Permission to copy, redistribute or otherwise +# use this file is hereby granted provided that +# the above copyright notice and this notice are +# left intact. +# +# Please send copies of changes and bug-fixes to: +# sjg@crufty.net +# + +ECHO_TRACE ?= echo + +.ifndef Mkdirs +# A race condition in some versions of mkdir, means that it can bail +# if another process made a dir that mkdir expected to. +# We repeat the mkdir -p a number of times to try and work around this. +# We stop looping as soon as the dir exists. +# If we get to the end of the loop, a plain mkdir will issue an error. +Mkdirs= Mkdirs() { \ + for d in $$*; do \ + for i in 1 2 3 4 5 6; do \ + mkdir -p $$d; \ + test -d $$d && return 0; \ + done > /dev/null 2>&1; \ + mkdir $$d || exit $$?; \ + done; } +.endif + +# if MKOBJDIRS is set to auto (and NOOBJ isn't defined) do some magic... +# This will automatically create objdirs as needed. +# Skip it if we are just doing 'clean'. +.if !defined(NOOBJ) && !defined(NO_OBJ) && ${MKOBJDIRS:Uno} == auto +# Use __objdir here so it is easier to tweak without impacting +# the logic. +__objdir?= ${MAKEOBJDIR} +__objdir:= ${__objdir:tA} +.if ${.OBJDIR} != ${__objdir} +# We need to chdir, make the directory if needed +.if !exists(${__objdir}/) && \ + (${.TARGETS} == "" || ${.TARGETS:Nclean*:N*clean:Ndestroy*} != "") +# This will actually make it... +__objdir_made != echo ${__objdir}/; umask ${OBJDIR_UMASK:U002}; \ + ${ECHO_TRACE} "[Creating objdir ${__objdir}...]" >&2; \ + ${Mkdirs}; Mkdirs ${__objdir} +.endif +# This causes make to use the specified directory as .OBJDIR +.OBJDIR: ${__objdir} +.if ${.OBJDIR} != ${__objdir} && ${__objdir_made:Uno:M${__objdir}/*} != "" +.error could not use ${__objdir} +.endif +.endif +.endif diff --git a/share/mk/bsd.crunchgen.mk b/share/mk/bsd.crunchgen.mk index 80d337f..95f1aa3 100644 --- a/share/mk/bsd.crunchgen.mk +++ b/share/mk/bsd.crunchgen.mk @@ -38,6 +38,8 @@ OUTPUTS=$(OUTMK) $(OUTC) $(PROG).cache CRUNCHOBJS= ${.OBJDIR} .if defined(MAKEOBJDIRPREFIX) CANONICALOBJDIR:= ${MAKEOBJDIRPREFIX}${.CURDIR} +.elif defined(MAKEOBJDIR) && ${MAKEOBJDIR:M/*} != "" +CANONICALOBJDIR:=${MAKEOBJDIR} .else CANONICALOBJDIR:= /usr/obj${.CURDIR} .endif diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 1d4a2c5..d65d3c1 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -102,8 +102,8 @@ ${_YC} y.tab.h: ${_YSRC} CLEANFILES+= y.tab.c y.tab.h .elif !empty(YFLAGS:M-d) .for _YH in ${_YC:R}.h -.ORDER: ${_YC} ${_YH} -${_YC} ${_YH}: ${_YSRC} +${_YH}: ${_YC} +${_YC}: ${_YSRC} ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} SRCS+= ${_YH} CLEANFILES+= ${_YH} @@ -119,10 +119,24 @@ ${_YC:R}.o: ${_YC} .endfor .endif +.if defined(.PARSEDIR) +.if ${MK_META_MODE} == "yes" +.include <meta.autodep.mk> +# this depend: bypasses that below +# the dependency helps when bootstrapping +depend: beforedepend ${DPSRCS} ${SRCS} afterdepend +beforedepend: +afterdepend: beforedepend +.endif +.endif + .if !target(depend) .if defined(SRCS) depend: beforedepend ${DEPENDFILE} afterdepend +# Tell bmake not to look for generated files via .PATH +.NOPATH: ${DEPENDFILE} + # Different types of sources are compiled with slightly different flags. # Split up the sources, and filter out headers and non-applicable flags. MKDEP_CFLAGS= ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BIDU]*} ${CFLAGS:M-std=*} ${CFLAGS:M-ansi} diff --git a/share/mk/bsd.files.mk b/share/mk/bsd.files.mk index 240f958..9ddb315 100644 --- a/share/mk/bsd.files.mk +++ b/share/mk/bsd.files.mk @@ -22,6 +22,10 @@ ${group}OWN?= ${SHAREOWN} ${group}GRP?= ${SHAREGRP} ${group}MODE?= ${SHAREMODE} ${group}DIR?= ${BINDIR} +.if !make(buildincludes) +STAGE_SETS+= ${group} +.endif +STAGE_DIR.${group}= ${STAGE_OBJTOP}${${group}DIR} _${group}FILES= .for file in ${${group}} @@ -37,6 +41,12 @@ ${group}NAME_${file:T}?= ${${group}NAME} .else ${group}NAME_${file:T}?= ${file:T} .endif +.if !make(buildincludes) +STAGE_AS_SETS+= ${group} +.endif +STAGE_AS_${file:T}= ${${group}NAME_${file:T}} +stage_as.${group}: ${file} + installfiles: _${group}INS_${file:T} _${group}INS_${file:T}: ${file} ${INSTALL} -o ${${group}OWN_${.ALLSRC:T}} \ @@ -48,6 +58,8 @@ _${group}FILES+= ${file} .endif .endfor .if !empty(_${group}FILES) +stage_files.${group}: ${_${group}FILES} + installfiles: _${group}INS _${group}INS: ${_${group}FILES} .if defined(${group}NAME) @@ -67,3 +79,12 @@ _${group}INS: ${_${group}FILES} realinstall: installfiles .ORDER: beforeinstall installfiles + +.if ${MK_STAGING} != "no" +.if !empty(STAGE_SETS) +buildfiles: stage_files +.if !empty(STAGE_AS_SETS) +buildfiles: stage_as +.endif +.endif +.endif diff --git a/share/mk/bsd.incs.mk b/share/mk/bsd.incs.mk index d51fb17..8182b30 100644 --- a/share/mk/bsd.incs.mk +++ b/share/mk/bsd.incs.mk @@ -24,6 +24,8 @@ ${group}OWN?= ${BINOWN} ${group}GRP?= ${BINGRP} ${group}MODE?= ${NOBINMODE} ${group}DIR?= ${INCLUDEDIR} +STAGE_SETS+= ${group} +STAGE_DIR.${group}= ${STAGE_OBJTOP}${${group}DIR} _${group}INCS= .for header in ${${group}} @@ -39,6 +41,10 @@ ${group}NAME_${header:T}?= ${${group}NAME} .else ${group}NAME_${header:T}?= ${header:T} .endif +STAGE_AS_SETS+= ${group} +STAGE_AS_${header:T}= ${${group}NAME_${header:T}} +stage_as.${group}: ${header} + installincludes: _${group}INS_${header:T} _${group}INS_${header:T}: ${header} ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \ @@ -50,6 +56,8 @@ _${group}INCS+= ${header} .endif .endfor .if !empty(_${group}INCS) +stage_files.${group}: ${_${group}INCS} + installincludes: _${group}INS _${group}INS: ${_${group}INCS} .if defined(${group}NAME) @@ -81,4 +89,15 @@ installincludes: realinstall: installincludes .ORDER: beforeinstall installincludes +.if ${MK_STAGING} != "no" +.if !target(stage_includes) +.if !empty(STAGE_SETS) +buildincludes: stage_files +.if !empty(STAGE_AS_SETS) +buildincludes: stage_as +.endif +.endif +.endif +.endif + .endif # !defined(NO_INCS) && ${MK_TOOLCHAIN} != "no" diff --git a/share/mk/bsd.init.mk b/share/mk/bsd.init.mk index 72a6de0..f5c31a5 100644 --- a/share/mk/bsd.init.mk +++ b/share/mk/bsd.init.mk @@ -6,10 +6,19 @@ .if !target(__<bsd.init.mk>__) __<bsd.init.mk>__: +.sinclude "local.init.mk" .if exists(${.CURDIR}/../Makefile.inc) .include "${.CURDIR}/../Makefile.inc" .endif .include <bsd.compat.mk> .include <bsd.own.mk> .MAIN: all + +.if defined(.PARSEDIR) +.if ${.MAKE.LEVEL:U1} == 0 && ${BUILD_AT_LEVEL0:Uyes:tl} == "no" +# this tells lib.mk and prog.mk to not actually build anything +_SKIP_BUILD = not building at level 0 +.endif +.endif + .endif # !target(__<bsd.init.mk>__) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index f5fcd48..9a86e0c 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -113,7 +113,9 @@ PO_FLAG=-pg ${CC} ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} +.if !defined(_SKIP_BUILD) all: objwarn +.endif .include <bsd.symver.mk> @@ -219,11 +221,15 @@ ${LINTLIB}: ${LINTOBJS} .endif # !defined(INTERNALLIB) +.if defined(_SKIP_BUILD) +all: +.else all: ${_LIBS} .if ${MK_MAN} != "no" all: _manpages .endif +.endif _EXTRADEPEND: @TMP=_depend$$$$; \ @@ -397,3 +403,15 @@ clean: .include <bsd.obj.mk> .include <bsd.sys.mk> + +.if ${MK_STAGING} != "no" +.if defined(_SKIP_BUILD) +stage_libs stage_files stage_as: +.else +.if !empty(_LIBS) +stage_libs: ${_LIBS} +all: stage_libs +.endif +.include <meta.stage.mk> +.endif +.endif diff --git a/share/mk/bsd.obj.mk b/share/mk/bsd.obj.mk index bd8f2aa..38afcde 100644 --- a/share/mk/bsd.obj.mk +++ b/share/mk/bsd.obj.mk @@ -44,10 +44,21 @@ __<bsd.obj.mk>__: .if defined(MAKEOBJDIRPREFIX) CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR} +.elif defined(MAKEOBJDIR) && ${MAKEOBJDIR:M/*} != "" +CANONICALOBJDIR:=${MAKEOBJDIR} .else CANONICALOBJDIR:=/usr/obj${.CURDIR} .endif +.if defined(.PARSEDIR) && !defined(NO_OBJ) && !defined(NO_AUTO_OBJ) +.if ${MK_AUTO_OBJ} == "yes" +__objdir?= ${CANONICALOBJDIR} +# this is what auto.obj.mk wants to see +MKOBJDIRS=auto +.include "auto.obj.mk" +.endif +.endif + # # Warn of unorthodox object directory. # @@ -116,6 +127,11 @@ cleanobj: clean cleandepend .endif @if [ -L ${.CURDIR}/obj ]; then rm -f ${.CURDIR}/obj; fi +# Tell bmake not to look for generated files via .PATH +.if !empty(CLEANFILES) +.NOPATH: ${CLEANFILES} +.endif + .if !target(clean) clean: .if defined(CLEANFILES) && !empty(CLEANFILES) diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 924e9ce..e927cff 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -414,6 +414,7 @@ __DEFAULT_YES_OPTIONS = \ ZONEINFO __DEFAULT_NO_OPTIONS = \ + AUTO_OBJ \ BSD_GREP \ BSD_SORT \ BIND_IDN \ @@ -427,10 +428,14 @@ __DEFAULT_NO_OPTIONS = \ HESIOD \ ICONV \ IDEA \ + INSTALL_AS_USER \ LIBCPLUSPLUS \ + META_MODE \ NAND \ OFED \ - SHARED_TOOLCHAIN + SHARED_TOOLCHAIN \ + STAGING \ + STAGING_PROG # # Default behaviour of some options depends on the architecture. Unfortunately @@ -584,6 +589,16 @@ MK_GDB:= no MK_CLANG_IS_CC:= no .endif +.if !defined(.PARSEDIR) +MK_AUTO_OBJ:= no +MK_META_MODE:= no +.endif + +.if ${MK_META_MODE} == "no" +MK_STAGING:= no +MK_STAGING_PROG:= no +.endif + # # Set defaults for the MK_*_SUPPORT variables. # @@ -645,6 +660,17 @@ CTFCONVERT_CMD= CTFCONVERT_CMD= @: .endif +.if ${MK_INSTALL_AS_USER} != "no" +_uid!= id -un +.if ${_uid} != 0 +_gid!= id -gn +.for x in BIN CONF DOC INFO KMOD LIB MAN NLS SHARE +$xOWN= ${_uid} +$xGRP= ${_gid} +.endfor +.endif +.endif + .endif # !_WITHOUT_SRCCONF .endif # !target(__<bsd.own.mk>__) diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index fae8366..ce62619 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -102,10 +102,14 @@ MAN1= ${MAN} .endif .endif +.if defined(_SKIP_BUILD) +all: +.else all: objwarn ${PROG} ${SCRIPTS} .if ${MK_MAN} != "no" all: _manpages .endif +.endif .if defined(PROG) CLEANFILES+= ${PROG} @@ -226,3 +230,25 @@ ${OBJS}: ${SRCS:M*.h} .if defined(PORTNAME) .include <bsd.pkg.mk> .endif + +.if ${MK_STAGING} != "no" +.if defined(_SKIP_BUILD) +stage_files stage_as: +.else +# normally only libs and includes are staged +.if ${MK_STAGING_PROG:Uno} != "no" +STAGE_SETS+= prog +STAGE_DIR.prog= ${STAGE_OBJTOP}${BINDIR} +.if !empty(PROG) +all: stage_files +stage_files.prog: ${PROG} +.endif +.if !empty(SYMLINKS) +all: stage_symlinks +stage_symlinks.prog: ${SYMLINKS} +.endif + +.endif +.include <meta.stage.mk> +.endif +.endif diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk index dc5af72..f9962df 100644 --- a/share/mk/bsd.subdir.mk +++ b/share/mk/bsd.subdir.mk @@ -31,6 +31,15 @@ .include <bsd.init.mk> +.if defined(.PARSEDIR) && !defined(NEED_SUBDIR) +.if ${.MAKE.LEVEL} == 0 && ${.MAKE.MODE:Mmeta*} != "" && !empty(SUBDIR) && !(make(clean*) || make(destroy*)) +.include <meta.subdir.mk> +# ignore this +_SUBDIR: +.endif +.endif +.if !target(_SUBDIR) + DISTRIBUTION?= base .if !target(distribute) distribute: @@ -42,7 +51,7 @@ distribute: _SUBDIR: .USE .if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR) - @${_+_}for entry in ${SUBDIR}; do \ + @${_+_}set -e; for entry in ${SUBDIR}; do \ if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \ ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:realinstall=install})"; \ edir=$${entry}.${MACHINE_ARCH}; \ @@ -79,9 +88,11 @@ ${__stage}${__target}: _SUBDIR .endif .endfor ${__target}: - ${_+_}cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} install${__target} + ${_+_}set -e; cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} install${__target} .endfor +.endif + .if !target(install) .if !target(beforeinstall) beforeinstall: diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index f023750..5095973 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -125,3 +125,18 @@ CFLAGS+= ${SSP_CFLAGS} # Allow user-specified additional warning flags CFLAGS+= ${CWARNFLAGS} + + +# Tell bmake not to misstake standard targets for things to be searched for +# or expect to ever be up-to-date. +PHONY_NOTMAIN = afterdepend afterinstall all beforedepend beforeinstall \ + beforelinking build build-tools buildfiles buildincludes \ + checkdpadd clean cleandepend cleandir cleanobj configure \ + depend dependall distclean distribute exe extract fetch \ + html includes install installfiles installincludes lint \ + obj objlink objs objwarn patch realall realdepend \ + realinstall regress subdir-all subdir-depend subdir-install \ + tags whereobj + +.PHONY: ${PHONY_NOTMAIN} +.NOTMAIN: ${PHONY_NOTMAIN} diff --git a/share/mk/dirdeps.mk b/share/mk/dirdeps.mk new file mode 100644 index 0000000..e8c02b7 --- /dev/null +++ b/share/mk/dirdeps.mk @@ -0,0 +1,368 @@ +# $Id: dirdeps.mk,v 1.22 2012/04/25 15:12:29 sjg Exp $ + +# Copyright (c) 2010-2012, Juniper Networks, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Much of the complexity here is for supporting cross-building. +# If a tree does not support that, simply using plain Makefile.depend +# should provide sufficient clue. +# Otherwise the recommendation is to use Makefile.depend.${MACHINE} +# as expected below. + +# Note: this file gets multiply included. +# This is what we do with DIRDEPS + +# DIRDEPS: +# This is a list of directories - relative to SRCTOP, it is only +# of interest to .MAKE.LEVEL 0. +# In some cases the entry may be qualified with a .<machine> +# suffix, for example to force building something for the pseudo +# machines "host" or "common" regardless of current ${MACHINE}. +# All unqualified entries end up being qualified with .${MACHINE} +# and _DIRDEPS_USE below, uses the suffix to set MACHINE +# correctly when visiting each entry. +# +# Each entry is also converted into a set of paths to look for +# Makefile.depend.<machine> to learn the dependencies of each. +# Each Makefile.depend.<machine> sets DEP_RELDIR to be the +# the RELDIR (path relative to SRCTOP) for its directory, and +# DEP_MACHINE to its suffix (<machine>), further since +# each Makefile.depend.<machine> includes dirdeps.mk, this +# processing is recursive and results in .MAKE.LEVEL 0 learning the +# dependencies of the tree wrt the initial directory (_DEP_RELDIR). +# +# BUILD_AT_LEVEL0 +# Indicates whether .MAKE.LEVEL 0 builds anything: +# if "no" sub-makes are used to build everything, +# if "yes" sub-makes are only used to build for other machines. + +.if ${.MAKE.LEVEL} == 0 +# only the first instance is interested in all this + +# First off, we want to know what ${MACHINE} to build for. +# This can be complicated if we are using a mixture of ${MACHINE} specific +# and non-specific Makefile.depend* + +.if !target(_DIRDEP_USE) +# do some setup we only need once +_CURDIR ?= ${.CURDIR} + +.if !defined(.MAKE.DEPENDFILE_PREFERENCE) +# this makes the logic below neater? +.MAKE.DEPENDFILE_PREFERENCE = ${_CURDIR}/${.MAKE.DEPENDFILE:T} +.if ${.MAKE.DEPENDFILE:E} == "${MACHINE}" +.MAKE.DEPENDFILE_PREFERENCE += ${_CURDIR}/${.MAKE.DEPENDFILE:T:R} +.endif +.endif + +_default_dependfile := ${.MAKE.DEPENDFILE_PREFERENCE:[1]:T} +_machine_dependfiles := ${.MAKE.DEPENDFILE_PREFERENCE:M*.${MACHINE}} + +# for machine specific dependfiles we require ${MACHINE} to be at the end +# also for the sake of sanity we require a common prefix +.if !defined(.MAKE.DEPENDFILE_PREFIX) +.if !empty(_machine_dependfiles) +.MAKE.DEPENDFILE_PREFIX := ${_machine_dependfiles:[1]:T:R} +.else +.MAKE.DEPENDFILE_PREFIX := ${_default_dependfile:T} +.endif +.endif + + +# this is how we identify non-machine specific dependfiles +N_notmachine := ${.MAKE.DEPENDFILE_PREFERENCE:E:N${MACHINE}:${M_ListToSkip}} + +.endif # !target(_DIRDEP_USE) + +_last_dependfile := ${.MAKE.MAKEFILES:M*/${.MAKE.DEPENDFILE_PREFIX}*:[-1]} + +# Note: if a makefile is read many times, the above +# will not work, so we also test for DEP_MACHINE==depend below. +.if empty(_last_dependfile) +# we haven't included one yet +DEP_MACHINE ?= ${TARGET_MACHINE:U${MACHINE}} +# else it should be correctly set by ${.MAKE.DEPENDFILE} +.elif ${_last_dependfile:E:${N_notmachine}} == "" || ${DEP_MACHINE:Uno:${N_notmachine}} == "" +# don't rely on manually maintained files to be correct +DEP_MACHINE := ${_DEP_MACHINE:U${MACHINE}} +.else +# just in case +DEP_MACHINE ?= ${_last_dependfile:E} +.endif + +# pickup customizations +# as below you can use !target(_DIRDEP_USE) to protect things +# which should only be done once. +.-include "local.dirdeps.mk" + +# the first time we are included the _DIRDEP_USE target will not be defined +# we can use this as a clue to do initialization and other one time things. +.if !target(_DIRDEP_USE) +# make sure this target exists +dirdeps: + +# We normally expect to be included by Makefile.depend.* +# which sets the DEP_* macros below. +DEP_RELDIR ?= ${RELDIR} + +# this can cause lots of output! +# set to a set of glob expressions that might match RELDIR +DEBUG_DIRDEPS ?= no + +# remember the initial value of DEP_RELDIR - we test for it below. +_DEP_RELDIR := ${DEP_RELDIR} + +# things we skip for host tools +SKIP_HOSTDIR ?= + +NSkipHostDir = ${SKIP_HOSTDIR:N*.host:S,$,.host,:N.host:${M_ListToSkip}} +NSkipHostDep = ${SKIP_HOSTDIR:R:@d@*/$d*.host@:${M_ListToSkip}} + +# things we always skip +# SKIP_DIRDEPS allows for adding entries on command line. +SKIP_DIR += .host *.WAIT ${SKIP_DIRDEPS} + +.ifdef HOSTPROG +SKIP_DIR += ${SKIP_HOSTDIR} +.endif + +NSkipDir = ${SKIP_DIR:${M_ListToSkip}} + +.if defined(NO_DIRDEPS) || defined(NODIRDEPS) +# confine ourselves to the original dir +DIRDEPS_FILTER += M${_DEP_RELDIR}* +.endif + +# we supress SUBDIR when visiting the leaves +# we assume sys.mk will set MACHINE_ARCH +_DIRDEP_USE: .USE .MAKE + @for m in ${.MAKE.MAKEFILE_PREFERENCE}; do \ + test -s ${.TARGET:R}/$$m || continue; \ + echo "${TRACER}Checking ${.TARGET:R} for ${.TARGET:E} ..."; \ + MACHINE=${.TARGET:E} MACHINE_ARCH= NO_SUBDIR=1 \ + ${.MAKE} -C ${.TARGET:R} || exit 1; \ + break; \ + done + +.ifdef ALL_MACHINES +# this is how you limit it to only the machines we have been built for +# previously. +.if empty(ONLY_MACHINE_LIST) +.if !empty(ALL_MACHINE_LIST) +# ALL_MACHINE_LIST is the list of all legal machines - ignore anything else +_machine_list != cd ${_CURDIR} && 'ls' -1 ${ALL_MACHINE_LIST:O:u:@m@${.MAKE.DEPENDFILE:T:R}.$m@} 2> /dev/null; echo +.else +_machine_list != 'ls' -1 ${_CURDIR}/${.MAKE.DEPENDFILE_PREFIX}.* 2> /dev/null; echo +.endif +_only_machines := ${_machine_list:${NIgnoreFiles:UN*.bak}:E:O:u} +.else +_only_machines := ${ONLY_MACHINE_LIST} +.endif + +.if empty(_only_machines) +# we must be boot-strapping +_only_machines := ${TARGET_MACHINE:U${ALL_MACHINE_LIST:U${DEP_MACHINE}}} +.endif + +.else # ! ALL_MACHINES +# if ONLY_MACHINE_LIST is set, we are limited to that +# if TARGET_MACHINE is set - it is really the same as ONLY_MACHINE_LIST +# otherwise DEP_MACHINE is it - so DEP_MACHINE will match. +_only_machines := ${ONLY_MACHINE_LIST:U${TARGET_MACHINE:U${DEP_MACHINE}}:M${DEP_MACHINE}} +.endif + +.if !empty(NOT_MACHINE_LIST) +_only_machines := ${_only_machines:${NOT_MACHINE_LIST:${M_ListToSkip}}} +.endif + +# make sure we have a starting place? +DIRDEPS ?= ${RELDIR} +.endif # target + +_debug_reldir := ${DEBUG_DIRDEPS:@x@${DEP_RELDIR:M$x}${${DEP_RELDIR}.${DEP_MACHINE}:L:M$x}@} +_debug_search := ${DEBUG_DIRDEPS:@x@${DEP_RELDIR:M$x}${${DEP_RELDIR}.depend:L:M$x}@} + +# the rest is done repeatedly for every Makefile.depend we read. +# if we are anything but the original dir we care only about the +# machine type we were included for.. + +.if ${DEP_RELDIR} == "." +_this_dir := ${SRCTOP} +.else +_this_dir := ${SRCTOP}/${DEP_RELDIR} +.endif + +# on rare occasions, there can be a need for extra help +_dep_hack := ${_this_dir}/${.MAKE.DEPENDFILE_PREFIX}.inc +.-include "${_dep_hack}" + +.if ${DEP_RELDIR} != ${_DEP_RELDIR} || ${DEP_MACHINE} != ${MACHINE} +# this should be all +_machines := ${DEP_MACHINE} +.else +# this is the machine list we actually use below +_machines := ${_only_machines} + +.if defined(HOSTPROG) || ${DEP_MACHINE} == "host" +# we need to build this guy's dependencies for host as well. +_machines += host +.endif + +_machines := ${_machines:O:u} +.endif + +_build_dirs = + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# pickup other machines for this dir if necessary +.if ${BUILD_AT_LEVEL0:Uyes} == "no" +_build_dirs += ${_machines:@m@${_CURDIR}.$m@} +.else +_build_dirs += ${_machines:N${DEP_MACHINE}:@m@${_CURDIR}.$m@} +.if ${DEP_MACHINE} == ${MACHINE} +# pickup local dependencies now +.-include <.depend> +.endif +.endif +.endif + +.if !empty(_debug_reldir) +.info ${DEP_RELDIR}.${DEP_MACHINE}: _last_dependfile='${_last_dependfile}' +.info ${DEP_RELDIR}.${DEP_MACHINE}: DIRDEPS='${DIRDEPS}' +.info ${DEP_RELDIR}.${DEP_MACHINE}: _machines='${_machines}' +.endif + +.if !empty(DIRDEPS) + +# this is what we start with +__depdirs := ${DIRDEPS:${NSkipDir}:${DIRDEPS_FILTER:ts:}:O:u:@d@${SRCTOP}/$d@} + +# some entries may be qualified with .<machine> +# the :M*/*/*.* just tries to limit the dirs we check to likely ones. +# the ${d:E:M*/*} ensures we don't consider junos/usr.sbin/mgd +__qual_depdirs := ${__depdirs:M*/*/*.*:@d@${exists($d):?:${"${d:E:M*/*}":?:${exists(${d:R}):?$d:}}}@} +__unqual_depdirs := ${__depdirs:${__qual_depdirs:Uno:${M_ListToSkip}}} + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# if it was called out - we likely need it. +__hostdpadd := ${DPADD:U.:M${HOST_OBJTOP}/*:S,${HOST_OBJTOP}/,,:H:${NSkipDir}:${DIRDEPS_FILTER:ts:}:S,$,.host,:N.*:@d@${SRCTOP}/$d@} +__qual_depdirs += ${__hostdpadd} +.endif + +.if !empty(_debug_reldir) +.info depdirs=${__depdirs} +.info qualified=${__qual_depdirs} +.info unqualified=${__unqual_depdirs} +.endif + +# _build_dirs is what we will feed to _DIRDEP_USE +_build_dirs += \ + ${__qual_depdirs:M*.host:${NSkipHostDir}:N.host} \ + ${__qual_depdirs:N*.host} \ + ${_machines:@m@${__unqual_depdirs:@d@$d.$m@}@} + +_build_dirs := ${_build_dirs:O:u} + +# this is where we will pick up more dependencies from +# the inner inline loops look complex, but save a significant +# amount of memory compared to a .for loop. +_depdir_files = +.for d in ${_build_dirs} +.if exists($d) +# easy, we're building for ${MACHINE} +_depdir_files += ${.MAKE.DEPENDFILE_PREFERENCE:T:@m@${exists($d/$m):?$d/$m:}@:[1]} +.elif exists(${d:R}) && ${d:R:T} == ${d:T:R} +# a little more complex - building for another machine +# we will ensure the file is qualified with a machine +# so that if necessary _DEP_MACHINE can be set below +_depdir_files += ${.MAKE.DEPENDFILE_PREFERENCE:T:S,.${MACHINE}$,.${d:E},:@m@${exists(${d:R}/$m):?${d:R}/$m:}@:[1]:@m@${"${m:M*.${d:E}}":?$m:$m.${d:E}}@} +.endif +.endfor + +# clean up +_depdir_files := ${_depdir_files:O:u} + +.endif # empty DIRDEPS + +# Normally if doing make -V something, +# we do not want to waste time chasing DIRDEPS +# but if we want to count the number of Makefile.depend* read, we do. +.if ${.MAKEFLAGS:M-V${_V_READ_DIRDEPS}} == "" +.if !empty(_build_dirs) +# this makes it all happen +dirdeps: ${_build_dirs} +${_build_dirs}: _DIRDEP_USE + +.if !empty(_debug_reldir) +.info ${DEP_RELDIR}.${DEP_MACHINE}: ${_build_dirs} +.endif + +.for m in ${_machines} +# it would be nice to do :N${.TARGET} +.if !empty(__qual_depdirs) +.for q in ${__qual_depdirs:E:O:u:N$m} +.if !empty(_debug_reldir) || ${DEBUG_DIRDEPS:@x@${${DEP_RELDIR}.$m:L:M$x}${${DEP_RELDIR}.$q:L:M$x}@} != "" +.info ${DEP_RELDIR}.$m: ${_build_dirs:M*.$q} +.endif +${_this_dir}.$m: ${_build_dirs:M*.$q} +.endfor +.endif +.if !empty(_debug_reldir) +.info ${DEP_RELDIR}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m} +.endif +${_this_dir}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m} +.endfor + +.endif + +.for d in ${_depdir_files} +.if ${.MAKE.MAKEFILES:M${d}} == "" +.if !empty(_debug_search) +.info Looking for $d +.endif +.if exists($d) +.include <$d> +.elif exists(${d:R}) +# an unqualified file exists, we qualified it above so we can set _DEP_MACHINE +# it might be manually maintained and shared by all machine types +# tell it the machine we are interested in. +_DEP_MACHINE := ${d:E} +.if !empty(_debug_reldir) +.info loading ${d:R} for ${_DEP_MACHINE} +.endif +# pretend we read $d, so we don't come by here again. +.MAKE.MAKEFILES += $d +.include <${d:R}> +.endif +.endif +.endfor +.endif # -V + +.elif ${.MAKE.LEVEL} > 42 +.error You should have stopped recursing by now. +.else +_DEP_RELDIR := ${DEP_RELDIR} +# pickup local dependencies +.-include <.depend> +.endif + diff --git a/share/mk/gendirdeps.mk b/share/mk/gendirdeps.mk new file mode 100644 index 0000000..890f495 --- /dev/null +++ b/share/mk/gendirdeps.mk @@ -0,0 +1,301 @@ +# $Id: gendirdeps.mk,v 1.10 2012/06/30 00:37:50 sjg Exp $ + +# Copyright (c) 2010, Juniper Networks, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# +# This makefile [re]generates ${.MAKE.DEPENDFILE} +# + +.include <install-new.mk> + +# Assumptions: +# RELDIR is the relative path from ${SRCTOP} to ${_CURDIR} +# (SRCTOP is ${SB}/src) +# _CURDIR is the absolute version of ${.CURDIR} +# _OBJDIR is the absolute version of ${.OBJDIR} +# _objroot is realpath of ${_OBJTOP} without ${MACHINE} +# this may be different from _OBJROOT if $SB/obj is a +# symlink to another filesystem. +# _objroot must be a prefix match for _objtop + +.MAIN: all + +# keep this simple +.MAKE.MODE = compat + +all: + +_CURDIR ?= ${.CURDIR} +_OBJDIR ?= ${.OBJDIR} +_OBJTOP ?= ${OBJTOP} +_OBJROOT ?= ${OBJROOT:U${_OBJTOP}} +_objroot ?= ${_OBJROOT:tA} + +_this = ${.PARSEDIR}/${.PARSEFILE} + +# remember what to make +_DEPENDFILE := ${_CURDIR}/${.MAKE.DEPENDFILE:T} + +# We do _not_ want to read our own output! +.MAKE.DEPENDFILE = /dev/null + +# caller should have set this +META_FILES ?= ${.MAKE.META.FILES} + +.if !empty(META_FILES) + +.if ${.MAKE.LEVEL} > 0 && !empty(GENDIRDEPS_FILTER) +# so we can compare below +.-include <${_DEPENDFILE}> +# yes, I mean :U with no value +_DIRDEPS := ${DIRDEPS:U:O:u} +.endif + +META_FILES := ${META_FILES:T:O:u} +.export META_FILES + +# pickup customizations +.-include "local.gendirdeps.mk" + +# these are actually prefixes that we'll skip +# they should all be absolute paths +SKIP_GENDIRDEPS ?= +.if !empty(SKIP_GENDIRDEPS) +_skip_gendirdeps = egrep -v '^(${SKIP_GENDIRDEPS:O:u:ts|})' | +.else +_skip_gendirdeps = +.endif + +# this (*should* be set in meta.sys.mk) +# is the script that extracts what we want. +META2DEPS ?= ${.PARSEDIR}/meta2deps.sh +META2DEPS := ${META2DEPS} + +.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != "" && ${DEBUG_GENDIRDEPS:Uno:Mmeta2d*} != "" +_time = time +_sh_x = sh -x +_py_d = -ddd +.else +_time = +_sh_x = +_py_d = +.endif + +.if ${META2DEPS:E} == "py" +# we can afford to do this all the time. +DPDEPS ?= no +META2DEPS_CMD = ${_time} ${PYTHON} ${META2DEPS} ${_py_d} \ + -R ${RELDIR} -H ${HOST_TARGET} -O ${M2D_OBJROOT} +.if ${DPDEPS:tl} != "no" +META2DEPS_CMD += -D ${DPDEPS} +.endif +.if ${.MAKE.DEPENDFILE_PREFERENCE:U${.MAKE.DEPENDFILE}:M*.${MACHINE}} == "" +# meta2deps.py only groks objroot +# so we need to give it what it expects +M2D_OBJROOT = ${OBJTOP}/ +# and tell it not to add machine qualifiers +META2DEPS_ARGS += MACHINE=none +.else +.if defined(SB_OBJROOT) +M2D_OBJROOT ?= ${SB_OBJROOT} +.else +M2D_OBJROOT = ${OBJTOP}/ +.endif +.endif +.if defined(SB_BACKING_SB) +META2DEPS_CMD += -S ${SB_BACKING_SB}/src -O ${SB_BACKING_SB}/${SB_OBJPREFIX} +.endif +META2DEPS_FILTER = sed 's,^src:,${SRCTOP}/,;s,^\([^/]\),${OBJTOP}/\1,' | +.elif ${META2DEPS:E} == "sh" +META2DEPS_CMD = ${_time} ${_sh_x} ${META2DEPS} \ + OBJTOP=${_objtop} SB_OBJROOT=${_objroot} +.else +META2DEPS_CMD ?= ${META2DEPS} +.endif + +# we are only interested in the dirs +# sepecifically those we read something from. +# we canonicalize them to keep things simple +# if we are using a split-fs sandbox, it gets a little messier. +_objtop := ${_OBJTOP:tA} +dir_list != cd ${_OBJDIR} && \ + ${META2DEPS_CMD} MACHINE=${MACHINE} \ + SRCTOP=${SRCTOP} RELDIR=${RELDIR} CURDIR=${_CURDIR} \ + ${META2DEPS_ARGS} \ + ${META_FILES:O:u} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \ + sed 's,//*$$,,;s,\.${HOST_TARGET}$$,.host,' + +.if ${dir_list:M*ERROR\:*} != "" +.warning ${dir_list:tW:C,.*(ERROR),\1,} +.warning Skipping ${_DEPENDFILE:S,${SRCTOP}/,,} +# we are not going to update anything +.else + +.if !empty(DPADD) +_nonlibs := ${DPADD:T:Nlib*:N*include} +.if !empty(_nonlibs) +dir_list += ${_nonlibs:@x@${DPADD:M*/$x}@:H:tA} +.endif +.endif + +# DIRDEPS represent things that had to have been built first +# so they should all be undir OBJTOP. +# Note that ${_OBJTOP}/bsd/include/machine will get reported +# to us as $SRCTOP/bsd/sys/$MACHINE_ARCH/include meaning we +# will want to visit bsd/include +# so we add +# ${"${dir_list:M*bsd/sys/${MACHINE_ARCH}/include}":?bsd/include:} +# to GENDIRDEPS_DIR_LIST_XTRAS +dirdep_list = \ + ${dir_list:M${_objtop}*/*:C,${_objtop}[^/]*/,,} \ + ${GENDIRDEPS_DIR_LIST_XTRAS} + +# anything we use from an object dir other than ours +# needs to be qualified with its .<machine> suffix +# (we used the pseudo machine "host" for the HOST_TARGET). +qualdir_list = \ + ${dir_list:M${_objroot}*/*/*:N${SRCTOP}*:N${_objtop}*:C,${_objroot}([^/]+)/(.*),\2.\1,:S,.${HOST_TARGET},.host,} + +.if ${_OBJROOT} != ${_objroot} +dirdep_list += \ + ${dir_list:M${_OBJTOP}*/*:C,${_OBJTOP}[^/]*/,,} + +qualdir_list += \ + ${dir_list:M${_OBJROOT}*/*/*:N${SRCTOP}*:N${_OBJTOP}*:C,${_OBJROOT}([^/]+)/(.*),\2.\1,:S,.${HOST_TARGET},.host,} +.endif + +dirdep_list := ${dirdep_list:O:u} +qualdir_list := ${qualdir_list:O:u} + +DIRDEPS = \ + ${dirdep_list:N${RELDIR}:N${RELDIR}/*} \ + ${qualdir_list:N${RELDIR}.*:N${RELDIR}/*} + +# We only consider things below $RELDIR/ if they have a makefile. +# This is the same test that _DIRDEPS_USE applies. +# We have do a double test with dirdep_list as it _may_ contain +# qualified dirs - if we got anything from a stage dir. +# qualdir_list we know are all qualified. +# It would be nice do peform this check for all of DIRDEPS, +# but we cannot assume that all of the tree is present, +# in fact we can only assume that RELDIR is. +DIRDEPS += \ + ${dirdep_list:M${RELDIR}/*:@d@${.MAKE.MAKEFILE_PREFERENCE:@m@${exists(${SRCTOP}/$d/$m):?$d:${exists(${SRCTOP}/${d:R}/$m):?$d:}}@}@} \ + ${qualdir_list:M${RELDIR}/*:@d@${.MAKE.MAKEFILE_PREFERENCE:@m@${exists(${SRCTOP}/${d:R}/$m):?$d:}@}@} + +DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:ts:}:O:u} + +.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != "" +.info ${RELDIR}: dir_list='${dir_list}' +.info ${RELDIR}: dirdep_list='${dirdep_list}' +.info ${RELDIR}: qualdir_list='${qualdir_list}' +.info ${RELDIR}: SKIP_GENDIRDEPS='${SKIP_GENDIRDEPS}' +.info ${RELDIR}: GENDIRDEPS_FILTER='${GENDIRDEPS_FILTER}' +.info ${RELDIR}: FORCE_DPADD='${DPADD}' +.info ${RELDIR}: DIRDEPS='${DIRDEPS}' +.endif + +# SRC_DIRDEPS is for checkout logic +src_dirdep_list = \ + ${dir_list:M${SRCTOP}/*:S,${SRCTOP}/,,} + +SRC_DIRDEPS = \ + ${src_dirdep_list:N${RELDIR}:N${RELDIR}/*:C,(/h)/.*,,} + +SRC_DIRDEPS := ${SRC_DIRDEPS:${GENDIRDEPS_SRC_FILTER:UN/*:ts:}:O:u} + +# if you want to capture SRC_DIRDEPS in .MAKE.DEPENDFILE put +# SRC_DIRDEPS_FILE = ${_DEPENDFILE} +# in local.gendirdeps.mk +.if ${SRC_DIRDEPS_FILE:Uno:tl} != "no" +ECHO_SRC_DIRDEPS = echo 'SRC_DIRDEPS = \'; echo '${SRC_DIRDEPS:@d@ $d \\${.newline}@}'; echo; + +.if ${SRC_DIRDEPS_FILE:T} == ${_DEPENDFILE:T} +_include_src_dirdeps = ${ECHO_SRC_DIRDEPS} +.else +all: ${SRC_DIRDEPS_FILE} +.if !target(${SRC_DIRDEPS_FILE}) +${SRC_DIRDEPS_FILE}: ${META_FILES} ${_this} ${META2DEPS} + @(${ECHO_SRC_DIRDEPS}) > $@ +.endif +.endif +.endif +_include_src_dirdeps ?= + +all: ${_DEPENDFILE} + +# if this is going to exist it would be there by now +.if !exists(.depend) +CAT_DEPEND = /dev/null +.endif +CAT_DEPEND ?= .depend + +.if !empty(_DIRDEPS) && ${DIRDEPS} != ${_DIRDEPS} +# we may have changed a filter +.PHONY: ${_DEPENDFILE} +.endif + +# 'cat .depend' should suffice, but if we are mixing build modes +# .depend may contain things we don't want. +# The sed command at the end of the stream, allows for the filters +# to output _{VAR} tokens which we will turn into proper ${VAR} references. +${_DEPENDFILE}: ${CAT_DEPEND:M.depend} ${META_FILES:O:u:@m@${exists($m):?$m:}@} ${_this} ${META2DEPS} + @(echo '# Autogenerated - do NOT edit!'; echo; \ + echo 'DEP_RELDIR := $${_PARSEDIR:S,$${SRCTOP}/,,}'; echo; \ + echo 'DEP_MACHINE := $${.PARSEFILE:E}'; echo; \ + echo 'DIRDEPS = \'; \ + echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \ + ${_include_src_dirdeps} \ + echo '.include <dirdeps.mk>'; \ + echo; \ + echo '.if $${DEP_RELDIR} == $${_DEP_RELDIR}'; \ + echo '# local dependencies - needed for -jN in clean tree'; \ + [ -s ${CAT_DEPEND} ] && { grep : ${CAT_DEPEND} | grep -v '[/\\]'; }; \ + echo '.endif' ) | sed 's,_\([{(]\),$$\1,g' > $@.new${.MAKE.PID} + @${InstallNew}; InstallNew -s $@.new${.MAKE.PID} + +.endif # meta2deps failed +.elif !empty(SUBDIR) + +DIRDEPS := ${SUBDIR:S,^,${RELDIR}/,:O:u} + +all: ${_DEPENDFILE} + +${_DEPENDFILE}: ${MAKEFILE} ${_this} + @(echo '# Autogenerated - do NOT edit!'; echo; \ + echo 'DEP_RELDIR := $${_PARSEDIR:S,$${SRCTOP}/,,}'; echo; \ + echo 'DEP_MACHINE := $${.PARSEFILE:E}'; echo; \ + echo 'DIRDEPS = \'; \ + echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \ + echo '.include <dirdeps.mk>'; \ + echo ) | sed 's,_\([{(]\),$$\1,g' > $@.new + @${InstallNew}; InstallNew $@.new + +.else + +# nothing to do +all ${_DEPENDFILE}: + +.endif +${_DEPENDFILE}: .PRECIOUS diff --git a/share/mk/host-target.mk b/share/mk/host-target.mk new file mode 100644 index 0000000..c6d4562 --- /dev/null +++ b/share/mk/host-target.mk @@ -0,0 +1,31 @@ +# RCSid: +# $Id: host-target.mk,v 1.6 2011/03/02 05:05:21 sjg Exp $ + +# Host platform information; may be overridden +.if !defined(_HOST_OSNAME) +_HOST_OSNAME != uname -s +.export _HOST_OSNAME +.endif +.if !defined(_HOST_OSREL) +_HOST_OSREL != uname -r +.export _HOST_OSREL +.endif +.if !defined(_HOST_ARCH) +_HOST_ARCH != uname -p 2>/dev/null || uname -m +# uname -p may produce garbage on linux +.if ${_HOST_ARCH:[\#]} > 1 +_HOST_ARCH != uname -m +.endif +.export _HOST_ARCH +.endif + +HOST_OSMAJOR := ${_HOST_OSREL:C/[^0-9].*//} +HOST_OSTYPE := ${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//}-${_HOST_ARCH} +HOST_OS := ${_HOST_OSNAME} +host_os := ${_HOST_OSNAME:tl} +HOST_TARGET := ${host_os}${HOST_OSMAJOR}-${_HOST_ARCH} + +# tr is insanely non-portable, accommodate the lowest common denominator +TR ?= tr +toLower = ${TR} 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' +toUpper = ${TR} 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' diff --git a/share/mk/install-new.mk b/share/mk/install-new.mk new file mode 100644 index 0000000..ddfff20 --- /dev/null +++ b/share/mk/install-new.mk @@ -0,0 +1,53 @@ +# $Id: install-new.mk,v 1.3 2012/03/24 18:25:49 sjg Exp $ +# +# @(#) Copyright (c) 2009, Simon J. Gerraty +# +# This file is provided in the hope that it will +# be of use. There is absolutely NO WARRANTY. +# Permission to copy, redistribute or otherwise +# use this file is hereby granted provided that +# the above copyright notice and this notice are +# left intact. +# +# Please send copies of changes and bug-fixes to: +# sjg@crufty.net +# + +.if !defined(InstallNew) + +# copy if src and target are different making a backup if desired +CmpCp= CmpCp() { \ + src=$$1 target=$$2 _bak=$$3; \ + if ! test -s $$target || ! cmp -s $$target $$src; then \ + trap "" 1 2 3 15; \ + if test -s $$target; then \ + if test "x$$_bak" != x; then \ + rm -f $$target$$_bak; \ + mv $$target $$target$$_bak; \ + else \ + rm -f $$target; \ + fi; \ + fi; \ + cp $$src $$target; \ + fi; } + +# If the .new file is different, we want it. +# Note: this function will work as is for *.new$RANDOM" +InstallNew= ${CmpCp}; InstallNew() { \ + _t=-e; _bak=; \ + while :; do \ + case "$$1" in \ + -?) _t=$$1; shift;; \ + --bak) _bak=$$2; shift 2;; \ + *) break;; \ + esac; \ + done; \ + for new in "$$@"; do \ + if test $$_t $$new; then \ + target=`expr $$new : '\(.*\).new'`; \ + CmpCp $$new $$target $$_bak; \ + fi; \ + rm -f $$new; \ + done; :; } + +.endif diff --git a/share/mk/local.autodep.mk b/share/mk/local.autodep.mk new file mode 100644 index 0000000..8327540 --- /dev/null +++ b/share/mk/local.autodep.mk @@ -0,0 +1,21 @@ + +.if ${.MAKE.DEPENDFILE:M*.${MACHINE}} == "" +# by default only MACHINE0 does updates +UPDATE_DEPENDFILE_MACHINE?= ${MACHINE0} +.if ${MACHINE} != ${UPDATE_DEPENDFILE_MACHINE} +UPDATE_DEPENDFILE= no +.endif +.endif + +CFLAGS+= ${CFLAGS_LAST} +CLEANFILES+= .depend + +# handy for debugging +.SUFFIXES: .S .c .cc .cpp .cpp-out + + +.S.cpp-out .c.cpp-out: .NOMETA + @${CC} -E ${CFLAGS} ${.IMPSRC} | grep -v '^[[:space:]]*$$' + +.cc.cpp-out: .NOMETA + @${CXX} -E ${CXXFLAGS} ${.IMPSRC} | grep -v '^[[:space:]]*$$' diff --git a/share/mk/local.dirdeps.mk b/share/mk/local.dirdeps.mk new file mode 100644 index 0000000..dedf9e2 --- /dev/null +++ b/share/mk/local.dirdeps.mk @@ -0,0 +1,15 @@ +.if !target(_DIRDEP_USE) +# first time read +.if ${MACHINE} == "host" +DIRDEPS_FILTER+= \ + Ninclude* \ + Nlib/* \ + Ngnu/lib/* \ + +.endif +.endif + +# this is how we can handle optional dependencies +.if ${MK_SSP:Uno} != "no" && defined(PROG) +DIRDEPS += gnu/lib/libssp/libssp_nonshared +.endif diff --git a/share/mk/local.gendirdeps.mk b/share/mk/local.gendirdeps.mk new file mode 100644 index 0000000..88c11e9 --- /dev/null +++ b/share/mk/local.gendirdeps.mk @@ -0,0 +1,10 @@ +# supress optional dependecies +# local.dirdeps.mk will put them in if necessary +GENDIRDEPS_FILTER+= Ngnu/lib/libssp/libssp_nonshared + +# gendirdeps.mk will turn _{VAR} into ${VAR} which keeps this simple +GENDIRDEPS_FILTER+= ${CSU_DIR:L:@v@S,/${$v},/_{${v}},@} + +# this could easily get confused +GENDIRDEPS_FILTER+= ${MACHINE_CPUARCH MACHINE_CPU MACHINE_ARCH MACHINE:L:@v@S,/${$v}/,/_{${v}}/,@:NS,//,*:u} + diff --git a/share/mk/local.init.mk b/share/mk/local.init.mk new file mode 100644 index 0000000..eb15b1e --- /dev/null +++ b/share/mk/local.init.mk @@ -0,0 +1,18 @@ + +.if defined(.PARSEDIR) +.if ${.MAKE.MODE:Mmeta*} != "" +.if !empty(SUBDIR) && !defined(LIB) && !defined(PROG) && ${.MAKE.MAKEFILES:M*bsd.prog.mk} == "" +.if ${.MAKE.MODE:Mleaf*} != "" +# we only want leaf dirs to build in meta mode... and we are not one +.MAKE.MODE = normal +.endif +.endif +.endif +.endif + +.if ${MACHINE} == "host" +HOST_CC?= /usr/bin/cc +HOST_CFLAGS+= -DHOSTPROG +CC= ${HOST_CC} +CFLAGS+= ${HOST_CFLAGS} +.endif diff --git a/share/mk/local.sys.mk b/share/mk/local.sys.mk new file mode 100644 index 0000000..22ce501 --- /dev/null +++ b/share/mk/local.sys.mk @@ -0,0 +1,196 @@ +WITH_INSTALL_AS_USER= yes + +.if defined(.PARSEDIR) # bmake + +# some handy macros +_this = ${.PARSEDIR:tA}/${.PARSEFILE} +# some useful modifiers + +# A useful trick for testing multiple :M's against something +# :L says to use the variable's name as its value - ie. literal +# got = ${clean* destroy:${M_ListToMatch:S,V,.TARGETS,}} +M_ListToMatch = L:@m@$${V:M$$m}@ +# match against our initial targets (see above) +M_L_TARGETS = ${M_ListToMatch:S,V,_TARGETS,} + +# turn a list into a set of :N modifiers +# NskipFoo = ${Foo:${M_ListToSkip}} +M_ListToSkip= O:u:ts::S,:,:N,g:S,^,N, + +# type should be a builtin in any sh since about 1980, +# AUTOCONF := ${autoconf:L:${M_whence}} +M_type = @x@(type $$x 2> /dev/null); echo;@:sh:[0]:N* found*:[@]:C,[()],,g +M_whence = ${M_type}:M/* + +# convert a path to a valid shell variable +M_P2V = tu:C,[./-],_,g + +# convert path to absolute +.if ${MAKE_VERSION:U0} > 20100408 +M_tA = tA +.else +M_tA = C,.*,('cd' & \&\& 'pwd') 2> /dev/null || echo &,:sh +.endif + +# this is handy for forcing a space into something. +AnEmptyVar= + +# absoulte path to what we are reading. +_PARSEDIR = ${.PARSEDIR:${M_tA}} + +.if !empty(SB) +SB_SRC ?= ${SB}/src +SB_OBJROOT ?= ${SB}/obj +# this is what we use below +SRCTOP ?= ${SB_SRC} +OBJROOT ?= ${SB_OBJROOT} +.endif + +.if empty(SRCTOP) +SRCTOP := ${_PARSEDIR:H:H} +.export SRCTOP +OBJROOT ?= ${SRCTOP:H}/obj/ +.endif + +# we need HOST_TARGET etc below. +.include <host-target.mk> + +OBJTOP ?= ${OBJROOT}${MACHINE} + +.if !defined(_TARGETS) +# some things we do only once +_TARGETS := ${.TARGETS} +.-include <sys.env.mk> +.if !empty(OBJROOT) +.if ${OBJROOT:M*/} != "" +OBJROOT:= ${OBJROOT:tA}/ +.else +OBJROOT:= ${OBJROOT:H:tA}/${OBJROOT:T} +.endif +.export OBJROOT +.endif +.endif + +.if !empty(SRCTOP) +.if ${.CURDIR} == ${SRCTOP} +RELDIR = . +.elif ${.CURDIR:M${SRCTOP}/*} +RELDIR := ${.CURDIR:S,${SRCTOP}/,,} +.endif +.endif + +HOST_OBJTOP ?= ${OBJROOT}${HOST_TARGET} + +.if ${OBJTOP} == ${HOST_OBJTOP} || ${REQUESTED_MACHINE:U${MACHINE}} == "host" +MACHINE= host +.endif +.if ${MACHINE} == "host" +OBJTOP := ${HOST_OBJTOP} +.endif + +# if you want objdirs make them automatic +.if ${MKOBJDIRS:Uno} == "auto" +WITH_AUTO_OBJ= yes +.include <auto.obj.mk> +.endif + +.ifndef WITHOUT_META_MODE +WITH_META_MODE= yes + +.ifndef WITHOUT_STAGING +WITH_STAGING= yes +.endif + +PYTHON ?= /usr/local/bin/python + +.if ${.MAKE.LEVEL} == 0 +# this works best if share/mk is ready for it. +BUILD_AT_LEVEL0= no +# By default only MACHINE0 updates dependencies +# see local.autodep.mk +MACHINE0 := ${MACHINE} +.export MACHINE0 +.export PYTHON +.endif + +# we want to end up with a singe stage tree for all machines +.ifndef WITHOUT_STAGING +.if empty(STAGE_ROOT) +STAGE_ROOT?= ${OBJROOT}stage +.export STAGE_ROOT +.endif +.endif + +.if !empty(STAGE_ROOT) +.if ${MACHINE} == "host" +STAGE_MACHINE= ${HOST_TARGET} +.else +STAGE_MACHINE= ${MACHINE} +.endif +STAGE_OBJTOP= ${STAGE_ROOT}/${STAGE_MACHINE} +STAGE_COMMON_OBJTOP= ${STAGE_ROOT}/common +STAGE_HOST_OBJTOP= ${STAGE_ROOT}/${HOST_TARGET} + +STAGE_LIBDIR= ${STAGE_OBJTOP}${LIBDIR:U/lib} +# this is not the same as INCLUDEDIR +STAGE_INCSDIR= ${STAGE_OBJTOP}${INCSDIR:U/include} + +.ifndef WITH_SYSROOT +.if ${MACHINE} != "host" +CFLAGS_LAST+= -nostdinc +.endif +CFLAGS_LAST+= -isystem ${STAGE_OBJTOP}/usr/include -isystem ${STAGE_OBJTOP}/include +LDFLAGS+= -B${STAGE_LIBDIR} -L${STAGE_LIBDIR} +.else +# if ld suppored sysroot, this would suffice +CFLAGS_LAST+= --sysroot=${STAGE_OBJTOP} -isystem ${STAGE_OBJTOP}/include +.endif +.endif + +.include "meta.sys.mk" + +# most dirs can be satisfied with one Makefile.depend ? +.undef .MAKE.DEPENDFILE +.MAKE.DEPENDFILE_PREFERENCE = \ + ${.MAKE.DEPENDFILE_PREFIX} \ + ${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} + +.include "sys.dependfile.mk" + +.if ${MACHINE} == "host" +# need a machine specific file +.MAKE.DEPENDFILE= ${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} +.endif + +.MAKE.META.BAILIWICK = ${SB} ${OBJROOT} ${STAGE_ROOT} + +.endif # meta mode + +# ensure we have a value +.MAKE.MODE ?= normal + +# don't rely on MACHINE_ARCH being set or valid + +MACHINE_ARCH.host = ${_HOST_ARCH} +MACHINE_ARCH.${MACHINE} ?= ${MACHINE} +MACHINE_ARCH := ${MACHINE_ARCH.${MACHINE}} + +CSU_DIR.i386 = csu/i386-elf +CSU_DIR.${MACHINE_ARCH} ?= csu/${MACHINE_ARCH} +CSU_DIR := ${CSU_DIR.${MACHINE_ARCH}} + +MAKE_PRINT_VAR_ON_ERROR+= \ + .CURDIR \ + .MAKE \ + .OBJDIR \ + .TARGETS \ + DESTDIR \ + LD_LIBRARY_PATH \ + MACHINE \ + MACHINE_ARCH \ + MAKEOBJDIRPREFIX \ + MAKE_VERSION\ + OBJTOP \ + ${MAKE_PRINT_VAR_ON_ERROR_XTRAS} + +.endif # bmake diff --git a/share/mk/meta.autodep.mk b/share/mk/meta.autodep.mk new file mode 100644 index 0000000..92e43d7 --- /dev/null +++ b/share/mk/meta.autodep.mk @@ -0,0 +1,259 @@ +# $Id: meta.autodep.mk,v 1.28 2012/07/13 15:38:16 sjg Exp $ + +# +# @(#) Copyright (c) 2010, Simon J. Gerraty +# +# This file is provided in the hope that it will +# be of use. There is absolutely NO WARRANTY. +# Permission to copy, redistribute or otherwise +# use this file is hereby granted provided that +# the above copyright notice and this notice are +# left intact. +# +# Please send copies of changes and bug-fixes to: +# sjg@crufty.net +# + +_this ?= ${.PARSEFILE} +.if !target(__${_this}__) +__${_this}__: .NOTMAIN + +.-include "local.autodep.mk" + +.if defined(SRCS) +# it would be nice to be able to query .SUFFIXES +OBJ_EXTENSIONS+= .o .po .lo .So + +# explicit dependencies help short-circuit .SUFFIX searches +SRCS_DEP_FILTER+= N*.[hly] +.for s in ${SRCS:${SRCS_DEP_FILTER:O:u:ts:}} +.for e in ${OBJ_EXTENSIONS:O:u} +.if !target(${s:T:R}$e) +${s:T:R}$e: $s +.endif +.endfor +.endfor +.endif + +.if make(gendirdeps) +# you are supposed to know what you are doing! +UPDATE_DEPENDFILE = yes +.elif !empty(.TARGETS) && !make(all) +# do not update the *depend* files +# unless we are building the entire directory or the default target. +# NO means don't update .depend - or Makefile.depend* +# no means update .depend but not Makefile.depend* +UPDATE_DEPENDFILE = NO +.elif ${.MAKEFLAGS:M-k} != "" +# it is a bad idea to update anything +UPDATE_DEPENDFILE = NO +.endif + +_CURDIR ?= ${.CURDIR} +_DEPENDFILE := ${_CURDIR}/${.MAKE.DEPENDFILE:T} + +.if ${.MAKE.LEVEL} == 0 +.if ${BUILD_AT_LEVEL0:Uyes:tl} == "no" +UPDATE_DEPENDFILE = NO +.endif +.endif +.if !exists(${_DEPENDFILE}) +_bootstrap_dirdeps = yes +.endif +_bootstrap_dirdeps ?= no +UPDATE_DEPENDFILE ?= yes + +.if ${DEBUG_AUTODEP:Uno:@m@${RELDIR:M$m}@} != "" +.info ${_DEPENDFILE:S,${SRCTOP}/,,} update=${UPDATE_DEPENDFILE} +.endif + +.if !empty(XMAKE_META_FILE) +.if exists(${.OBJDIR}/${XMAKE_META_FILE}) +# we cannot get accurate dependencies from an update build +UPDATE_DEPENDFILE = NO +.else +META_XTRAS += ${XMAKE_META_FILE} +.endif +.endif + +.if ${_bootstrap_dirdeps} == "yes" || exists(${_DEPENDFILE}) +# if it isn't supposed to be touched by us the Makefile should have +# UPDATE_DEPENDFILE = no +WANT_UPDATE_DEPENDFILE ?= yes +.endif + +.if ${WANT_UPDATE_DEPENDFILE:Uno:tl} != "no" +.if ${.MAKE.MODE:Mmeta*} == "" || ${.MAKE.MODE:M*read*} != "" +UPDATE_DEPENDFILE = no +.endif + +.if ${DEBUG_AUTODEP:Uno:@m@${RELDIR:M$m}@} != "" +.info ${_DEPENDFILE:S,${SRCTOP}/,,} update=${UPDATE_DEPENDFILE} +.endif + +.if ${UPDATE_DEPENDFILE:tl} == "yes" +# sometimes we want .meta files generated to aid debugging/error detection +# but do not want to consider them for dependencies +# for example the result of running configure +# just make sure this is not empty +META_FILE_FILTER ?= N.meta + +.if !empty(DPADD) +# if we have any non-libs in DPADD, +# they probably need to be paid attention to +.if !empty(DPLIBS) +FORCE_DPADD = ${DPADD:${DPLIBS:${M_ListToSkip}}:${DPADD_LAST:${M_ListToSkip}}} +.else +_nonlibs := ${DPADD:T:Nlib*:N*include} +.if !empty(_nonlibs) +FORCE_DPADD += ${_nonlibs:@x@${DPADD:M*/$x}@} +.endif +.endif +.endif + +.if !make(gendirdeps) +.END: gendirdeps +.endif + +# if we don't have OBJS, then .depend isn't useful +.if !target(.depend) && (!empty(OBJS) || ${.ALLTARGETS:M*.o} != "") +# some makefiles and/or targets contain +# circular dependencies if you dig too deep +# (as meta mode is apt to do) +# so we provide a means of supressing them. +# the input to the loop below is target: dependency +# with just one dependency per line. +# Also some targets are not really local, or use random names. +# Use local.autodep.mk to provide local additions! +SUPPRESS_DEPEND += \ + ${SB:S,/,_,g}* \ + *:y.tab.c \ + *.c:*.c \ + *.h:*.h + +.NOPATH: .depend +# we use ${.MAKE.META.CREATED} to trigger an update but +# we process using ${.MAKE.META.FILES} +# the double $$ defers initial evaluation +# if necessary, we fake .po dependencies, just so the result +# in Makefile.depend* is stable +# The current objdir may be refered to in various ways +OBJDIR_REFS += ${.OBJDIR} ${.OBJDIR:tA} ${_OBJDIR} ${RELOBJTOP}/${RELDIR} +_depend = .depend +# it would be nice to be able to get .SUFFIXES as ${.SUFFIXES} +# we actually only care about the .SUFFIXES of files that might be +# generated by tools like yacc. +DEPEND_SUFFIXES += .c .h .cpp .hpp .cxx .hxx .cc .hh +.depend: .NOMETA $${.MAKE.META.CREATED} ${_this} + @echo "Updating $@: ${.OODATE:T:[1..8]}" + @egrep -i '^R .*\.(${DEPEND_SUFFIXES:tl:O:u:S,^.,,:ts|})$$' /dev/null ${.MAKE.META.FILES:T:O:u:${META_FILE_FILTER:ts:}:M*o.meta} | \ + sed -e 's, \./, ,${OBJDIR_REFS:O:u:@d@;s, $d/, ,@};/\//d' \ + -e 's,^\([^/][^/]*\).meta...[0-9]* ,\1: ,' | \ + sort -u | \ + while read t d; do \ + case "$$d:" in $$t) continue;; esac; \ + case "$$t$$d" in ${SUPPRESS_DEPEND:U.:O:u:ts|}) continue;; esac; \ + echo $$t $$d; \ + done > $@.${.MAKE.PID} + @case "${.MAKE.META.FILES:T:M*.po.*}" in \ + *.po.*) mv $@.${.MAKE.PID} $@;; \ + *) { cat $@.${.MAKE.PID}; \ + sed 's,\.So:,.o:,;s,\.o:,.po:,' $@.${.MAKE.PID}; } | sort -u > $@; \ + rm -f $@.${.MAKE.PID};; \ + esac +.else +# make sure this exists +.depend: +# do _not_ assume that .depend is in any fit state for us to use +CAT_DEPEND = /dev/null +.if ${.MAKE.LEVEL} > 0 +.export CAT_DEPEND +.endif +_depend = +.endif + +.if ${DEBUG_AUTODEP:Uno:@m@${RELDIR:M$m}@} != "" +.info ${_DEPENDFILE:S,${SRCTOP}/,,} _depend=${_depend} +.endif + +gendirdeps: ${_DEPENDFILE} + +.if !target(${_DEPENDFILE}) +.if ${_bootstrap_dirdeps} == "yes" +# We are boot-strapping a new directory +# Use DPADD to seed DIRDEPS +.if !empty(DPADD) +# anything which matches ${_OBJROOT}* but not ${_OBJTOP}* +# needs to be qualified in DIRDEPS +# The pseudo machine "host" is used for HOST_TARGET +DIRDEPS = \ + ${DPADD:M${_OBJTOP}*:H:C,${_OBJTOP}[^/]*/,,:N.:O:u} \ + ${DPADD:M${_OBJROOT}*:N${_OBJTOP}*:H:S,${_OBJROOT},,:C,^([^/]+)/(.*),\2.\1,:S,${HOST_TARGET}$,host,:N.*:O:u} + +.endif +.endif + +_gendirdeps_mutex = +.if defined(NEED_GENDIRDEPS_MUTEX) +# If a src dir gets built with multiple object dirs, +# we need a mutex. Obviously, this is best avoided. +# Note if .MAKE.DEPENDFILE is common for all ${MACHINE} +# you either need to mutex, or ensure only one machine builds at a time! +# lockf is an example of a suitable tool +LOCKF ?= /usr/bin/lockf +.if exists(${LOCKF}) +GENDIRDEPS_MUTEXER ?= ${LOCKF} -k +.endif +.if empty(GENDIRDEPS_MUTEXER) +.error NEED_GENDIRDEPS_MUTEX defined, but GENDIRDEPS_MUTEXER not set +.else +_gendirdeps_mutex = ${GENDIRDEPS_MUTEXER} ${GENDIRDEPS_MUTEX:U${_CURDIR}/Makefile} +.endif +.endif + +# If we have META_XTRAS we most likely did not create them +# but we need to behave as if we did. +# Avoid adding glob patterns to .MAKE.META.CREATED though. +.MAKE.META.CREATED += ${META_XTRAS:N*\**:O:u} + +.if make(gendirdeps) +META_FILES = *.meta +.elif ${OPTIMIZE_OBJECT_META_FILES:Uno:tl} == "no" +META_FILES = ${.MAKE.META.FILES:T:N.depend*:O:u} +.else +# if we have 1000's of .o.meta, .So.meta etc we need only look at one set +# it is left as an exercise for the reader to work out what this does +META_FILES = ${.MAKE.META.FILES:T:N.depend*:N*o.meta:O:u} \ + ${.MAKE.META.FILES:T:M*.${.MAKE.META.FILES:M*o.meta:R:E:O:u:[1]}.meta:O:u} +.endif + +.if ${DEBUG_AUTODEP:Uno:@m@${RELDIR:M$m}@} != "" +.info ${_DEPENDFILE:S,${SRCTOP}/,,}: ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} xtras=${META_XTRAS} +.endif + +.if ${.MAKE.LEVEL} > 0 && !empty(GENDIRDEPS_FILTER) +.export GENDIRDEPS_FILTER +.endif + +${_DEPENDFILE}: ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} $${.MAKE.META.CREATED} + @echo Checking $@: ${.OODATE:T:[1..8]} + @(cd . && \ + SKIP_GENDIRDEPS='${SKIP_GENDIRDEPS:O:u}' \ + DPADD='${FORCE_DPADD:O:u}' ${_gendirdeps_mutex} \ + ${.MAKE} -f gendirdeps.mk RELDIR=${RELDIR} _DEPENDFILE=${_DEPENDFILE} \ + META_FILES='${META_XTRAS:T:O:u} ${META_FILES:T:O:u:${META_FILE_FILTER:ts:}}') + @test -s $@ && touch $@; : +.endif + +.endif +.endif + +.if ${_bootstrap_dirdeps} == "yes" +# make sure this is included at least once +.include <dirdeps.mk> +.else +${_DEPENDFILE}: .PRECIOUS +.endif + +CLEANFILES += *.meta filemon.* *.db +.endif diff --git a/share/mk/meta.stage.mk b/share/mk/meta.stage.mk new file mode 100644 index 0000000..f43fd01 --- /dev/null +++ b/share/mk/meta.stage.mk @@ -0,0 +1,166 @@ +# $Id: meta.stage.mk,v 1.11 2011/05/05 15:01:05 sjg Exp $ +# +# @(#) Copyright (c) 2011, Simon J. Gerraty +# +# This file is provided in the hope that it will +# be of use. There is absolutely NO WARRANTY. +# Permission to copy, redistribute or otherwise +# use this file is hereby granted provided that +# the above copyright notice and this notice are +# left intact. +# +# Please send copies of changes and bug-fixes to: +# sjg@crufty.net +# + +.if !target(__${.PARSEFILE}__) +__${.PARSEFILE}__: + +.if ${.MAKE.DEPENDFILE_PREFERENCE:U${.MAKE.DEPENDFILE}:M*.${MACHINE}} != "" +# this is generally safer anyway +_dirdep = ${RELDIR}.${MACHINE} +.else +_dirdep = ${RELDIR} +.endif + +# this allows us to trace dependencies back to their src dir +.dirdep: + @echo '${_dirdep}' > $@ + +.if defined(NO_POSIX_SHELL) || ${type printf:L:sh:Mbuiltin} == "" +_stage_file_basename = `basename $$f` +_stage_target_dirname = `dirname $$t` +.else +_stage_file_basename = $${f\#\#*/} +_stage_target_dirname = $${t%/*} +.endif + +# common logic for staging files +# this all relies on RELDIR being set to a subdir of SRCTOP +# we use ln(1) if we can, else cp(1) +STAGE_FILE_SCRIPT = StageFiles() { \ + dest=$$1; shift; \ + mkdir -p $$dest; \ + [ -s .dirdep ] || echo '${_dirdep}' > .dirdep; \ + for f in "$$@"; do \ + case "$$f" in */*) t=$$dest/${_stage_file_basename};; *) t=$$dest/$$f;; esac; \ + rm -f $$t $$t.dirdep; \ + { ln $$f $$t 2> /dev/null || \ + cp -p $$f $$t; } && \ + { ln .dirdep $$t.dirdep 2> /dev/null || \ + cp .dirdep $$t.dirdep; }; \ + done; } + +STAGE_LINKS_SCRIPT = StageLinks() { \ + case "$$1" in --) shift;; -*) lnf=$$1; shift;; esac; \ + dest=$$1; shift; \ + mkdir -p $$dest; \ + [ -s .dirdep ] || echo '${_dirdep}' > .dirdep; \ + while test $$\# -ge 2; do \ + l=$$1; shift; \ + t=$$dest/$$1; \ + case "$$1" in */*) mkdir -p ${_stage_target_dirname};; esac; \ + shift; \ + rm -f $$t $$t.dirdep 2>/dev/null; \ + ln $$lnf $$l $$t; \ + { ln .dirdep $$t.dirdep 2> /dev/null || \ + cp .dirdep $$t.dirdep; }; \ + done; :; } + +STAGE_AS_SCRIPT = StageAs() { \ + dest=$$1; shift; \ + mkdir -p $$dest; \ + [ -s .dirdep ] || echo '${_dirdep}' > .dirdep; \ + while test $$\# -ge 2; do \ + s=$$1; shift; \ + t=$$dest/$$1; \ + case "$$1" in */*) mkdir -p ${_stage_target_dirname};; esac; \ + shift; \ + rm -f $$t $$t.dirdep; \ + { ln $$s $$t 2> /dev/null || \ + cp -p $$s $$t; } && \ + { ln .dirdep $$t.dirdep 2> /dev/null || \ + cp .dirdep $$t.dirdep; }; \ + done; } + +# this is simple, a list of the "staged" files depends on this, +_STAGE_BASENAME_USE: .USE ${.TARGET:T} + @${STAGE_FILE_SCRIPT}; StageFiles ${.TARGET:H} ${.TARGET:T} + +.if !empty(STAGE_INCSDIR) +STAGE_INCS ?= ${.ALLSRC:N.dirdep} + +stage_incs: .dirdep + @${STAGE_FILE_SCRIPT}; StageFiles ${STAGE_INCSDIR} ${STAGE_INCS} + @touch $@ +.endif + +.if !empty(STAGE_LIBDIR) +STAGE_LIBS ?= ${.ALLSRC:N.dirdep} + +stage_libs: .dirdep + @${STAGE_FILE_SCRIPT}; StageFiles ${STAGE_LIBDIR} ${STAGE_LIBS} +.if !empty(SHLIB_LINKS) + @${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_LIBDIR} \ + ${SHLIB_LINKS:@t@${STAGE_LIBS:T:M$t.*} $t@} +.elif !empty(SHLIB_LINK) && !empty(SHLIB_NAME) + @${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_LIBDIR} ${SHLIB_NAME} ${SHLIB_LINK} ${SYMLINKS:T} +.endif + @touch $@ +.endif + +.if !empty(STAGE_DIR) +STAGE_SETS += _default +STAGE_DIR._default = ${STAGE_DIR} +STAGE_SYMLINKS_DIR._default = ${STAGE_SYMLINKS_DIR:U${STAGE_DIR}} +STAGE_FILES._default = ${STAGE_FILES} +STAGE_SYMLINKS._default = ${STAGE_SYMLINKS} +STAGE_FILES ?= ${.ALLSRC:N.dirdep:Nstage_*} +STAGE_SYMLINKS ?= ${.ALLSRC:T:N.dirdep:Nstage_*} +.endif + +.if !empty(STAGE_SETS) + +# some makefiles need to populate multiple directories +.for s in ${STAGE_SETS:O:u} +STAGE_FILES.$s ?= ${.ALLSRC:N.dirdep} +STAGE_SYMLINKS.$s ?= ${.ALLSRC:N.dirdep} + +.if $s != "_default" +stage_files: stage_files.$s +stage_files.$s: .dirdep +.else +stage_files: .dirdep +.endif + @${STAGE_FILE_SCRIPT}; StageFiles ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}} ${STAGE_FILES.$s} + @touch $@ + +.if $s != "_default" +stage_symlinks: stage_symlinks.$s +stage_symlinks.$s: .dirdep +.else +stage_symlinks: .dirdep +.endif + @${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_SYMLINKS_DIR.$s:U${STAGE_DIR.$s}} ${STAGE_SYMLINKS.$s} + @touch $@ + +.endfor +.endif + +.if !empty(STAGE_AS_SETS) + +# sometimes things need to be renamed as they are staged +# each ${file} will be staged as ${STAGE_AS_${file:T}} +# one could achieve the same with SYMLINKS +.for s in ${STAGE_AS_SETS:O:u} +STAGE_AS.$s ?= ${.ALLSRC:N.dirdep} + +stage_as: stage_as.$s +stage_as.$s: .dirdep + @${STAGE_AS_SCRIPT}; StageAs ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}} ${STAGE_AS.$s:@f@$f ${STAGE_AS_${f:T}:U${f:T}}@} + @touch $@ + +.endfor +.endif + +.endif diff --git a/share/mk/meta.subdir.mk b/share/mk/meta.subdir.mk new file mode 100644 index 0000000..1a77b44 --- /dev/null +++ b/share/mk/meta.subdir.mk @@ -0,0 +1,79 @@ +# $Id: meta.subdir.mk,v 1.8 2011/11/09 22:27:25 sjg Exp $ + +# +# @(#) Copyright (c) 2010, Simon J. Gerraty +# +# This file is provided in the hope that it will +# be of use. There is absolutely NO WARRANTY. +# Permission to copy, redistribute or otherwise +# use this file is hereby granted provided that +# the above copyright notice and this notice are +# left intact. +# +# Please send copies of changes and bug-fixes to: +# sjg@crufty.net +# + +.if !defined(NO_SUBDIR) && !empty(SUBDIR) +.if make(destroy*) || make(clean*) +.MAKE.MODE = compat +.if !commands(destroy) +.-include <bsd.obj.mk> +.endif +.elif ${.MAKE.LEVEL} == 0 + +.MAIN: all + +.if !exists(${.CURDIR}/${.MAKE.DEPENDFILE:T}) || make(gendirdeps) +# start with this +DIRDEPS = ${SUBDIR:N.WAIT:O:u:@d@${RELDIR}/$d@} + +.if make(gendirdeps) +.include <meta.autodep.mk> +.else +# this is the cunning bit +# actually it is probably a bit risky +# since we may pickup subdirs which are not relevant +# the alternative is a walk through the tree though +# which is difficult without a sub-make. + +.if defined(BOOTSTRAP_DEPENDFILES) +_find_name = ${.MAKE.MAKEFILE_PREFERENCE:@m@-o -name $m@:S,^-o,,1} +DIRDEPS = ${_subdeps:H:O:u:@d@${RELDIR}/$d@} +.elif ${.MAKE.DEPENDFILE:E} == ${MACHINE} && defined(ALL_MACHINES) +# we want to find Makefile.depend.* ie for all machines +# and turn the dirs into dir.<machine> +_find_name = -name '${.MAKE.DEPENDFILE:T:R}*' +DIRDEPS = ${_subdeps:O:u:${NIgnoreFiles}:@d@${RELDIR}/${d:H}.${d:E}@:S,.${MACHINE}$,,:S,.depend$,,} +.else +# much simpler +_find_name = -name ${.MAKE.DEPENDFILE:T} +.if ${.MAKE.DEPENDFILE:E} == ${MACHINE} +_find_name += -o -name ${.MAKE.DEPENDFILE:T:R} +.endif +DIRDEPS = ${_subdeps:H:O:u:@d@${RELDIR}/$d@} +.endif + +_subdeps != cd ${.CURDIR} && \ + find ${SUBDIR:N.WAIT} -type f \( ${_find_name} \) -print -o \ + -name .svn -prune 2> /dev/null; echo + +.if empty(_subdeps) +DIRDEPS = +.else +# clean up if needed +DIRDEPS := ${DIRDEPS:S,^./,,:S,/./,/,g:${SUBDIREPS_FILTER:Uu}} +.endif +# we just dealt with it, if we leave it defined, +# dirdeps.mk will compute some interesting combinations. +.undef ALL_MACHINES + +DEP_RELDIR = ${RELDIR} +.include <dirdeps.mk> +.endif +.endif +.else +all: .PHONY +.endif + +.endif diff --git a/share/mk/meta.sys.mk b/share/mk/meta.sys.mk new file mode 100644 index 0000000..379e338 --- /dev/null +++ b/share/mk/meta.sys.mk @@ -0,0 +1,139 @@ +# $Id: meta.sys.mk,v 1.14 2011/10/02 00:40:56 sjg Exp $ + +# +# @(#) Copyright (c) 2010, Simon J. Gerraty +# +# This file is provided in the hope that it will +# be of use. There is absolutely NO WARRANTY. +# Permission to copy, redistribute or otherwise +# use this file is hereby granted provided that +# the above copyright notice and this notice are +# left intact. +# +# Please send copies of changes and bug-fixes to: +# sjg@crufty.net +# + +# include this if you want to enable meta mode +# for maximum benefit, requires filemon(4) driver. + +.if ${MAKE_VERSION:U0} > 20100901 +.if !target(.ERROR) + + +META_MODE += meta verbose +.MAKE.MODE ?= ${META_MODE} + +.if ${.MAKE.LEVEL} == 0 +_make_mode := ${.MAKE.MODE} ${META_MODE} +.if ${_make_mode:M*read*} != "" || ${_make_mode:M*nofilemon*} != "" +# tell everyone we are not updating Makefile.depend* +UPDATE_DEPENDFILE = NO +.export UPDATE_DEPENDFILE +.endif +.if ${UPDATE_DEPENDFILE:Uyes:tl} == "no" && !exists(/dev/filemon) +# we should not get upset +META_MODE += nofilemon +.export META_MODE +.endif +.endif + +.if !defined(NO_SILENT) +.if ${MAKE_VERSION} > 20110818 +# only be silent when we have a .meta file +META_MODE += silent=yes +.else +.SILENT: +.endif +.endif + +# make defaults .MAKE.DEPENDFILE to .depend +# that won't work for us. +.if ${.MAKE.DEPENDFILE} == ".depend" +.undef .MAKE.DEPENDFILE +.endif + +# if you don't cross build for multiple MACHINEs concurrently, then +# .MAKE.DEPENDFILE = Makefile.depend +# probably makes sense - you can set that in local.sys.mk +.MAKE.DEPENDFILE ?= Makefile.depend.${MACHINE} + +# we use the pseudo machine "host" for the build host. +# this should be taken care of before we get here +.if ${OBJTOP:Ua} == ${HOST_OBJTOP:Ub} +MACHINE = host +.endif + +.if ${.MAKE.LEVEL} == 0 +# it can be handy to know which MACHINE kicked off the build +# for example, if using Makefild.depend for multiple machines, +# allowing only MACHINE0 to update can keep things simple. +MACHINE0 := ${MACHINE} + +.if defined(PYTHON) && exists(${PYTHON}) +# we prefer the python version of this - it is much faster +META2DEPS ?= ${.PARSEDIR}/meta2deps.py +.else +META2DEPS ?= ${.PARSEDIR}/meta2deps.sh +.endif +META2DEPS := ${META2DEPS} +.export META2DEPS +.endif + +MAKE_PRINT_VAR_ON_ERROR += \ + .ERROR_TARGET \ + .ERROR_META_FILE \ + .MAKE.LEVEL \ + MAKEFILE \ + .MAKE.MODE + +.if !defined(SB) && defined(SRCTOP) +SB = ${SRCTOP:H} +.endif +ERROR_LOGDIR ?= ${SB}/error +meta_error_log = ${ERROR_LOGDIR}/meta-${.MAKE.PID}.log + +# we are not interested in make telling us a failure happened elsewhere +.ERROR: _metaError +_metaError: .NOMETA .NOTMAIN + -@[ "${.ERROR_META_FILE}" ] && { \ + grep -q 'failure has been detected in another branch' ${.ERROR_META_FILE} && exit 0; \ + mkdir -p ${meta_error_log:H}; \ + cp ${.ERROR_META_FILE} ${meta_error_log}; \ + echo "ERROR: log ${meta_error_log}" >&2; }; : + +.endif + +# Are we, after all, in meta mode? +.if ${.MAKE.MODE:Mmeta*} != "" +MKDEP = meta.autodep + +.if ${.MAKE.LEVEL} == 0 +# make sure dirdeps target exists and do it first +all: dirdeps .WAIT +dirdeps: +.NOPATH: dirdeps + +.if defined(ALL_MACHINES) +# the first .MAIN: is what counts +# by default dirdeps is all we want at level0 +.MAIN: dirdeps +# tell dirdeps.mk what we want +BUILD_AT_LEVEL0 = no +.endif + +.if ${.MAKE.DEPENDFILE:E} == ${MACHINE} +# it works best if we do everything via sub-makes +BUILD_AT_LEVEL0 ?= no +.endif +BUILD_AT_LEVEL0 ?= yes +.endif + +# if we think we are updating dependencies, +# then filemon had better be present +.if ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !exists(/dev/filemon) +.error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. +.endif + +.endif +.endif diff --git a/share/mk/meta2deps.py b/share/mk/meta2deps.py new file mode 100755 index 0000000..8e33e2c --- /dev/null +++ b/share/mk/meta2deps.py @@ -0,0 +1,606 @@ +#!/usr/bin/env python + +""" +This script parses each "meta" file and extracts the +information needed to deduce build and src dependencies. + +It works much the same as the original shell script, but is +*much* more efficient. + +The parsing work is handled by the class MetaFile. +We only pay attention to a subset of the information in the +"meta" files. Specifically: + +'CWD' to initialize our notion. + +'C' to track chdir(2) on a per process basis + +'R' files read are what we really care about. + directories read, provide a clue to resolving + subsequent relative paths. That is if we cannot find + them relative to 'cwd', we check relative to the last + dir read. + +'W' files opened for write or read-write, + for filemon V3 and earlier. + +'E' files executed. + +'L' files linked + +'V' the filemon version, this record is used as a clue + that we have reached the interesting bit. + +""" + +""" +RCSid: + $Id: meta2deps.py,v 1.5 2011/11/14 00:18:42 sjg Exp $ + + Copyright (c) 2011, Juniper Networks, Inc. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +""" + +import os, re, sys + +def getv(dict, key, d=None): + """Lookup key in dict and return value or the supplied default.""" + if key in dict: + return dict[key] + return d + +def resolve(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr): + """ + Return an absolute path, resolving via cwd or last_dir if needed. + """ + if path.endswith('/.'): + path = path[0:-2] + if path[0] == '/': + return path + if path == '.': + return cwd + if path.startswith('./'): + return cwd + path[1:] + if last_dir == cwd: + last_dir = None + for d in [last_dir, cwd]: + if not d: + continue + p = '/'.join([d,path]) + if debug > 2: + print >> debug_out, "looking for:", p, + if not os.path.exists(p): + if debug > 2: + print >> debug_out, "nope" + p = None + continue + if debug > 2: + print >> debug_out, "found:", p + return p + return None + +def abspath(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr): + """ + Return an absolute path, resolving via cwd or last_dir if needed. + this gets called a lot, so we try to avoid calling realpath + until we know we have something. + """ + path = resolve(path, cwd, last_dir, debug, debug_out) + if path and (path.find('./') > 0 or + path.endswith('/..') or + os.path.islink(path)): + return os.path.realpath(path) + return path + +def sort_unique(list, cmp=None, key=None, reverse=False): + list.sort(cmp, key, reverse) + nl = [] + le = None + for e in list: + if e == le: + continue + nl.append(e) + return nl + +class MetaFile: + """class to parse meta files generated by bmake.""" + + conf = None + dirdep_re = None + host_target = None + srctops = [] + objroots = [] + + seen = {} + obj_deps = [] + src_deps = [] + file_deps = [] + + def __init__(self, name, conf={}): + """if name is set we will parse it now. + conf can have the follwing keys: + + SRCTOPS list of tops of the src tree(s). + + CURDIR the src directory 'bmake' was run from. + + RELDIR the relative path from SRCTOP to CURDIR + + MACHINE the machine we built for. + set to 'none' if we are not cross-building. + + HOST_TARGET + when we build for the psuedo machine 'host' + the object tree uses HOST_TARGET rather than MACHINE. + + OBJROOTS a list of the common prefix for all obj dirs it might + end in '/' or '-'. + + DPDEPS names an optional file to which per file dependencies + will be appended. + For example if 'some/path/foo.h' is read from SRCTOP + then 'DPDEPS_some/path/foo.h +=' "RELDIR" is output. + This can allow 'bmake' to learn all the dirs within + the tree that depend on 'foo.h' + + debug desired debug level + + debug_out open file to send debug output to (sys.stderr) + + """ + + self.name = name + self.debug = getv(conf, 'debug', 0) + self.debug_out = getv(conf, 'debug_out', sys.stderr) + + if not self.conf: + # some of the steps below we want to do only once + self.conf = conf + self.host_target = getv(conf, 'HOST_TARGET') + for srctop in getv(conf, 'SRCTOPS', []): + if srctop[-1] != '/': + srctop += '/' + if not srctop in self.srctops: + self.srctops.append(srctop) + + for objroot in getv(conf, 'OBJROOTS', []): + if not objroot in self.objroots: + self.objroots.append(objroot) + _objroot = os.path.realpath(objroot) + if objroot[-1] == '/': + _objroot += '/' + if not _objroot in self.objroots: + self.objroots.append(_objroot) + + if self.debug: + print >> self.debug_out, "host_target=", self.host_target + print >> self.debug_out, "srctops=", self.srctops + print >> self.debug_out, "objroots=", self.objroots + + self.dirdep_re = re.compile(r'([^/]+)/(.+)') + + self.curdir = getv(conf, 'CURDIR') + self.machine = getv(conf, 'MACHINE', '') + self.reldir = getv(conf, 'RELDIR') + self.dpdeps = getv(conf, 'DPDEPS') + if self.dpdeps and not self.reldir: + if self.debug: + print >> self.debug_out, "need reldir:", + if self.curdir: + srctop = self.find_top(self.curdir, self.srctops) + if srctop: + self.reldir = self.curdir.replace(srctop,'') + if self.debug: + print >> self.debug_out, self.reldir + if not self.reldir: + self.dpdeps = None # we cannot do it? + + if name: + self.parse() + + def reset(self): + """reset state if we are being passed meta files from multiple directories.""" + self.seen = {} + self.obj_deps = [] + self.src_deps = [] + self.file_deps = [] + + def dirdeps(self, sep='\n'): + """return DIRDEPS""" + return sep.strip() + sep.join(self.obj_deps) + + def src_dirdeps(self, sep='\n'): + """return SRC_DIRDEPS""" + return sep.strip() + sep.join(self.src_deps) + + def file_depends(self, out=None): + """Append DPDEPS_${file} += ${RELDIR} + for each file we saw, to the output file.""" + if not self.reldir: + return None + for f in sort_unique(self.file_deps): + print >> out, 'DPDEPS_%s += %s' % (f, self.reldir) + + def seenit(self, dir): + """rememer that we have seen dir.""" + self.seen[dir] = 1 + + def add(self, list, data, clue=''): + """add data to list if it isn't already there.""" + if data not in list: + list.append(data) + if self.debug: + print >> self.debug_out, "%s: %sAdd: %s" % (self.name, clue, data) + + def find_top(self, path, list): + """the logical tree may be split accross multiple trees""" + for top in list: + if path.startswith(top): + if self.debug > 2: + print >> self.debug_out, "found in", top + return top + return None + + def find_obj(self, objroot, dir, path, input): + """return path within objroot, taking care of .dirdep files""" + ddep = None + for ddepf in [path + '.dirdep', dir + '/.dirdep']: + if not ddep and os.path.exists(ddepf): + ddep = open(ddepf, 'rb').readline().strip('# \n') + if self.debug > 1: + print >> self.debug_out, "found %s: %s\n" % (ddepf, ddep) + if ddep.endswith(self.machine): + ddep = ddep[0:-(1+len(self.machine))] + + if not ddep: + # no .dirdeps, so remember that we've seen the raw input + self.seenit(input) + self.seenit(dir) + if self.machine == 'none': + if dir.startswith(objroot): + return dir.replace(objroot,'') + return None + m = self.dirdep_re.match(dir.replace(objroot,'')) + if m: + ddep = m.group(2) + dmachine = m.group(1) + if dmachine != self.machine: + if not (self.machine == 'host' and + dmachine == self.host_target): + if self.debug > 2: + print >> self.debug_out, "adding .%s to %s" % (dmachine, ddep) + ddep += '.' + dmachine + + return ddep + + def parse(self, name=None, file=None): + """A meta file looks like: + + # Meta data file "path" + CMD "command-line" + CWD "cwd" + TARGET "target" + -- command output -- + -- filemon acquired metadata -- + # buildmon version 3 + V 3 + C "pid" "cwd" + E "pid" "path" + F "pid" "child" + R "pid" "path" + W "pid" "path" + X "pid" "status" + D "pid" "path" + L "pid" "src" "target" + M "pid" "old" "new" + S "pid" "path" + # Bye bye + + We go to some effort to avoid processing a dependency more than once. + Of the above record types only C,E,F,L,R,V and W are of interest. + """ + + version = 0 # unknown + if name: + self.name = name; + if file: + f = file + cwd = last_dir = self.cwd + else: + f = open(self.name, 'rb') + skip = True + pid_cwd = {} + pid_last_dir = {} + last_pid = 0 + + if self.curdir: + self.seenit(self.curdir) # we ignore this + + interesting = 'CEFLRV' + for line in f: + # ignore anything we don't care about + if not line[0] in interesting: + continue + if self.debug > 2: + print >> self.debug_out, "input:", line, + w = line.split() + + if skip: + if w[0] == 'V': + skip = False + version = int(w[1]) + """ + if version < 4: + # we cannot ignore 'W' records + # as they may be 'rw' + interesting += 'W' + """ + elif w[0] == 'CWD': + self.cwd = cwd = last_dir = w[1] + self.seenit(cwd) # ignore this + if self.debug: + print >> self.debug_out, "%s: CWD=%s" % (self.name, cwd) + continue + + pid = int(w[1]) + if pid != last_pid: + if last_pid: + pid_cwd[last_pid] = cwd + pid_last_dir[last_pid] = last_dir + cwd = getv(pid_cwd, pid, self.cwd) + last_dir = getv(pid_last_dir, pid, self.cwd) + last_pid = pid + + # process operations + if w[0] == 'F': + npid = int(w[2]) + pid_cwd[npid] = cwd + pid_last_dir[npid] = cwd + last_pid = npid + continue + elif w[0] == 'C': + cwd = abspath(w[2], cwd, None, self.debug, self.debug_out) + if cwd.endswith('/.'): + cwd = cwd[0:-2] + last_dir = cwd + if self.debug > 1: + print >> self.debug_out, "cwd=", cwd + continue + + if w[2] in self.seen: + if self.debug > 2: + print >> self.debug_out, "seen:", w[2] + continue + # file operations + if w[0] in 'ML': + path = w[2].strip("'") + else: + path = w[2] + # we don't want to resolve the last component if it is + # a symlink + path = resolve(path, cwd, last_dir, self.debug, self.debug_out) + if not path: + continue + dir,base = os.path.split(path) + if dir in self.seen: + if self.debug > 2: + print >> self.debug_out, "seen:", dir + continue + # we can have a path in an objdir which is a link + # to the src dir, we may need to add dependencies for each + rdir = dir + dir = abspath(dir, cwd, last_dir, self.debug, self.debug_out) + if rdir == dir or rdir.find('./') > 0: + rdir = None + # now put path back together + path = '/'.join([dir,base]) + if self.debug > 1: + print >> self.debug_out, "raw=%s rdir=%s dir=%s path=%s" % (w[2], rdir, dir, path) + if w[0] in 'SRWL': + if w[0] == 'W' and path.endswith('.dirdep'): + continue + if path in [last_dir, cwd, self.cwd, self.curdir]: + if self.debug > 1: + print >> self.debug_out, "skipping:", path + continue + if os.path.isdir(path): + if w[0] in 'RW': + last_dir = path; + if self.debug > 1: + print >> self.debug_out, "ldir=", last_dir + continue + + if w[0] in 'REWML': + # finally, we get down to it + if dir == self.cwd or dir == self.curdir: + continue + srctop = self.find_top(path, self.srctops) + if srctop: + if self.dpdeps: + self.add(self.file_deps, path.replace(srctop,''), 'file') + self.add(self.src_deps, dir.replace(srctop,''), 'src') + self.seenit(w[2]) + self.seenit(dir) + if rdir and not rdir.startswith(srctop): + dir = rdir # for below + rdir = None + else: + continue + + objroot = None + for dir in [dir,rdir]: + if not dir: + continue + objroot = self.find_top(dir, self.objroots) + if objroot: + break + if objroot: + ddep = self.find_obj(objroot, dir, path, w[2]) + if ddep: + self.add(self.obj_deps, ddep, 'obj') + else: + # don't waste time looking again + self.seenit(w[2]) + self.seenit(dir) + if not file: + f.close() + + +def main(argv, klass=MetaFile, xopts='', xoptf=None): + """Simple driver for class MetaFile. + + Usage: + script [options] [key=value ...] "meta" ... + + Options and key=value pairs contribute to the + dictionary passed to MetaFile. + + -S "SRCTOP" + add "SRCTOP" to the "SRCTOPS" list. + + -C "CURDIR" + + -O "OBJROOT" + add "OBJROOT" to the "OBJROOTS" list. + + -m "MACHINE" + + -H "HOST_TARGET" + + -D "DPDEPS" + + -d bumps debug level + + """ + import getopt + + # import Psyco if we can + # it can speed things up quite a bit + have_psyco = 0 + try: + import psyco + psyco.full() + have_psyco = 1 + except: + pass + + conf = { + 'SRCTOPS': [], + 'OBJROOTS': [], + } + + try: + machine = os.environ['MACHINE'] + if machine: + conf['MACHINE'] = machine + srctop = os.environ['SB_SRC'] + if srctop: + conf['SRCTOPS'].append(srctop) + objroot = os.environ['SB_OBJROOT'] + if objroot: + conf['OBJROOTS'].append(objroot) + except: + pass + + debug = 0 + output = True + + opts, args = getopt.getopt(argv[1:], 'dS:C:O:R:m:D:H:q' + xopts) + for o, a in opts: + if o == '-d': + debug += 1 + elif o == '-q': + output = False + elif o == '-H': + conf['HOST_TARGET'] = a + elif o == '-S': + if a not in conf['SRCTOPS']: + conf['SRCTOPS'].append(a) + elif o == '-C': + conf['CURDIR'] = a + elif o == '-O': + if a not in conf['OBJROOTS']: + conf['OBJROOTS'].append(a) + elif o == '-R': + conf['RELDIR'] = a + elif o == '-D': + conf['DPDEPS'] = a + elif o == '-m': + conf['MACHINE'] = a + elif xoptf: + xoptf(o, a, conf) + + conf['debug'] = debug + + # get any var=val assignments + eaten = [] + for a in args: + if a.find('=') > 0: + k,v = a.split('=') + if k in ['SRCTOP','OBJROOT','SRCTOPS','OBJROOTS']: + if k == 'SRCTOP': + k = 'SRCTOPS' + elif k == 'OBJROOT': + k = 'OBJROOTS' + if v not in conf[k]: + conf[k].append(v) + else: + conf[k] = v + eaten.append(a) + continue + break + + for a in eaten: + args.remove(a) + + debug_out = getv(conf, 'debug_out', sys.stderr) + + if debug: + print >> debug_out, "config:" + print >> debug_out, "psyco=", have_psyco + for k,v in conf.items(): + print >> debug_out, "%s=%s" % (k,v) + + for a in args: + m = klass(a, conf) + + if output: + print m.dirdeps() + + print m.src_dirdeps('\nsrc:') + + dpdeps = getv(conf, 'DPDEPS') + if dpdeps: + m.file_depends(open(dpdeps, 'wb')) + + return m + +if __name__ == '__main__': + try: + main(sys.argv) + except: + # yes, this goes to stdout + print "ERROR: ", sys.exc_info()[1] + raise + diff --git a/share/mk/meta2deps.sh b/share/mk/meta2deps.sh new file mode 100755 index 0000000..2fec368 --- /dev/null +++ b/share/mk/meta2deps.sh @@ -0,0 +1,306 @@ +#!/bin/sh + +# NAME: +# meta2deps.sh - extract useful info from .meta files +# +# SYNOPSIS: +# meta2deps.sh SB="SB" "meta" ... +# +# DESCRIPTION: +# This script looks each "meta" file and extracts the +# information needed to deduce build and src dependencies. +# +# To do this, we extract the 'CWD' record as well as all the +# syscall traces which describe 'R'ead, 'C'hdir and 'E'xec +# syscalls. +# +# The typical meta file looks like:: +#.nf +# +# # Meta data file "path" +# CMD "command-line" +# CWD "cwd" +# TARGET "target" +# -- command output -- +# -- filemon acquired metadata -- +# # buildmon version 2 +# V 2 +# E "pid" "path" +# R "pid" "path" +# C "pid" "cwd" +# R "pid" "path" +# X "pid" "status" +#.fi +# +# The fact that all the syscall entry lines start with a single +# character make these files quite easy to process using sed(1). +# +# To simplify the logic the 'CWD' line is made to look like a +# normal 'C'hdir entry, and "cwd" is remembered so that it can +# be prefixed to any "path" which is not absolute. +# +# If the "path" being read ends in '.srcrel' it is the content +# of (actually the first line of) that file that we are +# interested in. +# +# Any "path" which lies outside of the sandbox "SB" is generally +# not of interest and is ignored. +# +# The output, is a set of absolute paths with "SB" like: +#.nf +# +# $SB/obj-i386/bsd/gnu/lib/csu +# $SB/obj-i386/bsd/gnu/lib/libgcc +# $SB/obj-i386/bsd/include +# $SB/obj-i386/bsd/lib/csu/i386-elf +# $SB/obj-i386/bsd/lib/libc +# $SB/src/bsd/include +# $SB/src/bsd/sys/i386/include +# $SB/src/bsd/sys/sys +# $SB/src/pan-release/rtsock +# $SB/src/pfe-shared/include/jnx +#.fi +# +# Which can then be further processed by 'gendirdeps.mk' +# +# If we are passed 'DPDEPS='"dpdeps", then for each src file +# outside of "CURDIR" we read, we output a line like: +#.nf +# +# DPDEPS_$path += $RELDIR +#.fi +# +# with "$path" geting turned into reldir's, so that we can end +# up with a list of all the directories which depend on each src +# file in another directory. This can allow for efficient yet +# complete testing of changes. + + +# RCSid: +# $Id: meta2deps.sh,v 1.2 2011/10/02 00:34:47 sjg Exp $ + +# Copyright (c) 2010, Juniper Networks, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +meta2src() { + cat /dev/null "$@" | + sed -n '/^R .*\.[chyl]$/s,^..[0-9]* ,,p' | + sort -u +} + +meta2dirs() { + cat /dev/null "$@" | + sed -n '/^R .*\/.*\.[a-z0-9][^\/]*$/s,^..[0-9]* \(.*\)/[^/]*$,\1,p' | + sort -u +} + +meta2deps() { + DPDEPS= + while : + do + case "$1" in + *=*) eval export "$1"; shift;; + *) break;; + esac + done + + [ -z "$RELDIR" ] && unset DPDEPS + tf=/tmp/m2d$$-$USER + rm -f $tf.* + trap 'rm -f $tf.*; trap 0' 0 + + > $tf.dirdep + > $tf.qual + > $tf.srcdep + > $tf.srcrel + > $tf.dpdeps + + seenit= + seensrc= + lpid= + cat /dev/null "$@" | + sed -e 's,^CWD,C C,;/^[CREFL] /!d' -e "s,',,g" | + while read op pid path junk + do + : op=$op pid=$pid path=$path + # we track cwd and ldir (of interest) per pid + # CWD is bmake's cwd + case "$lpid,$pid" in + ,C) CWD=$path cwd=$path ldir=$path + if [ -z "$SB" ]; then + SB=`echo $CWD | sed 's,/obj.*,,'` + fi + SRCTOP=${SRCTOP:-$SB/src} + continue + ;; + $pid,$pid) ;; + *) + case "$lpid" in + "") ;; + *) eval ldir_$lpid=$ldir cwd_$lpid=$cwd;; + esac + eval ldir=\${ldir_$pid:-$CWD} cwd=\${cwd_$pid:-$CWD} + lpid=$pid + ;; + esac + + case "$op,$path" in + W,*srcrel) continue;; + C,*) + case "$path" in + /*) cwd=$path;; + *) cwd=`cd $cwd/$path 2> /dev/null && /bin/pwd`;; + esac + # watch out for temp dirs that no longer exist + test -d ${cwd:-/dev/null/no/such} || cwd=$CWD + continue + ;; + F,*) eval cwd_$path=$cwd ldir_$path=$ldir + continue + ;; + *) dir=${path%/*} + case "$path" in + $SB/*|${SB_BACKING_SB:-$SB}/*) ;; + $SB_OBJROOT*) ;; + /*/stage/*) ;; + /*) continue;; + *) for path in $ldir/$path $cwd/$path + do + test -e $path && break + done + dir=${path%/*} + ;; + esac + ;; + esac + # avoid repeating ourselves... + case "$DPDEPS,$seensrc," in + ,*) + case ",$seenit," in + *,$dir,*) continue;; + esac + ;; + *,$path,*) continue;; + esac + # canonicalize if needed + case "/$dir/" in + */../*|*/./*) + rdir=$dir + dir=`cd $dir 2> /dev/null && /bin/pwd` + seen="$rdir,$dir" + ;; + *) seen=$dir;; + esac + case "$dir" in + ${CURDIR:-.}|${CURDIR:-.}/*|"") continue;; + $SRCTOP/*|${SB_BACKING_SB:-$SB}/src/*) + # avoid repeating ourselves... + case "$DPDEPS,$seensrc," in + ,*) + case ",$seenit," in + *,$dir,*) continue;; + esac + ;; + esac + ;; + *) + case ",$seenit," in + *,$dir,*) continue;; + esac + ;; + esac + if [ -d $path ]; then + case "$path" in + */..) ldir=${dir%/*};; + *) ldir=$path;; + esac + continue + fi + [ -f $path ] || continue + case "$dir" in + $CWD) continue;; # ignore + $SRCTOP/*|${SB_BACKING_SB:-$SB}/src/*) + seenit="$seenit,$seen" + echo $dir >> $tf.srcdep + case "$DPDEPS,$reldir,$seensrc," in + ,*) ;; + *) seensrc="$seensrc,$path" + echo "DPDEPS_$dir/${path##*/} += $RELDIR" >> $tf.dpdeps + ;; + esac + continue + ;; + esac + # if there is a .dirdep we cannot skip + # just because we've seen the dir before. + if [ -s $path.dirdep ]; then + # this file contains: + # '# ${RELDIR}.<machine>' + echo $path.dirdep >> $tf.qual + continue + elif [ -s $dir.dirdep ]; then + echo $dir.dirdep >> $tf.qual + seenit="$seenit,$seen" + continue + fi + seenit="$seenit,$seen" + case "$dir" in + $SB/*|${SB_OBJROOT:-$SB/}*|${SB_BACKING_SB:-$SB}/*) + echo $dir;; + esac + done > $tf.dirdep + _nl=echo + for f in $tf.dirdep $tf.qual $tf.srcdep + do + [ -s $f ] || continue + case $f in + *qual) # a list of .dirdep files + # we can prefix everthing with $OBJTOP to + # tell gendirdeps.mk that these are + # DIRDEP entries, since they are already + # qualified with .<machine> as needed. + # We strip .$MACHINE though + xargs cat < $f | sort -u | + sed "s,^# ,,;s,^,$OBJTOP/,;s,\.$MACHINE\$,," + ;; + *) sort -u $f;; + esac + _nl=: + done + if [ -s $tf.dpdeps ]; then + case "$DPDEPS" in + */*) ;; + *) echo > $DPDEPS;; # the echo is needed! + esac + sort -u $tf.dpdeps | + sed "s,${SRCTOP}/,,;s,${SB_BACKING_SB:-$SB}/src/,," >> $DPDEPS + fi + # ensure we produce _something_ else egrep -v gets upset + $_nl +} + +case /$0 in +*/meta2dep*) meta2deps "$@";; +*/meta2dirs*) meta2dirs "$@";; +*/meta2src*) meta2src "$@";; +esac diff --git a/share/mk/sys.dependfile.mk b/share/mk/sys.dependfile.mk new file mode 100644 index 0000000..2b99f84 --- /dev/null +++ b/share/mk/sys.dependfile.mk @@ -0,0 +1,38 @@ +# $Id: sys.dependfile.mk,v 1.3 2012/04/25 15:45:04 sjg Exp $ +# +# @(#) Copyright (c) 2012, Simon J. Gerraty +# +# This file is provided in the hope that it will +# be of use. There is absolutely NO WARRANTY. +# Permission to copy, redistribute or otherwise +# use this file is hereby granted provided that +# the above copyright notice and this notice are +# left intact. +# +# Please send copies of changes and bug-fixes to: +# sjg@crufty.net +# + +# This only makes sense in meta mode. +# This allows a mixture of auto generated as well as manually edited +# dependency files, which can be differentiated by their names. +# As per dirdeps.mk we only require: +# 1. a common prefix +# 2. that machine specific files end in .${MACHINE} +# +# The .MAKE.DEPENDFILE_PREFERENCE below is an example. + +# All depend file names should start with this +.MAKE.DEPENDFILE_PREFIX ?= Makefile.depend + +# The order of preference: we will use the first one of these we find +# otherwise the 1st entry will be used by default. +.MAKE.DEPENDFILE_PREFERENCE ?= \ + ${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \ + ${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX} + +_e := ${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@} +.if !empty(_e) +.MAKE.DEPENDFILE := ${_e:[1]} +.endif +.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_PREFERENCE:[1]} diff --git a/share/mk/sys.mk b/share/mk/sys.mk index 533b1dd..0f0b06e 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -16,6 +16,10 @@ unix ?= We run FreeBSD, not UNIX. MACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/armeb/arm/:C/powerpc64/powerpc/} .endif +# Set any local definitions first. Place this early, but it needs +# MACHINE_CPUARCH to be defined. +.sinclude <local.sys.mk> + # If the special target .POSIX appears (without prerequisites or # commands) before the first noncomment line in the makefile, make shall # process the makefile as specified by the Posix 1003.2 specification. @@ -324,8 +328,16 @@ SHELL= ${__MAKE_SHELL} # XXX hint for bsd.port.mk OBJFORMAT?= elf +.if !defined(.PARSEDIR) +# We are not bmake, which is more aggressive about searching .PATH +# It is sometime necessary to curb its enthusiasm with .NOPATH +# The following allows us to quietly ignore .NOPATH when not using bmake. +.NOTMAIN: .NOPATH +.NOPATH: + # Toggle on warnings .WARN: dirsyntax +.endif .endif diff --git a/share/mklocale/Makefile.depend b/share/mklocale/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/mklocale/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/monetdef/Makefile.depend b/share/monetdef/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/monetdef/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/msgdef/Makefile.depend b/share/msgdef/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/msgdef/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/numericdef/Makefile.depend b/share/numericdef/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/numericdef/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/security/Makefile.depend b/share/security/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/security/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/skel/Makefile.depend b/share/skel/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/skel/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/snmp/mibs/Makefile.depend b/share/snmp/mibs/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/snmp/mibs/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/syscons/fonts/Makefile.depend b/share/syscons/fonts/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/syscons/fonts/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/syscons/keymaps/Makefile.depend b/share/syscons/keymaps/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/syscons/keymaps/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/syscons/scrnmaps/Makefile.depend b/share/syscons/scrnmaps/Makefile.depend new file mode 100644 index 0000000..ff699f7 --- /dev/null +++ b/share/syscons/scrnmaps/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + include \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/tabset/Makefile.depend b/share/tabset/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/tabset/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/termcap/Makefile.depend b/share/termcap/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/termcap/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/timedef/Makefile.depend b/share/timedef/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/timedef/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/zoneinfo/Makefile.depend b/share/zoneinfo/Makefile.depend new file mode 100644 index 0000000..29fda55 --- /dev/null +++ b/share/zoneinfo/Makefile.depend @@ -0,0 +1,14 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DEP_MACHINE := ${.PARSEFILE:E} + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif |