zmk-0.5.1/z.mk 0000664 0001750 0001750 00000012650 14064711144 011636 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
ifneq ($(value NAME),)
Project.Name ?= $(NAME)
else
Project.Name ?=
endif
NAME ?= $(or $(Project.Name),$(error define NAME - the name of the project))
ifneq ($(value VERSION),)
Project.Version ?= $(VERSION)
else
Project.Version ?=
endif
VERSION ?= $(or $(Project.Version),$(error define VERSION - the static version of the project))
# Speed up make by removing suffix rules.
.SUFFIXES:
# Version of the zmk library.
ZMK.Version = 0.5.1
# Location of include files used by the makefile system. Normally this is the
# zmk subdirectory of /usr/include, as this is where make is importing things
# from.
ZMK.z.mk := $(lastword $(MAKEFILE_LIST))
ZMK.Path ?= $(or $(patsubst %/,%,$(dir $(ZMK.z.mk))),.)
# Modules and templates present in the package
ZMK.modules = \
AllClean \
ClangAnalyzer \
ClangTidy \
Configure \
Coverity \
CppCheck \
Directories \
Directory \
GitVersion \
Header \
HeaderGroup \
InstallUninstall \
Library.A \
Library.DyLib \
Library.So \
ManPage \
OS \
ObjectGroup \
PVS \
Program \
Program.Test \
Script \
Silent \
Sparse \
Symlink \
Tarball \
Tarball.Src \
Toolchain \
internalTest \
toolchain.Clang \
toolchain.GCC \
toolchain.Tcc \
toolchain.Watcom
# Files belonging to ZMK that need to be distributed in third-party release tarballs.
ZMK.DistFiles = z.mk $(addprefix zmk/,$(foreach m,$(ZMK.modules),$m.mk) pvs-filter.awk)
# Temporary directory, used by distcheck.
TMPDIR ?= /tmp
# The location of the source code.
ZMK.SrcDir ?= .
# Are we building out-of-tree
ifneq ($(ZMK.SrcDir),.)
ZMK.IsOutOfTreeBuild = yes
ZMK.OutOfTreeSourcePath = $(ZMK.SrcDir)/
VPATH = $(ZMK.SrcDir)
else
ZMK.IsOutOfTreeBuild =
ZMK.OutOfTreeSourcePath =
endif
# ZMK Copyright Banner. Do not remove.
# You are not allowed to remove or alter this while staying compliant with the LGPL license.
# You can disable it by setting ZMK.NoBanner=1 on command line.
MAKECMDGOALS ?=
ZMK.NoBanner ?=
ifeq ($(or $(ZMK.NoBanner),$(MAKECMDGOALS)),)
$(info z.mk v$(ZMK.Version), Copyright (c) 2019-2021 Zygmunt Krynicki)
endif
# Meta-targets that don't have specific specific commands
.PHONY: $(sort all clean coverage fmt static-check check install uninstall dist distclean distcheck)
# Dist-clean is a super-set of clean.
distclean:: clean
# Run static checks when checking
check:: static-check
# Default goal is to build everything, regardless of declaration order
.DEFAULT_GOAL = all
# Some weird Make quirks. Depending on MAKE version, it's hard to use literal
# hash but it's possible to expand ZMK.hash to it reliably.
ZMK.hash=\#
# Comma is also hard to use directly.
ZMK.comma=,
# Newline is just hard to define.
define ZMK.newline
endef
# Boolean negation function
ZMK.not=$(if $1,,yes)
DEBUG ?=
# Display diagnostic messages when DEBUG has specific items.
DEBUG := $(subst $(ZMK.comma), ,$(DEBUG))
# Define the module and template system.
ZMK.ImportedModules ?=
ZMK.expandStack = 0
ZMK.nesting.0 = > #
ZMK.nesting.1 = ... > #
ZMK.nesting.2 = ... ... > #
ZMK.nesting.3 = ... ... ... > #
ZMK.nesting.4 = ... ... ... ... > #
ZMK.nesting.5 = ... ... ... ... ... > #
ZMK.nesting.6 = ... ... ... ... ... ... > #
ZMK.nesting.7 = ... ... ... ... ... ... ... > #
ZMK.nesting.8 = ... ... ... ... ... ... ... ... > #
ZMK.nesting.9 = ... ... ... ... ... ... ... ... ... > #
ZMK.nesting.10 = ... ... ... ... ... ... ... ... ... ... > #
ZMK.nesting.11 = ... ... ... ... ... ... ... ... ... ... ... > #
ZMK.nesting.12 = ... ... ... ... ... ... ... ... ... ... ... ... > #
ZMK.nesting.13 = ... ... ... ... ... ... ... ... ... ... ... ... ... > #
ZMK.nesting.14 = ... ... ... ... ... ... ... ... ... ... ... ... ... ... > #
ZMK.nesting.15 = ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... > #
define ZMK.Import
ifeq (,$1)
$$(error incorrect call to ZMK.Import, expected module name)
endif
ifeq (,$$(filter $1,$$(ZMK.ImportedModules)))
$$(if $$(findstring import,$$(DEBUG)),$$(info DEBUG: importing »$1«))
ZMK.ImportedModules += $1
include $$(ZMK.Path)/zmk/$1.mk
endif
endef
ZMK.variablesShown =
define ZMK.showVariable
ifeq (,$$(findstring $1,$$(ZMK.variablesShown)))
$$(info DEBUG: $$(ZMK.nesting.$$(ZMK.expandStack))$1=$$($1))
ZMK.variablesShown += $1
endif
endef
define ZMK.Expand
ifeq (,$1)
$$(error incorrect call to ZMK.Expand, expected module name)
endif
ifeq (,$2)
$$(error incorrect call to ZMK.Expand, expected variable name)
endif
$$(eval $$(call ZMK.Import,$1))
$$(if $$(findstring expand,$$(DEBUG)),$$(info DEBUG: $$(ZMK.nesting.$$(ZMK.expandStack))expanding template $1("$2")))
ZMK.expandStack := $$(shell expr $$(ZMK.expandStack) + 1)
$$(eval $$(call $1.Template,$2))
ZMK.expandStack := $$(shell expr $$(ZMK.expandStack) - 1)
$$(if $$(findstring expand,$$(DEBUG)),$$(foreach n,$$($1.Variables),$$(eval $$(call ZMK.showVariable,$2.$$n))))
endef
# List of identifiers of known bug fixes present in this build.
define ZMK.BugFixes
zmk-issue-80
endef
zmk-0.5.1/zmk/AllClean.mk 0000664 0001750 0001750 00000001434 14027615611 013640 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
AllClean.Variables=
define AllClean.Template
all:: $1
clean::
$$(call Silent.Say,RM,$1)
$$(Silent.Command)rm -f $1
endef
zmk-0.5.1/zmk/ClangAnalyzer.mk 0000664 0001750 0001750 00000003304 14027615611 014715 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
# Sources are not re-defined with := so that they can expand lazily.
ClangAnalyzer.Sources ?= $(error define ClangAnalyzer.Sources - the list of source files to analyze with clang-analyzer/scan-build)
# NOTE: Strip out the out-of-tree-source-path so that all the $1.sources (note
# the lower-case) variables use source-relative paths. This is important when
# we want to derive object paths using source paths (same file with .o
# extension replaced but rooted at the build tree, not the source tree). When
# ZMK needs to support generated source files this should be changed.
ClangAnalyzer.sources = $(patsubst $(ZMK.OutOfTreeSourcePath)%,%,$(ClangAnalyzer.Sources))
ClangAnalyzer.Options ?=
# If we have scan-build then run it during static checks.
ifneq (,$(shell command -v scan-build 2>/dev/null))
static-check:: static-check-clang-analyzer
endif
.PHONY: static-check-clang-analyzer
static-check-clang-analyzer: $(ClangAnalyzer.sources)
$(call Silent.Say,CLANG-ANALYZER)
$(Silent.Command)scan-build $(ClangAnalyzer.Options) $(MAKE) ZMK.NoBanner=1 -B
zmk-0.5.1/zmk/ClangTidy.mk 0000664 0001750 0001750 00000003267 14027615611 014051 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
# Sources are not re-defined with := so that they can expand lazily.
ClangTidy.Sources ?= $(error define ClangTidy.Sources - the list of source files to analyze with ClangTidy)
# NOTE: Strip out the out-of-tree-source-path so that all the $1.sources (note
# the lower-case) variables use source-relative paths. This is important when
# we want to derive object paths using source paths (same file with .o
# extension replaced but rooted at the build tree, not the source tree). When
# ZMK needs to support generated source files this should be changed.
ClangTidy.sources = $(patsubst $(ZMK.OutOfTreeSourcePath)%,%,$(ClangTidy.Sources))
ClangTidy.Options ?=
# If we have cppcheck then run it during static checks.
ifneq (,$(shell command -v clang-tidy 2>/dev/null))
static-check:: static-check-clang-tidy
endif
static-check:: static-check-clang-tidy
.PHONY: static-check-clang-tidy
static-check-clang-tidy: $(ClangTidy.sources)
$(call Silent.Say,CLANG-TIDY)
$(Silent.Command)clang-tidy $(ClangTidy.Options) $^$(if $(CPPFLAGS), -- $(CPPFLAGS))
zmk-0.5.1/zmk/Configure.mk 0000664 0001750 0001750 00000046143 14064675234 014124 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
# Is zmk debugging enabled for this module?
Configure.debug ?= $(findstring configure,$(DEBUG))
# Configuration system defaults, also changed by config.$(Project.Name).mk
Configure.HostArchTriplet ?=
Configure.BuildArchTriplet ?=
Configure.TargetArchTriplet ?=
Configure.SysRoot ?=
Configure.DependencyTracking ?= yes
Configure.MaintainerMode ?= yes
Configure.SilentRules ?=
Configure.StaticLibraries ?= yes
Configure.DynamicLibraries ?= yes
Configure.ProgramPrefix ?=
Configure.ProgramSuffix ?=
Configure.ProgramTransformName ?=
Configure.Configured ?=
Configure.Options ?=
# Include optional, generated makefile from the configuration system.
# This makefile can only set one of the variables listed above. The name
# of the makefile is unique to the project. This prevents make from
# traversing PATH and, by accident, including this file from unexpected
# location. One place where this happens is zmk test suite.
ifneq (,$(Project.Name))
-include config.$(Project.Name).mk
# Those are copied from z.mk and need to be in sync.
ifneq ($(ZMK.SrcDir),.)
ZMK.IsOutOfTreeBuild = yes
ZMK.OutOfTreeSourcePath = $(ZMK.SrcDir)/
VPATH = $(ZMK.SrcDir)
else
ZMK.IsOutOfTreeBuild =
ZMK.OutOfTreeSourcePath =
endif
$(if $(Configure.debug),$(foreach v,ZMK.SrcDir ZMK.IsOutOfTreeBuild ZMK.OutOfTreeSourcePath,$(info DEBUG: $v=$($v))))
endif
# Enable silent rules if configured.
ifneq (,$(Configure.Configured))
override Silent.Active = $(Configure.SilentRules)
endif
$(if $(Configure.debug),$(foreach v,$(filter Configure.%,$(.VARIABLES)),$(info DEBUG: $v=$($v))))
ifneq ($(Project.Name),)
# ZMK provides a custom configuration script, this is is the full text
define Configure.script
#!/bin/sh
# Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
# This script was automatically generated by zmk version $(ZMK.Version)
# for the $(Project.Name) project. Executing this script creates a
# configuration file called config.$(Project.Name).mk which influences the
# build process of $(Project.Name).
while [ "$$#" -ge 1 ]; do
case "$$1" in
-h|--help)
echo "Usage: ./configure [OPTIONS]"
echo
echo "Compilation options:"
echo " --build=GNU_TRIPLET Describe the build machine with the given GNU_TRIPLET"
echo " --host=GNU_TRIPLET Describe the host machine with the given GNU_TRIPLET"
echo " --target=GNU_TRIPLET Describe the target machine with the given GNU_TRIPLET"
echo " --enable-dependency-tracking"
echo " Track dependencies between files (implicit)"
echo " --disable-dependency-tracking"
echo " Do not generate or use dependency data during builds"
echo " --enable-maintainer-mode Enable maintainer mode (implicit)"
echo " --disable-maintainer-mode Disable maintainer mode"
echo " --enable-static Enable static libraries"
echo " --disable-static Disable static libraries"
echo " --enable-dynamic Enable dynamic or shared libraries"
echo " --disable-dynamic Disable dynamic or shared libraries"
echo
echo "Autotools compatibility options"
echo " --with-libtool-sysroot=DIR Set the compiler sysroot to DIR"
echo
echo "Build-time directory selection:"
echo " --prefix=PREFIX Set prefix for all directories to PREFIX"
echo " --exec-prefix=PREFIX Set prefix for libraries and programs to PREFIX"
echo " --exec_prefix=PREFIX Alternate spelling --exec-prefix"
echo
echo " --bindir=DIR Install user programs to DIR"
echo " --sbindir=DIR Install super-user programs to DIR"
echo " --libdir=DIR Install runtime and development libraries to DIR"
echo " --libexecdir=DIR Install library-internal programs to DIR"
echo " --includedir=DIR Install development header files to DIR"
echo " --oldincludedir=DIR For compatibility with autotools, ignored"
echo " --mandir=DIR Install manual pages to DIR"
echo " --infodir=DIR Install GNU info pages to DIR"
echo " --sysconfdir=DIR Install system configuration files to DIR"
echo " --datadir=DIR Install read-only data files to DIR"
echo
echo " --localstatedir=DIR Store persistent state specific to a machine in DIR"
echo " --runstatedir=DIR Store ephemeral state specific to a machine in DIR"
echo " --sharedstatedir=DIR Store state shared across machines in DIR"
echo
echo "Options for altering program names:"
echo " --program-prefix=PREFIX Put PREFIX before installed program names"
echo " --program-suffix=SUFFIX Put SUFFIX after installed program names"
echo " --program-transform-name=PROGRAM"
echo " Use sed PROGRAM to transform installed program names"
echo
echo "Miscellaneous options:"
echo " --enable-option-checking Report unrecognized configuration options (implicit)"
echo " --disable-option-checking Ignore unrecognized configuration options"
echo " --enable-silent-rules Do not display commands while building"
echo " --disable-silent-rules Display commands while building (implicit)"
echo
echo "Memorized environment variables:"
echo " CC Name of the C compiler"
echo " CXX Name of the C++ compiler"
echo " CFLAGS Options for the C compiler"
echo " CXXFLAGS Options for the C++ compiler"
echo " CPPFLAGS Options for the preprocessor"
echo " LDFLAGS Options for the linker"
exit 0
;;
--version)
echo "z.mk configure script version $(ZMK.Version)"
exit 0
;;
*)
break
;;
esac
done
# Given key=value or key="value value", print the value
rhs() {
echo "$$*" | cut -d '=' -f 2- | sed -e 's/^"//' -e 's/"$$//'
}
configureOptions="$$*"
srcdir="$$(dirname "$$0")"
while [ "$$#" -ge 1 ]; do
case "$$1" in
--build=*) buildArchTriplet="$$(rhs "$$1")" && shift ;;
--host=*) hostArchTriplet="$$(rhs "$$1")" && shift ;;
--target=*) targetArchTriplet="$$(rhs "$$1")" && shift ;;
--with-libtool-sysroot=*) sysRoot="$$(rhs "$$1")" && shift ;;
--enable-dependency-tracking) dependencyTracking=yes && shift ;;
--disable-dependency-tracking) dependencyTracking=no && shift ;;
--enable-maintainer-mode) maintainerMode=yes && shift ;;
--disable-maintainer-mode) maintainerMode=no && shift ;;
--enable-silent-rules) silentRules=yes && shift ;;
--disable-silent-rules) silentRules=no && shift ;;
--enable-option-checking) disableOptionChecking=no && shift ;;
--disable-option-checking) disableOptionChecking=yes && shift ;;
--enable-static) staticLibraries=yes && shift ;;
--disable-static) staticLibraries=no && shift ;;
--enable-dynamic) dynamicLibraries=yes && shift ;;
--disable-dynamic) dynamicLibraries=no && shift ;;
--program-prefix=*) programPrefix="$$(rhs "$$1")" && shift ;;
--program-suffix=*) programSuffix="$$(rhs "$$1")" && shift ;;
--program-transform-name=*) programTransformName="$$(rhs "$$1")" && shift ;;
--exec-prefix=*|--exec_prefix=*)exec_prefix="$$(rhs "$$1")" && shift ;;
--prefix=*) prefix="$$(rhs "$$1")" && shift ;;
--bindir=*) bindir="$$(rhs "$$1")" && shift ;;
--sbindir=*) sbindir="$$(rhs "$$1")" && shift ;;
--libdir=*) libdir="$$(rhs "$$1")" && shift ;;
--libexecdir=*) libexecdir="$$(rhs "$$1")" && shift ;;
--datadir=*) datadir="$$(rhs "$$1")" && shift ;;
--includedir=*) includedir="$$(rhs "$$1")" && shift ;;
--oldincludedir=*) shift ;; # ignored for compatibility
--infodir=*) infodir="$$(rhs "$$1")" && shift ;;
--mandir=*) mandir="$$(rhs "$$1")" && shift ;;
--sysconfdir=*) sysconfdir="$$(rhs "$$1")" && shift ;;
--localstatedir=*) localstatedir="$$(rhs "$$1")" && shift ;;
--runstatedir=*) runstatedir="$$(rhs "$$1")" && shift ;;
--sharedstatedir=*) sharedstatedir="$$(rhs "$$1")" && shift ;;
CC=*) CC="$$(rhs "$$1")" && shift ;;
CXX=*) CXX="$$(rhs "$$1")" && shift ;;
CFLAGS=*) CFLAGS="$$(rhs "$$1")" && shift ;;
CXXFLAGS=*) CXXFLAGS="$$(rhs "$$1")" && shift ;;
OBJCFLAGS=*) OBJCFLAGS="$$(rhs "$$1")" && shift ;;
OBJCXXFLAGS=*) OBJCXXFLAGS="$$(rhs "$$1")" && shift ;;
CPPFLAGS=*) CPPFLAGS="$$(rhs "$$1")" && shift ;;
LDFLAGS=*) LDFLAGS="$$(rhs "$$1")" && shift ;;
ZMK.SrcDir=*) srcdir="$$(rhs "$$1")" && shift ;;
*)
if [ "$${disableOptionChecking:-}" != yes ]; then
echo "configure: unknown option $$1" >&2
exit 1
fi
shift
;;
esac
done
{
echo "# Generated by zmk configuration script version $(ZMK.Version)"
echo "# Invoked as: $$srcdir/configure $$configureOptions"
echo
echo "# Location of the source code."
echo "ZMK.SrcDir=$$srcdir"
echo
echo "# Build and host architecture triplets."
echo "# Note that those impact compiler selection unless CC and CXX are overridden."
test -n "$${buildArchTriplet:-}" && echo "Configure.BuildArchTriplet=$$buildArchTriplet" || echo "# Configure.BuildArchTriplet was not specified."
test -n "$${hostArchTriplet:-}" && echo "Configure.HostArchTriplet=$$hostArchTriplet" || echo "# Configure.HostArchTriplet was not specified."
test -n "$${targetArchTriplet:-}" && echo "Configure.TargetArchTriplet=$$targetArchTriplet" || echo "# Configure.TargetArchTriplet was not specified."
test -n "$${sysRoot:-}" && echo "Configure.SysRoot=$$sysRoot" || echo "# Configure.SysRoot was not specified."
echo
echo "# Build-time configuration of application directories."
test -n "$${prefix:-}" && echo "prefix=$$prefix" || echo "# prefix was not specified."
test -n "$${exec_prefix:-}" && echo "exec_prefix=$$exec_prefix" || echo "# exec_prefix was not specified."
test -n "$${bindir:-}" && echo "bindir=$$bindir" || echo "# bindir was not specified."
test -n "$${sbindir:-}" && echo "sbindir=$$sbindir" || echo "# sbindir was not specified."
test -n "$${datadir:-}" && echo "datadir=$$datadir" || echo "# datadir was not specified."
test -n "$${includedir:-}" && echo "includedir=$$includedir" || echo "# includedir was not specified."
test -n "$${infodir:-}" && echo "infodir=$$infodir" || echo "# infodir was not specified."
test -n "$${libdir:-}" && echo "libdir=$$libdir" || echo "# libdir was not specified."
test -n "$${libexecdir:-}" && echo "libexecdir=$$libexecdir" || echo "# libexecdir was not specified."
test -n "$${localstatedir:-}" && echo "localstatedir=$$localstatedir" || echo "# localstatedir was not specified."
test -n "$${mandir:-}" && echo "mandir=$$mandir" || echo "# mandir was not specified."
test -n "$${runstatedir:-}" && echo "runstatedir=$$runstatedir" || echo "# runstatedir was not specified."
test -n "$${sharedstatedir:-}" && echo "sharedstatedir=$$sharedstatedir" || echo "# sharedstatedir was not specified."
test -n "$${sysconfdir:-}" && echo "sysconfdir=$$sysconfdir" || echo "# sysconfdir was not specified."
echo
echo "# Inherited environment variables and overrides."
test -n "$$CC" && echo "CC=$$CC" || echo "# CC was not specified."
test -n "$$CXX" && echo "CXX=$$CXX" || echo "# CXX was not specified."
test -n "$$CFLAGS" && echo "CFLAGS=$$CFLAGS" || echo "# CFLAGS was not specified."
test -n "$$CXXFLAGS" && echo "CXXFLAGS=$$CXXFLAGS" || echo "# CXXFLAGS was not specified."
test -n "$$OBJCFLAGS" && echo "OBJCFLAGS=$$OBJCFLAGS" || echo "# OBJCFLAGS was not specified."
test -n "$$OBJCXXFLAGS" && echo "OBJCXXFLAGS=$$OBJCXXFLAGS" || echo "# OBJCXXFLAGS was not specified."
test -n "$$CPPFLAGS" && echo "CPPFLAGS=$$CPPFLAGS" || echo "# CPPFLAGS was not specified."
test -n "$$LDFLAGS" && echo "LDFLAGS=$$LDFLAGS" || echo "# LDFLAGS was not specified."
echo
echo "# Track dependencies between objects and source and header files."
case "$${dependencyTracking:-implicit}" in
yes)
echo "Configure.DependencyTracking=yes"
;;
no)
echo "Configure.DependencyTracking="
;;
implicit)
echo "# Configure.DependencyTracking was not specified."
echo "# This feature is enabled by default."
;;
esac
echo
echo "# Additional options for package maintainers."
case "$${maintainerMode:-implicit}" in
yes)
echo "Configure.MaintainerMode=yes"
;;
no)
echo "Configure.MaintainerMode="
;;
implicit)
echo "# Configure.MaintainerMode was not specified."
echo "# This feature is enabled by default."
;;
esac
echo
echo "# Silence shell commands used by make."
case "$${silentRules:-implicit}" in
yes)
echo "Configure.SilentRules=yes"
;;
no)
echo "Configure.SilentRules="
;;
implicit)
echo "# Configure.SilentRules was not specified."
echo "# This feature is disabled by default."
;;
esac
echo "# Support for static libraries."
case "$${staticLibraries:-implicit}" in
yes)
echo "Configure.StaticLibraries=yes"
;;
no)
echo "Configure.StaticLibraries="
;;
implicit)
echo "# Configure.StaticLibraries was not specified."
echo "# This feature is enabled by default."
;;
esac
echo
echo "# Support for dynamic or shared libraries."
case "$${dynamicLibraries:-implicit}" in
yes)
echo "Configure.DynamicLibraries=yes"
;;
no)
echo "Configure.DynamicLibraries="
;;
implicit)
echo "# Configure.DynamicLibraries was not specified."
echo "# This feature is enabled by default, if supported."
;;
esac
echo
echo "# Program name customization options."
test -n "$${programPrefix:-}" && echo "Configure.ProgramPrefix=$$programPrefix" || echo "# Configure.ProgramPrefix was not specified."
test -n "$${programSuffix:-}" && echo "Configure.ProgramSuffix=$$programSuffix" || echo "# Configure.ProgramSuffix was not specified."
test -n "$${programTransformName:-}" && echo "Configure.ProgramTransformName=$$programTransformName" || echo "# Configure.ProgramTransformName was not specified."
echo
echo "# Remember that the configuration script was executed."
echo "Configure.Configured=yes"
echo "Configure.Options=$$configureOptions"
} >"$${ZMK_CONFIGURE_MAKEFILE:=config.$(Project.Name).mk}"
if [ ! -e Makefile ] && [ ! -e GNUmakefile ]; then
if [ -e "$$srcdir"/GNUmakefile ]; then
ln -s "$$srcdir"/GNUmakefile GNUmakefile
fi
if [ -e "$$srcdir"/Makefile ]; then
ln -s "$$srcdir"/Makefile Makefile
fi
fi
endef
# In maintainer mode the configure script is automatically updated.
ifeq ($(Configure.MaintainerMode),yes)
$(CURDIR)/configure configure: export ZMK_CONFIGURE_SCRIPT = $(Configure.script)
$(CURDIR)/configure configure: $(ZMK.Path)/z.mk $(wildcard $(ZMK.Path)/zmk/*.mk)
@echo "$${ZMK_CONFIGURE_SCRIPT}" >$@
$(call Silent.Say,GENERATE,$@)
$(Silent.Command)chmod +x $@
# In maintainer mode, re-configure in response to updates to the configuration script.
ifeq ($(Configure.Configured),yes)
config.$(Project.Name).mk: configure
$(call Silent.Say,CONFIGURE,$(sort $(Configure.Options) ZMK.SrcDir=$(ZMK.SrcDir)))
$(if Configure.SilentRules,,@echo "re-configuring, $< script is newer than $@")
$(Silent.Command)$(strip sh $< $(sort $(Configure.Options) ZMK.SrcDir=$(ZMK.SrcDir)))
# Enable silent rules if configured to do so.
override Silent.Active = $(Configure.SilentRules)
endif # !configured
endif # !maintainer mode
distclean::
$(call Silent.Say,RM,config.$(Project.Name).mk)
$(Silent.Command)rm -f config.$(Project.Name).mk
endif # !project name set
zmk-0.5.1/zmk/Coverity.mk 0000664 0001750 0001750 00000004424 14027615611 013773 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
Coverity.Sources ?= $(error define Coverity.Sources - the list of source files to analyze with Coverity)
Coverity.ProjectName ?= $(error define Coverity.ProjectName - the name of the project as defined on scan.coverity.com)
Coverity.Email ?= $(error define Coverity.Email - email address of the scan submitter)
Coverity.Token ?= $(error define Coverity.Token - project access token)
Coverity.ScanURL ?= https://scan.coverity.com/builds
.PHONY: upload-coverity-scan
upload-coverity-scan: cov-int.$(NAME)-$(VERSION).tar.gz
# Upload the tarball with the scan result.
curl \
--form token=$(Coverity.Token) \
--form email=$(Coverity.Email) \
--form file=@$< \
--form version="$(Project.Version)" \
--form description="Upload facilitated by zmk" \
$(Coverity.ScanURL)?project=$(subst /,%2F,$(Coverity.ProjectName))
clean::
$(call Silent.Say,RM,cov-int)
$(Silent.Command)rm -rf cov-int
$(call Silent.Say,RM,$(NAME)-$(VERSION)-coverity.tar.gz)
$(Silent.Command)rm -f cov-int.$(NAME)-$(VERSION).tar.gz
cov-int: $(Coverity.Sources) $(MAKEFILE_LIST)
$(call Silent.Say,COV-BUILD,$@)
$(Silent.Command)cov-build --dir $@ $(MAKE) -B
# NOTE: We verify that over 80% of compilation units are ready for analysis as
# otherwise coverity will reject the archive and the scan will fail.
cov-int.$(NAME)-$(VERSION).tar.gz: cov-int cov-int/build-log.txt
$(call Silent.Say,COV-INT-REJECT,$@)
$(Silent.Command)test "$$(tail cov-int/build-log.txt -n 3 | awk -e '/[[:digit:]] C\/C\+\+ compilation units \([[:digit:]]+%) are ready for analysis/ { gsub(/[()%]/, "", $$6); print $$6; }')" -gt 80
$(call Silent.Say,TAR,$@)
$(Silent.Command)tar zcf $@ $<
zmk-0.5.1/zmk/CppCheck.mk 0000664 0001750 0001750 00000003143 14027615611 013644 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
# Sources are not re-defined with := so that they can expand lazily.
CppCheck.Sources ?= $(error define CppCheck.Sources - the list of source files to analyze with CppCheck)
# NOTE: Strip out the out-of-tree-source-path so that all the $1.sources (note
# the lower-case) variables use source-relative paths. This is important when
# we want to derive object paths using source paths (same file with .o
# extension replaced but rooted at the build tree, not the source tree). When
# ZMK needs to support generated source files this should be changed.
CppCheck.sources = $(patsubst $(ZMK.OutOfTreeSourcePath)%,%,$(CppCheck.Sources))
CppCheck.Options ?= --quiet
# If we have cppcheck then run it during static checks.
ifneq (,$(shell command -v cppcheck 2>/dev/null))
static-check:: static-check-cppcheck
endif
.PHONY: static-check-cppcheck
static-check-cppcheck: $(CppCheck.sources)
$(call Silent.Say,CPPCHECK)
$(Silent.Command)cppcheck $(CppCheck.Options) $^
zmk-0.5.1/zmk/Directories.mk 0000664 0001750 0001750 00000004564 14027615611 014450 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
# Is zmk debugging enabled for this module?
Directories.debug ?= $(findstring directories,$(DEBUG))
# Installation prefix.
prefix ?= /usr/local
$(if $(Directories.debug),$(info DEBUG: prefix=$(prefix)))
exec_prefix ?= $(prefix)
# Relevant UNIX-y directories.
bindir ?= $(exec_prefix)/bin
sbindir ?= $(exec_prefix)/sbin
libexecdir ?= $(exec_prefix)/libexec
datarootdir ?= $(prefix)/share
datadir ?= $(datarootdir)
sysconfdir ?= $(prefix)/etc
sharedstatedir ?= $(prefix)/com
localstatedir ?= $(prefix)/var
runstatedir ?= $(localstatedir)/run
includedir ?= $(prefix)/include
infodir ?= $(datarootdir)info
libdir ?= $(exec_prefix)/lib
localedir ?= $(datarootdir)/locale
mandir ?= $(datarootdir)/man
man1dir ?= $(mandir)/man1
man2dir ?= $(mandir)/man2
man3dir ?= $(mandir)/man3
man4dir ?= $(mandir)/man4
man5dir ?= $(mandir)/man5
man6dir ?= $(mandir)/man6
man7dir ?= $(mandir)/man7
man8dir ?= $(mandir)/man8
man9dir ?= $(mandir)/man9
# List of standard directories. Those are created with a single rule below, and
# can be safely used as a order-only dependency.
Directories.POSIX = \
$(prefix) $(exec_prefix) $(bindir) $(sbindir) $(libexecdir) \
$(datarootdir) $(datadir) $(sysconfdir) $(sharedstatedir) \
$(localstatedir) $(runstatedir) $(includedir) \
$(infodir) $(libdir) $(localedir) $(mandir) $(man1dir) \
$(man2dir) $(man3dir) $(man4dir) $(man5dir) $(man6dir) $(man7dir) \
$(man8dir) $(man9dir)
# If Project.Name is defined, also define docdir.
ifneq ($(Project.Name),)
docdir ?= $(datarootdir)/doc/$(Project.Name)
Directories.POSIX += $(docdir)
endif
$(if $(Directories.debug),$(info DEBUG: Directories.POSIX=$(Directories.POSIX)))
# Provide implicit rules for all the well-known directories.
$(foreach d,$(Directories.POSIX),$(eval $(call ZMK.Expand,Directory,$d)))
zmk-0.5.1/zmk/Directory.mk 0000664 0001750 0001750 00000005773 14027615611 014143 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
Directory.debug ?= $(findstring directory,$(DEBUG))
# List of directories that need to be created and have corresponding rules.
# Those are automatically handled, on demand, by expanding the Directory
# template. That template handles order-only dependencies on the parent
# directory, so, for example, creating /usr/share/man/man5 automatically
# depends on /usr/share/man, and so on.
Directory.known =
# Define DESTDIR to an empty value so that make --warn-undefined-variables
# does not complain about it.
ifeq ($(origin DESTDIR),undefined)
DESTDIR ?=
else
$(DESTDIR):
$(call Silent.Say,MKDIR,$@)
$(Silent.Command)mkdir -p $@
# Warn if DESTDIR is defined in a makefile. This is probably a mistake.
ifeq ($(origin DESTDIR),file)
$(warning DESTDIR should be set only through environment variable, not in a makefile)
endif
endif
$(if $(Directory.debug),$(info DEBUG: DESTDIR=$(DESTDIR)))
# Plain directory. This template is used by other parts of ZMK.
Directory.Variables=
define Directory.Template
ifneq ($1,/)
$1.cleaned=$$(patsubst %/,%,$1)
else
$1.cleaned=$1
endif
ifneq ($$($1.cleaned),.)
ifneq ($$($1.cleaned),/)
ifeq (,$$(filter $$($1.cleaned),$$(Directory.known)))
$1.parentDir = $$(patsubst %/,%,$$(dir $$($1.cleaned)))
ifneq (,$$($1.parentDir))
ifeq (,$$(filter $$($1.parentDir),$$(Directory.known)))
$$(eval $$(call ZMK.Expand,Directory,$$($1.parentDir)))
endif # !parent known
endif # !parent empty
Directory.known += $$($1.cleaned)
ifeq (/,$$(patsubst /%,/,$$($1.cleaned)))
# Absolute directories respect DESTDIR
$$(if $$(Directory.debug),$$(info DEBUG: absolute directory $$($1.cleaned)$$(if $$(DESTDIR), with prefixed DESTDIR=$$(DESTDIR))))
$$(DESTDIR)$$($1.cleaned): | $$(DESTDIR)$$($1.parentDir)
$$(call Silent.Say,MKDIR,$$@)
$$(Silent.Command)install -d $$@
ifneq ($1,$$($1.cleaned))
# Unclean directory path (with trailing slash) order-depends on the clean directory path
$$(if $$(Directory.debug),$$(info DEBUG: absolute unclean directory $1 corresponding to $$($1.cleaned)$$(if $$(DESTDIR), with prefixed DESTDIR=$$(DESTDIR))))
$$(DESTDIR)$1: | $$(DESTDIR)$$($1.cleaned)
endif
else
# Relative directories do not observe DESTDIR
$$(if $$(Directory.debug),$$(info DEBUG: relative directory $$($1.cleaned)))
$$($1.cleaned): | $$($1.parentDir)
$$(call Silent.Say,MKDIR,$$@)
$$(Silent.Command)install -d $$@
endif # !absolute
endif # !known
endif # !.
endif # !/
endef
zmk-0.5.1/zmk/GitVersion.mk 0000664 0001750 0001750 00000006204 14027615611 014256 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
# Craft a better version if we have Git.
GitVersion.debug ?= $(findstring version,$(DEBUG))
GitVersion.versionFilePresent = $(if $(wildcard $(ZMK.SrcDir)/.version),yes)
GitVersion.gitAvailable ?= $(if $(shell command -v git 2>/dev/null),yes)
GitVersion.gitMetaDataPresent ?= $(if $(wildcard $(ZMK.SrcDir)/.git),yes)
GitVersion.versionFromMakefile := $(strip $(VERSION))
GitVersion.versionFromFile =
GitVersion.versionFromGit =
GitVersion.Active =
GitVersion.Origin =
ifeq (yes,$(GitVersion.versionFilePresent))
# Note that we never generate this file from any rule in zmk!
# If the source tree contains the .version file then it is authoritative.
GitVersion.versionFromFile:=$(shell cat $(ZMK.SrcDir)/.version 2>/dev/null)
GitVersion.Origin = file
else
ifeq (yes,$(and $(GitVersion.gitAvailable),$(GitVersion.gitMetaDataPresent)))
# If we have the git program and the .git directory then we can also ask git.
GitVersion.versionFromGit=$(shell GIT_DIR=$(ZMK.SrcDir)/.git git describe --abbrev=10 --tags 2>/dev/null | sed -e 's/^v//')
GitVersion.Origin = git
ifneq (,$(value CI))
# If we are in CI and git version was empty then perhaps this is a shallow clone?
ifeq (,$(GitVersion.versionFromGit))
$(error zmk cannot compute project version from git, did the CI system use a shallow clone?))
endif # ! git version
endif # ! CI
endif # version from git
endif # !version from version file
# If we have a version from git, offer a rule that writes it to the source
# tree. This file is picked up by the Tarball.Src module and internally renamed
# to .version inside the archive. When we see the .version file we do not look
# for git information anymore, as it may no longer be the "same" git history.
ifneq (,$(GitVersion.versionFromGit))
$(ZMK.SrcDir)/.version-from-git: $(ZMK.SrcDir)/.git
$(call Silent.Say,GIT-VERSION,$@)
$(Silent.Command)echo $(GitVersion.versionFromGit) >$@
endif
# Set the new effective VERSION.
VERSION=$(or $(GitVersion.versionFromFile),$(GitVersion.versionFromGit),$(GitVersion.versionFromMakefile))
# If the effective version is different from the version in the makefile then
# set the active flag. This information is used by the Tarball.Src module.
ifneq ($(VERSION),$(GitVersion.versionFromMakefile))
GitVersion.Active = yes
endif
$(if $(GitVersion.debug),$(foreach v,versionFilePresent gitAvailable gitMetaDataPresent versionFromMakefile versionFromFile versionFromGit Active,$(info DEBUG: GitVersion.$v=$(GitVersion.$v))))
$(if $(GitVersion.debug),$(info DEBUG: effective VERSION=$(VERSION)))
zmk-0.5.1/zmk/Header.mk 0000664 0001750 0001750 00000001474 14027615611 013361 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Directories))
Header.Variables=
define Header.Template
$1.InstallDir ?= $$(includedir)
$1.InstallMode = 0644
$$(eval $$(call ZMK.Expand,InstallUninstall,$1))
endef
zmk-0.5.1/zmk/HeaderGroup.mk 0000664 0001750 0001750 00000002752 14027615611 014376 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Directories))
# $1 is the header group name
# $2 is the header file (path)name
HeaderGroup.Variables=Headers InstallDir InstallMode
define HeaderGroup.Template
# Headers are not re-defined with := so that they can expand lazily.
$1.Headers ?= $$(error define $1.Headers - the list of header files to install)
# NOTE: Strip out the out-of-tree-source-path so that all the $1.headers (note
# the lower-case) variables use source-relative paths.
$1.headers = $$(patsubst $$(ZMK.OutOfTreeSourcePath)%,%,$$($1.Headers))
$1.InstallDir ?= $$(includedir)
$1.InstallMode = 0644
# This is how to compile each specific source file.
$$(foreach h,$$($1.headers),$$(eval $$h.InstallDir ?= $$($1.InstallDir)))
$$(foreach h,$$($1.headers),$$(eval $$h.InstallMode ?= $$($1.InstallMode)))
$$(foreach h,$$($1.headers),$$(eval $$(call ZMK.Expand,Header,$$h)))
endef
zmk-0.5.1/zmk/InstallUninstall.mk 0000664 0001750 0001750 00000003366 14027615611 015473 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
$(eval $(call ZMK.Import,Directories))
# A file that gets installed to a desired location. The location can be set
# using the .InstallDir instance variable. The special value of noinst prevents
# installation. This template is used by other parts of ZMK, to install
# components they produce.
InstallUninstall.Variables=InstallDir InstallName InstallMode
define InstallUninstall.Template
$1.InstallDir ?= $$(error define $1.InstallDir - the destination directory, or noinst to skip installation)
$1.InstallMode ?= 0644
$1.InstallName ?= $$(notdir $1)
# Unless we don't want to install the file, look below.
ifneq ($$($1.InstallDir),noinst)
install:: $$(DESTDIR)$$($1.InstallDir)/$$($1.InstallName)
uninstall::
$$(call Silent.Say,RM,$$($1.InstallDir)/$$($1.InstallName))
$$(Silent.Command)rm -f $$(DESTDIR)$$($1.InstallDir)/$$($1.InstallName)
$$(eval $$(call ZMK.Expand,Directory,$$($1.InstallDir)))
$$(DESTDIR)$$($1.InstallDir)/$$($1.InstallName): $1 | $$(DESTDIR)$$($1.InstallDir)
$$(call Silent.Say,INSTALL,$$@)
$$(Silent.Command)$$(strip install -m $$($1.InstallMode) $$^ $$@)
endif # noinst
endef
zmk-0.5.1/zmk/Library.A.mk 0000664 0001750 0001750 00000002470 14027615611 013751 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
$(eval $(call ZMK.Import,Directories))
$(eval $(call ZMK.Import,Toolchain))
Library.A.Variables=Sources Objects
define Library.A.Template
ifneq ($$(suffix $1),.a)
$$(error library name $1 must end with ".a")
endif
ifeq ($(Configure.StaticLibraries),yes)
# Compile library objects.
$$(eval $$(call ZMK.Expand,ObjectGroup,$1))
# Create library archive.
$1: $$($1.Objects)
$$(call Silent.Say,AR,$$@)
$$(Silent.Command)$$(AR) $$(ARFLAGS) $$@ $$^
# Install library archive.
$1.InstallDir ?= $$(libdir)
$$(eval $$(call ZMK.Expand,InstallUninstall,$1))
# React to "all" and "clean".
$$(eval $$(call ZMK.Expand,AllClean,$1))
endif # Configure.StaticLibraries
endef
zmk-0.5.1/zmk/Library.DyLib.mk 0000664 0001750 0001750 00000004664 14027615611 014603 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
$(eval $(call ZMK.Import,Directories))
$(eval $(call ZMK.Import,Toolchain))
Library.DyLib.Variables=Sources ExportList
define Library.DyLib.Template
ifeq ($(Configure.DynamicLibraries),yes)
# Compile library objects.
$1: CFLAGS += -fpic
$1: CXXFLAGS += -fpic
$1: OBJCFLAGS += -fpic
$$(eval $$(call ZMK.Expand,ObjectGroup,$1))
$1.alias ?= $$(word 1,$$(subst ., ,$1)).dylib
# $1.SoName does not exist for Mach-O
$1.ExportList ?= $$(warning should define $1.ExportList)
# Common dynamic/shared library meta-data.
# We are building a dynamic library.
$1: LDFLAGS += -dynamiclib
# Provide current and compatibility version
# TODO: this is preliminary, implement the real thing
$1: LDFLAGS += -compatibility_version 1.0 -current_version 1.0
# Symbol export control
ifneq (,$$($1.ExportList))
# If we have precise information about symbol export then switch default symbol
# visibility to hidden and use the explicit list to control public symbols.
$1: $$($1.ExportList)
$1: LDFLAGS += -fvisibility=hidden -exported_symbols_list=$$($1.ExportList)
endif # !symbol export control
# Link library objects.
$1: $$($1.Objects)
$$(call Silent.Say,$$($1.SuggestedLinkerSymbol),$$@)
$$(Silent.Command)$$(strip $$(if $$($1.ObjectsObjC),$$(LINK.m),$$(if $$($1.ObjectsCxx),$$(LINK.cc),$$(LINK.o))) $$(if $$(Toolchain.SysRoot),--sysroot=$$(Toolchain.SysRoot)) -o $$@ $$(filter %.o,$$^) $$(LDLIBS))
# Install library binary.
$1.InstallDir ?= $$(libdir)
$$(eval $$(call ZMK.Expand,InstallUninstall,$1))
# React to "all" and "clean".
$$(eval $$(call ZMK.Expand,AllClean,$1))
# Create symlink (alias) to the versioned library.
ifneq ($1,$$($1.alias))
$$($1.alias).InstallDir ?= $$($1.InstallDir)
$$($1.alias).SymlinkTarget = $1
$$(eval $$(call ZMK.Expand,Symlink,$$($1.alias)))
endif
endif # Configure.DynamicLibraries
endef
zmk-0.5.1/zmk/Library.So.mk 0000664 0001750 0001750 00000005474 14027615611 014161 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
$(eval $(call ZMK.Import,Directories))
$(eval $(call ZMK.Import,Toolchain))
Library.So.Variables=Sources SoName InstallDir VersionScript
define Library.So.Template
ifeq ($(Configure.DynamicLibraries),yes)
# Compile library objects.
$1: CFLAGS += -fpic
$1: CXXFLAGS += -fpic
$1: OBJCFLAGS += -fpic
$$(eval $$(call ZMK.Expand,ObjectGroup,$1))
$1.alias ?= $$(word 1,$$(subst ., ,$1)).so
$1.SoName ?= $1
ifneq ($1,$$($1.alias))
$1.VersionScript ?= $$(warning define $1.VersionScript - the name of a ELF symbol map)
else
$1.VersionScript ?=
endif
# Common dynamic/shared library meta-data.
# We are building a shared library.
$1: LDFLAGS += -shared
# Pass -soname to the linker, if we have a version handy.
$1: LDFLAGS += $(if $$($1.SoName),-Wl$$(ZMK.comma)-soname=$$($1.SoName))
# Watcom doesn't build dynamic libraries.
ifneq (,$$(Toolchain.$$(if $$($1.ObjectsObjC),CC,$$(if $$($1.ObjectsCxx),CXX,CC)).IsWatcom))
$$(error Watcom does not support shared libraries))
endif # watcom
# Symbol export control
ifneq (,$$($1.VersionScript))
# Tcc does not support version scripts.
ifeq (,$$(Toolchain.$$(if $$($1.ObjectsObjC),CC,$$(if $$($1.ObjectsCxx),CXX,CC)).IsTcc))
# If we have precise information about symbol export then switch default symbol
# visibility to hidden and use the explicit list to control public symbols.
$1: $$($1.VersionScript)
$1: LDFLAGS += -fvisibility=hidden -Wl,--version-script=$$($1.VersionScript)
endif # !tcc
endif # !symbol export control
# Link library objects.
$1: $$($1.Objects)
$$(call Silent.Say,$$($1.SuggestedLinkerSymbol),$$@)
$$(Silent.Command)$$(strip $$(if $$($1.ObjectsObjC),$$(LINK.m),$$(if $$($1.ObjectsCxx),$$(LINK.cc),$$(LINK.o))) $$(if $$(Toolchain.SysRoot),--sysroot=$$(Toolchain.SysRoot)) -o $$@ $$(filter %.o,$$^) $$(LDLIBS))
# Install library binary.
$1.InstallDir ?= $$(libdir)
$$(eval $$(call ZMK.Expand,InstallUninstall,$1))
# React to "all" and "clean".
$$(eval $$(call ZMK.Expand,AllClean,$1))
# Create symlink (alias) to the versioned library.
ifneq ($1,$$($1.alias))
$$($1.alias).InstallDir ?= $$($1.InstallDir)
$$($1.alias).SymlinkTarget = $1
$$(eval $$(call ZMK.Expand,Symlink,$$($1.alias)))
endif
endif # Configure.DynamicLibraries
endef
zmk-0.5.1/zmk/ManPage.mk 0000664 0001750 0001750 00000004013 14027615611 013471 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
$(eval $(call ZMK.Import,Directories))
# ManPage.isAvailable expand to "yes" when the man command is available.
ManPage.isAvailable ?= $(if $(shell command -v man 2>/dev/null),yes)
# ManPage.isGNU expands to "yes" when man is the GNU man implementation, with various additional options over BSD.
ManPage.isGNU ?= $(if $(and $(ManPage.isAvailable),$(shell man --help 2>&1 | grep -F -- --warning)),yes)
# GNU man can be used to perform rudimentary validation of manual pages.
ifeq ($(ManPage.isGNU),yes)
# Set of arcane options that turn GNU troff into a validator.
%.man-check: ManPage.manOpts += --warnings=all
%.man-check: ManPage.manOpts += --encoding=UTF-8
%.man-check: ManPage.manOpts += --troff-device=utf8
%.man-check: ManPage.manOpts += --ditroff
%.man-check: ManPage.manOpts += --local-file
.PHONY: %.man-check
%.man-check: %
$(call Silent.Say,MAN,$<)
$(Silent.Command)LC_ALL=C MANROFFSEQ= MANWIDTH=80 man $(ManPage.manOpts) $< 2>&1 >/dev/null | sed -e 's@tbl:@$*@g'
static-check-manpages::
static-check:: static-check-manpages
endif
ManPage.Variables=Section
define ManPage.Template
$1.Section ?= $$(patsubst .%,%,$$(suffix $1))
$1.InstallDir = $$(if $$(man$$($1.Section)dir),$$(man$$($1.Section)dir),$$(error unknown section $$($1.Section)))
$1.InstallMode = 0644
$$(eval $$(call ZMK.Expand,InstallUninstall,$1))
static-check-manpages:: $1.man-check
endef
zmk-0.5.1/zmk/OS.mk 0000664 0001750 0001750 00000003143 14027615611 012505 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
# Is zmk debugging enabled for this module?
OS.debug ?= $(findstring os,$(DEBUG))
# OS.Kernel is the name of the operating system kernel.
# There are multiple possibilities but most common include
# Linux, Darwin and Windows_NT.
ifeq ($(origin OS),environment)
OS.Kernel = $(findstring $(OS),Windows_NT)
else
OS.Kernel := $(shell uname -s)
endif
# Format of the executable programs used by the OS.
# In general all systems fall into one of the three
# possible formats: ELF, Mach-O, PE and MZ (though unlikely).
# Many UNIX systems, apart from Darwin, use elf.
ifneq (,$(findstring $(OS.Kernel),Linux FreeBSD NetBSD OpenBSD GNU GNU/kFreeBSD SunOS Haiku))
OS.ImageFormat = ELF
endif
ifeq ($(OS.Kernel),Darwin)
OS.ImageFormat = Mach-O
endif
ifeq ($(OS.Kernel),Windows_NT)
OS.ImageFormat = PE
endif
OS.ImageFormat ?= $(error unsupported operating system kernel $(OS.Kernel))
$(if $(OS.debug),$(info DEBUG: OS.Kernel=$(OS.Kernel)))
$(if $(OS.debug),$(info DEBUG: OS.ImageFormat=$(OS.ImageFormat)))
zmk-0.5.1/zmk/ObjectGroup.mk 0000664 0001750 0001750 00000010404 14046050767 014413 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
$(eval $(call ZMK.Import,Toolchain))
$(eval $(call ZMK.Import,OS))
# $1 is the object group name
# $2 is the source file (path)name
define ObjectGroup.COMPILE.c
$$(dir $2)$1-$$(basename $$(notdir $2)).o: $$(ZMK.OutOfTreeSourcePath)$2 | $$(patsubst %/,%,$$(CURDIR)/$$(dir $2))
$$(call Silent.Say,CC,$$@)
$$(Silent.Command)$$(strip $$(COMPILE.c) $$(if $$(Toolchain.SysRoot),--sysroot=$$(Toolchain.SysRoot)) -o $$@ $$<)
endef
define ObjectGroup.COMPILE.cc
$$(dir $2)$1-$$(basename $$(notdir $2)).o: $$(ZMK.OutOfTreeSourcePath)$2 | $$(patsubst %/,%,$$(CURDIR)/$$(dir $2))
$$(call Silent.Say,CXX,$$@)
$$(Silent.Command)$$(strip $$(COMPILE.cc) $$(if $$(Toolchain.SysRoot),--sysroot=$$(Toolchain.SysRoot)) -o $$@ $$<)
endef
define ObjectGroup.COMPILE.m
$$(dir $2)$1-$$(basename $$(notdir $2)).o: $$(ZMK.OutOfTreeSourcePath)$2 | $$(patsubst %/,%,$$(CURDIR)/$$(dir $2))
$$(call Silent.Say,OBJC,$$@)
$$(Silent.Command)$$(strip $$(COMPILE.m) $$(if $$(Toolchain.SysRoot),--sysroot=$$(Toolchain.SysRoot)) -o $$@ $$<)
endef
ObjectGroup.Variables=Sources Objects ObjectsC ObjectsCxx ObjectsObjC
define ObjectGroup.Template
# Sources are not re-defined with := so that they can expand lazily.
$1.Sources ?= $$(error define $1.Sources - the list of source files to compile)
# NOTE: Strip out the out-of-tree-source-path so that all the $1.sources (note
# the lower-case) variables use source-relative paths. This is important when
# we want to derive object paths using source paths (same file with .o
# extension replaced but rooted at the build tree, not the source tree). When
# ZMK needs to support generated source files this should be changed.
$1.sources = $$(patsubst $$(ZMK.OutOfTreeSourcePath)%,%,$$($1.Sources))
$1.sourcesC = $$(filter %.c,$$($1.sources))
$1.sourcesCxx = $$(filter %.cpp %.cxx %.cc,$$($1.sources))
$1.sourcesObjC = $$(filter %.m,$$($1.sources))
# Object files contain the object group name prepended to the file name and the extension replaced with .o
$1.ObjectsC ?= $$(foreach src,$$($1.sourcesC),$$(dir $$(src))$1-$$(basename $$(notdir $$(src))).o)
$1.ObjectsCxx ?= $$(foreach src,$$($1.sourcesCxx),$$(dir $$(src))$1-$$(basename $$(notdir $$(src))).o)
$1.ObjectsObjC ?= $$(foreach src,$$($1.sourcesObjC),$$(dir $$(src))$1-$$(basename $$(notdir $$(src))).o)
$1.Objects ?= $$(strip $$($1.ObjectsC) $$($1.ObjectsCxx) $$($1.ObjectsObjC))
# Suggested linger depends on the cardinality of various types of objects.
$1.SuggestedLinkerSymbol ?= $$(if $$($1.ObjectsObjC),OBJCLD,$$(if $$($1.ObjectsCxx),CXXLD,CCLD))
# Check if we have the required compiler.
$$(if $$(or $$($1.ObjectsC),$$($1.ObjectsObjC)),$$(if $$(Toolchain.CC.IsAvailable),,$$(error Building $1 requires a C compiler)))
$$(if $$($1.ObjectsCxx),$$(if $$(Toolchain.CXX.IsAvailable),,$$(error Building $1 requires a C++ compiler)))
# This is how to compile each specific source file.
$$(foreach src,$$($1.sourcesC),$$(eval $$(call ObjectGroup.COMPILE.c,$1,$$(src))))
$$(foreach src,$$($1.sourcesCxx),$$(eval $$(call ObjectGroup.COMPILE.cc,$1,$$(src))))
$$(foreach src,$$($1.sourcesObjC),$$(eval $$(call ObjectGroup.COMPILE.m,$1,$$(src))))
# Create all support directories for out-of-tree builds
$$(foreach d,$$(patsubst %/,%,$$(addprefix $$(CURDIR)/,$$(filter-out ./,$$(sort $$(dir $$($1.sources)))))),$$(eval $$(call ZMK.Expand,Directory,$$d)))
ifneq (,$$($1.Objects))
clean::
$$(call Silent.Say,RM,$$($1.Objects))
$$(Silent.Command)rm -f $$($1.Objects)
ifneq (,$$(Toolchain.DependencyTracking))
$$(call Silent.Say,RM,$$($1.Objects:.o=.d))
$$(Silent.Command)rm -f $$($1.Objects:.o=.d)
endif
ifneq (,$$(Toolchain.DependencyTracking))
-include $$($1.Objects:.o=.d)
endif
endif # !no objects
endef
zmk-0.5.1/zmk/PVS.mk 0000664 0001750 0001750 00000006214 14027615611 012636 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
# Sources are not re-defined with := so that they can expand lazily.
PVS.Sources ?= $(error define PVS.Sources - the list of source files to analyze with PVS Studio)
# NOTE: Strip out the out-of-tree-source-path so that all the $1.sources (note
# the lower-case) variables use source-relative paths. This is important when
# we want to derive object paths using source paths (same file with .o
# extension replaced but rooted at the build tree, not the source tree). When
# ZMK needs to support generated source files this should be changed.
PVS.sources = $(patsubst $(ZMK.OutOfTreeSourcePath)%,%,$(PVS.Sources))
PLOG_CONVERTER_FLAGS ?=
define PVS.PreProcess
$1.i: $$(ZMK.OutOfTreeSourcePath)$1 | $$(patsubst %/,%,$$(CURDIR)/$$(dir $1))
$$(call Silent.Say,CPP,$$@)
$$(Silent.Command)$$(strip $$(CPP) $$(CPPFLAGS) $$< -E $$(if $$(Toolchain.SysRoot),--sysroot=$$(Toolchain.SysRoot)) -o $$@)
endef
define PVS.Analyze
$1.PVS-Studio.log: $1.i ~/.config/PVS-Studio/PVS-Studio.lic | $$(ZMK.OutOfTreeSourcePath)$1
$$(call Silent.Say,PVS-STUDIO,$$@)
$$(Silent.Command)$$(strip pvs-studio \
--cfg $$(ZMK.OutOfTreeSourcePath).pvs-studio.cfg \
--i-file $$< \
--source-file $$(firstword $$|) \
--output-file $$@)
endef
# If we have pvs-studio then run it during static checks.
ifneq (,$(shell command -v pvs-studio 2>/dev/null))
static-check:: static-check-pvs
endif
.PHONY: static-check-pvs
static-check-pvs: $(addsuffix .PVS-Studio.log,$(PVS.sources))
$(call Silent.Say,PLOG-CONVERTER,$@)
$(Silent.Command)$(strip plog-converter \
--settings $(ZMK.OutOfTreeSourcePath).pvs-studio.cfg \
$(PLOG_CONVERTER_FLAGS) \
--srcRoot $(ZMK.SrcDir) \
--renderTypes errorfile $^ | srcdir=$(ZMK.SrcDir) abssrcdir=$(abspath $(ZMK.SrcDir)) awk -f $(ZMK.Path)/zmk/pvs-filter.awk)
$(foreach src,$(PVS.sources),$(eval $(call PVS.PreProcess,$(src))))
$(foreach src,$(PVS.sources),$(eval $(call PVS.Analyze,$(src))))
pvs-report: $(addsuffix .PVS-Studio.log,$(PVS.sources))
$(call Silent.Say,PLOG-CONVERTER,$@)
$(Silent.Command)$(strip plog-converter \
--settings $(ZMK.OutOfTreeSourcePath).pvs-studio.cfg \
$(PLOG_CONVERTER_FLAGS) \
--srcRoot $(ZMK.SrcDir) \
--projectName $(NAME) \
--projectVersion $(VERSION) \
--renderTypes fullhtml \
--output $@ \
$^)
clean::
$(call Silent.Say,RM,*.i)
$(Silent.Command)rm -f $(addsuffix .i,$(PVS.sources))
$(call Silent.Say,RM,*.PVS-Studio.log)
$(Silent.Command)rm -f $(addsuffix .PVS-Studio.log,$(PVS.sources))
$(call Silent.Say,RM,pvs-report)
$(Silent.Command)rm -rf pvs-report
zmk-0.5.1/zmk/Program.Test.mk 0000664 0001750 0001750 00000006412 14027615611 014513 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
$(eval $(call ZMK.Import,Directories))
$(eval $(call ZMK.Import,Toolchain))
$(eval $(call ZMK.Import,OS))
# xcrun is the helper for accessing toolchain programs on MacOS
# It is defined as empty for non-Darwin build environments.
xcrun ?=
ifeq ($(OS.Kernel),Darwin)
# MacOS uses xcrun helper for some toolchain binaries.
xcrun := xcrun
endif
clean::
$(call Silent.Say,RM,*.profdata *.profraw)
$(Silent.Command)rm -f *.profdata *.profraw
Program.Test.Variables=Sources SourcesCoverage InstallDir InstallMode
define Program.Test.Template
$1.SourcesCoverage ?= $$(error define $1.SourcesCoverage - the list of source files to include in coverage analysis)
$$(eval $$(call ZMK.Expand,Program,$1))
# If we are using gcc or clang, build with debugging symbols.
ifneq (,$$(or $$(Toolchain.IsGcc),$$(Toolchain.IsClang)))
$1$$(exe): CFLAGS += -g
endif
# If we are not cross-compiling, run the test program on "make check"
check:: $1$$(exe)
ifneq (,$$(Toolchain.IsCross))
@echo "not executing test program $$<$$(exe) when cross-compiling"
else
$$(call Silent.Say,EXEC,$$<)
$$(Silent.Command)./$$<
endif
# If we are not cross-compiling, and stars align, support coverage analysis.
ifeq (,$$(Toolchain.IsCross))
# Support coverage analysis when building with clang and supplied with llvm
# or when using xcrun.
ifneq (,$$(or $$(xcrun),$$(and $$(Toolchain.IsClang),$$(shell command -v llvm-cov 2>/dev/null),$$(shell command -v llvm-profdata 2>/dev/null))))
# Build test program with code coverage measurements and show them via "coverage" target.
$1$$(exe): CFLAGS += -fcoverage-mapping -fprofile-instr-generate
$1$$(exe): LDFLAGS += -fcoverage-mapping -fprofile-instr-generate
$1.profraw: %.profraw: %
$$(call Silent.Say,EXEC-TEST,$$^)
$$(Silent.Command)LLVM_PROFILE_FILE=$$@ ./$$^
$1.profdata: %.profdata: %.profraw
$$(call Silent.Say,LLVM-PROFDATA,$$@)
$$(Silent.Command)$$(strip $$(xcrun) llvm-profdata merge -sparse $$< -o $$@)
coverage:: $1.profdata
$$(call Silent.Say,LLVM-COV,$$<)
$$(Silent.Command)$$(strip $$(xcrun) llvm-cov show ./$1$$(exe) -instr-profile=$$< $$(addprefix $$(ZMK.SrcDir)/,$$($1.SourcesCoverage)))
.PHONY: coverage-todo
coverage-todo:: $1.profdata
$$(call Silent.Say,LLVM-COV,$$<)
$$(Silent.Command)$$(strip $$(xcrun) llvm-cov show ./$1$$(exe) -instr-profile=$$< -region-coverage-lt=100 $$(addprefix $$(ZMK.SrcDir)/,$$($1.SourcesCoverage)))
.PHONY: coverage-report
coverage-report:: $1.profdata
$$(call Silent.Say,LLVM-COV,$$<)
$$(Silent.Command)$$(strip $$(xcrun) llvm-cov report ./$1$$(exe) -instr-profile=$$< $$(addprefix $$(ZMK.SrcDir)/,$$($1.SourcesCoverage)))
endif # can use llvm-cov
endif # not-cross-compiling
endef
zmk-0.5.1/zmk/Program.mk 0000664 0001750 0001750 00000004041 14027615611 013571 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
$(eval $(call ZMK.Import,Directories))
$(eval $(call ZMK.Import,Toolchain))
$(eval $(call ZMK.Import,OS))
Program.Variables=Sources InstallDir InstallMode Linker
define Program.Template
# Compile program objects.
$$(eval $$(call ZMK.Expand,ObjectGroup,$1))
$1.Linker ?= $$(if $$($1.ObjectsObjC),$$(CC),$$(if $$($1.ObjectsCxx),$$(CXX),$$(CC)))
# Link program objects.
ifneq (,$$($1.ObjectsObjC))
$1$$(exe): LDLIBS += -lobjc
endif # no objective C objects
$1$$(exe): $$($1.Objects)
$$(call Silent.Say,$$($1.SuggestedLinkerSymbol),$$@)
$$(Silent.Command)$$(strip $$(if $$($1.ObjectsObjC),$$(LINK.m),$$(if $$($1.ObjectsCxx),$$(LINK.cc),$$(LINK.o))) $$(if $$(Toolchain.SysRoot),--sysroot=$$(Toolchain.SysRoot)) -o $$@ $$^ $$(LDLIBS))
# Install program binary.
$1.InstallDir ?= $$(bindir)
$1.InstallMode ?= 0755
ifneq (,$$(filter Configure,$$(ZMK.ImportedModules)))
$1.InstallName ?= $$(if $$(Configure.ProgramTransformName),$$(shell echo '$$(Configure.ProgramPrefix)$$(notdir $1)$$(Configure.ProgramSuffix)' | sed -e '$$(Configure.ProgramTransformName)'),$$(Configure.ProgramPrefix)$$(notdir $1)$$(Configure.ProgramSuffix))
$1$$(exe).InstallName ?= $$($1.InstallName)$$(exe)
endif
$1$$(exe).InstallDir ?= $$($1.InstallDir)
$1$$(exe).InstallMode ?= $$($1.InstallMode)
$$(eval $$(call ZMK.Expand,InstallUninstall,$1$$(exe)))
# React to "all" and "clean".
$$(eval $$(call ZMK.Expand,AllClean,$1$$(exe)))
endef
zmk-0.5.1/zmk/Script.mk 0000664 0001750 0001750 00000003307 14027615611 013432 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
$(eval $(call ZMK.Import,Directories))
ZMK.shellcheck ?= $(shell command -v shellcheck 2>/dev/null)
static-check-shellcheck:
ifneq (,$(ZMK.shellcheck))
$(call Silent.Say,SHELLCHECK,$^)
$(Silent.Command)$(ZMK.shellcheck) $^
else
@echo "ZMK: install shellcheck to analyze $^"
endif
static-check:: static-check-shellcheck
Script.Variables=Interpreter InstallDir InstallMode
define Script.Template
$1.InstallDir ?= $$(bindir)
$1.InstallMode ?= 0755
ifneq (,$$(filter Configure,$$(ZMK.ImportedModules)))
$1.InstallName ?= $$(if $$(Configure.ProgramTransformName),$$(shell echo '$$(Configure.ProgramPrefix)$$(notdir $1)$$(Configure.ProgramSuffix)' | sed -e '$$(Configure.ProgramTransformName)'),$$(Configure.ProgramPrefix)$$(notdir $1)$$(Configure.ProgramSuffix))
endif
$$(eval $$(call ZMK.Expand,InstallUninstall,$1))
$1.Interpreter ?= $$(if $$(suffix $1),$$(patsubst .%,%,$$(suffix $1)),$$(error define $1.Interpreter - the script interpreter name, sh, bash or other))
ifneq ($$(findstring $$($1.Interpreter),sh bash),)
static-check-shellcheck: $1
endif
endef
zmk-0.5.1/zmk/Silent.mk 0000664 0001750 0001750 00000002277 14027615611 013431 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
# Is zmk debugging enabled for this module?
Silent.Active?=
ifeq (,$(value ZMK.testing))
Silent.Command=$(if $(Silent.Active),@)
else
# ZMK is being tested, mainly, by running make -n and measuring the output.
# Make ignores the non-echo rule when -n is in effect. As such, to improve
# testing of silent rules, when zmk is being tested pretend all silent rules
# are commented-out shell commands. This can be readily verified by simple grep
# patterns.
Silent.Command=$(if $(Silent.Active),$(ZMK.hash))
endif
Silent.Say=$(if $(Silent.Active),@printf " %-16s %s\n" "$1" "$2")
zmk-0.5.1/zmk/Sparse.mk 0000664 0001750 0001750 00000003177 14027656726 013444 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
# Sources are not re-defined with := so that they can expand lazily.
Sparse.Sources ?= $(error define Sparse.Sources - the list of source files to analyze with clang-analyzer/scan-build)
# NOTE: Strip out the out-of-tree-source-path so that all the $1.sources (note
# the lower-case) variables use source-relative paths. This is important when
# we want to derive object paths using source paths (same file with .o
# extension replaced but rooted at the build tree, not the source tree). When
# ZMK needs to support generated source files this should be changed.
Sparse.sources = $(patsubst $(ZMK.OutOfTreeSourcePath)%,%,$(Sparse.Sources))
Sparse.Options ?= -Wsparse-all
# If we have cgcc then run it during static checks.
ifneq (,$(shell command -v cgcc 2>/dev/null))
static-check:: static-check-sparse
endif
.PHONY: static-check-sparse
static-check-sparse: $(src_to_analyze)
$(call Silent.Say,MAKE-SPARSE)
$(Silent.Command)CFLAGS="$(Sparse.Options)" $(MAKE) ZMK.NoBanner=1 CC=cgcc -B
zmk-0.5.1/zmk/Symlink.mk 0000664 0001750 0001750 00000004420 14064705643 013617 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
# Symbolic link. Gets installed to the desired location. The location can be
# set using the .InstallDir instance variable. The special value of noinst
# prevents installation. This template is used by other parts of ZMK, to
# install components they produce.
Symlink.Variables=SymlinkTarget InstallDir InstallName
define Symlink.Template
$1.InstallDir ?= $$(error define $1.InstallDir - the destination directory, or noinst to skip installation)
$1.SymlinkTarget ?= $$(error define $1.SymlinkTarget - the target of the symbolic link)
$1.InstallName ?= $$(notdir $1)
# Create the directory where the symbolic link is built in.
$$(eval $$(call ZMK.Expand,Directory,$$(dir $1)))
# Create the symbolic link in the build directory.
$1: | $$(patsubst %/,%,$$(dir $1))
$$(call Silent.Say,SYMLINK,$$@)
$$(Silent.Command)$$(strip ln -sf $$($1.SymlinkTarget) $$@)
# React to "all" and "clean" targets.
$$(eval $$(call ZMK.Expand,AllClean,$1))
# Unless we don't want to install the file, look below.
ifneq ($$($1.InstallDir),noinst)
# Create the directory where the symbolic link is installed to.
$$(eval $$(call ZMK.Expand,Directory,$$($1.InstallDir)))
# Create the symbolic link in the install directory.
$$(DESTDIR)$$($1.InstallDir)/$$($1.InstallName):| $$(DESTDIR)$$($1.InstallDir)
$$(call Silent.Say,SYMLINK,$$@)
$$(Silent.Command)$$(strip ln -sf $$($1.SymlinkTarget) $$@)
# React to "install" and "uninstall" targets.
install:: $$(DESTDIR)$$($1.InstallDir)/$$($1.InstallName)
uninstall::
$$(call Silent.Say,RM,$$($1.InstallDir)/$$($1.InstallName))
$$(Silent.Command)rm -f $$(DESTDIR)$$($1.InstallDir)/$$($1.InstallName)
endif # !noinst
endef
zmk-0.5.1/zmk/Tarball.Src.mk 0000664 0001750 0001750 00000014654 14027615611 014304 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
# XXX: those belong in other places but that's fine for now.
zmk.haveGPG?=$(if $(shell sh -c "command -v gpg"),yes)
zmk.haveGPGKeys?=$(if $(and $(zmk.haveGPG),$(wildcard $(HOME)/.gnupg/*),$(shell gpg --list-secret-keys)),yes)
zmk.isCI?=$(if $(value CI),yes)
zmk.isGitSnapshot?=$(if $(filter GitVersion,$(ZMK.ImportedModules)),$(if $(GitVersion.Active),yes))
%.asc: %
$(call Silent.Say,GPG-SIGN,$@)
$(Silent.Command)gpg --detach-sign --armor $<
# Allow preventing ZMK from ever being bundled.
ZMK.DoNotBundle ?= $(if $(value ZMK_DO_NOT_BUNDLE),yes)
Tarball.Src.Variables=Name Files Sign
define Tarball.Src.Template
$1.Name ?= $$(patsubst %.tar$$(suffix $1),%,$1)
$1.Files ?= $$(error define $1.Files - the list of files to include in the tarball)
ifeq ($$(ZMK.DoNotBundle),)
$1.Files += $$(addprefix $$(ZMK.Path)/,$$(ZMK.DistFiles))
# If the Configure module is imported then include the configure script.
ifneq (,$$(filter Configure,$$(ZMK.ImportedModules)))
$1.Files += $(CURDIR)/configure
endif
endif
# If we have a GPG keys, CI is not set and the tarball is not a snapshot, sign it.
$1.Sign ?= $$(and $$(zmk.haveGPG),$$(zmk.haveGPGKeys),$$(call ZMK.not,$$(zmk.isCI)),$$(call ZMK.not,$$(zmk.isCI)))
# If the GitVersion module is imported then attempt to insert version
# information into the release archive. There are two possible cases.
#
# 1) We may be in the directory still with git meta-data and history present,
# enough to compute the version. This case is signified by
# GitVersion.Origin=git. When this happens, the GitVersion module contains a
# rule for generating the file .version-from-git, which we can add to the
# source archive. The tar command will automatically rename that file to just
# .version.
#
# 2) We may be running without the git meta-data, for example after unpacking
# the release archive itself. In this case we typically have the .version file
# already so we should just preserve it.
ifneq (,$$(filter GitVersion,$$(ZMK.ImportedModules)))
ifeq (git,$$(GitVersion.Origin))
$1.Files += .version-from-git
endif
ifeq (file,$$(GitVersion.Origin))
$1.Files += .version
endif
endif
ifneq (,$$($1.Sign))
dist:: $1.asc
endif
distcheck:: distcheck-$1
.PHONY: distcheck-$1
distcheck-$1: ZMK.distCheckBase ?= $$(TMPDIR)/$1-distcheck
distcheck-$1: ZMK.absSrcdir ?= $$(abspath $$(ZMK.SrcDir))
distcheck-$1: ZMK.srcDirMakefile ?= $$(or $$(wildcard $$(abspath $$(ZMK.SrcDir)/GNUmakefile)),$$(wildcard $$(abspath $$(ZMK.SrcDir)/Makefile)))
distcheck-$1: | $$(TMPDIR)
# Prepare scratch space for distcheck.
if [ -d $$(ZMK.distCheckBase) ]; then chmod -R +w $$(ZMK.distCheckBase); fi
rm -rf $$(ZMK.distCheckBase)
mkdir -p $$(ZMK.distCheckBase)/tree
mkdir -p $$(ZMK.distCheckBase)/build
# Prepare a release archive $1 in a temporary directory.
$$(strip $$(MAKE) dist \
ZMK.SrcDir=$$(ZMK.absSrcdir)) \
-I $$(ZMK.absSrcdir) \
-C $$(ZMK.distCheckBase) \
-f $$(ZMK.srcDirMakefile)
# Unpack the release archive $1 to temporary directory.
tar -zxf $$(ZMK.distCheckBase)/$1 --strip-components=1 -C $$(ZMK.distCheckBase)/tree
# Make the source tree read-only for all out-of-tree checks.
chmod -R -w $$(ZMK.distCheckBase)/tree
ifneq (,$$(filter Configure,$$(ZMK.ImportedModules)))
# $1, can be configured for an out-of-tree build
(cd $$(ZMK.distCheckBase)/build/ && ../tree/configure)
endif
# $1, when out-of-tree, builds correctly.
$$(strip $$(MAKE) all \
ZMK.Path=$$(ZMK.distCheckBase)/tree \
ZMK.SrcDir=$$(ZMK.distCheckBase)/tree \
-f $$(ZMK.distCheckBase)/tree/$$(notdir $$(ZMK.srcDirMakefile)) \
-C $$(ZMK.distCheckBase)/build)
# $1, when out-of-tree, checks out.
$$(strip $$(MAKE) check \
ZMK.Path=$$(ZMK.distCheckBase)/tree \
ZMK.SrcDir=$$(ZMK.distCheckBase)/tree \
-f $$(ZMK.distCheckBase)/tree/$$(notdir $$(ZMK.srcDirMakefile)) \
-C $$(ZMK.distCheckBase)/build)
# $1, when out-of-tree, installs via DESTDIR.
$$(strip $$(MAKE) install \
ZMK.Path=$$(ZMK.distCheckBase)/tree \
ZMK.SrcDir=$$(ZMK.distCheckBase)/tree \
-f $$(ZMK.distCheckBase)/tree/$$(notdir $$(ZMK.srcDirMakefile)) \
-C $$(ZMK.distCheckBase)/build \
DESTDIR=$$(ZMK.distCheckBase)/installcheck)
# $(NAME), when out-of-tree, uninstalls via DESTDIR.
$$(strip $$(MAKE) uninstall \
ZMK.Path=$$(ZMK.distCheckBase)/tree \
ZMK.SrcDir=$$(ZMK.distCheckBase)/tree \
-f $$(ZMK.distCheckBase)/tree/$$(notdir $$(ZMK.srcDirMakefile)) \
-C $$(ZMK.distCheckBase)/build \
DESTDIR=$$(ZMK.distCheckBase)/installcheck)
# Uninstalled $1 does not leave files or symbolic links.
test "$$$$(find $$(ZMK.distCheckBase)/installcheck -type f -o -type l | wc -l)" -eq 0
rm -rf $$(ZMK.distCheckBase)/installcheck
# $1, when out-of-tree, can re-create the release archive.
$$(strip $$(MAKE) dist \
ZMK.Path=$$(ZMK.distCheckBase)/tree \
ZMK.SrcDir=$$(ZMK.distCheckBase)/tree \
-f $$(ZMK.distCheckBase)/tree/$$(notdir $$(ZMK.srcDirMakefile)) \
-C $$(ZMK.distCheckBase)/build)
# Make the source tree read-write for in-tree checks.
chmod -R +w $$(ZMK.distCheckBase)/tree
# $1, when in-tree, builds correctly.
$$(MAKE) -C $$(ZMK.distCheckBase)/tree all
# $1, when in-tree, checks out.
$$(MAKE) -C $$(ZMK.distCheckBase)/tree check
# $1, when in-tree, installs via DESTDIR.
$$(strip $$(MAKE) -C $$(ZMK.distCheckBase)/tree install \
DESTDIR=$$(ZMK.distCheckBase)/installcheck)
# $(NAME), when in-tree, uninstalls via DESTDIR.
$$(strip $$(MAKE) -C $$(ZMK.distCheckBase)/tree uninstall \
DESTDIR=$$(ZMK.distCheckBase)/installcheck)
# Uninstalled $1 does not leave files or symbolic links.
test "$$$$(find $$(ZMK.distCheckBase)/installcheck -type f -o -type l | wc -l)" -eq 0
rm -rf $$(ZMK.distCheckBase)/installcheck
# $1, when in-tree, can re-create the release archive.
$$(MAKE) -C $$(ZMK.distCheckBase)/tree dist
# Clean up after distcheck.
rm -rf $$(ZMK.distCheckBase)
@echo "dist-check successful"
$$(eval $$(call ZMK.Expand,Tarball,$1))
endef
zmk-0.5.1/zmk/Tarball.mk 0000664 0001750 0001750 00000004775 14027615611 013561 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,Silent))
$(eval $(call ZMK.Import,Directories))
$(eval $(call ZMK.Import,OS))
Tarball.tar ?= $(shell command -v tar 2>/dev/null)
Tarball.isGNU ?= $(if $(shell $(Tarball.tar) --version 2>&1 | grep GNU),yes)
# When using MacOS, ask tar not to store mac-specific meta-data through .DS_Store files.
ifeq ($(OS.Kernel),Darwin)
Tarball.tarOptions += --no-mac-metadata
endif
# Recognize common compression formats
%.tar.gz: Tarball.compressFlag=z
%.tar.bz2: Tarball.compressFlag=j
%.tar.xz: Tarball.compressFlag=J
Tarball.Variables=Name Files
define Tarball.Template
$1.Name ?= $$(patsubst %.tar$$(suffix $1),%,$1)
$1.Files ?= $$(error define $1.Files - the list of files to include in the tarball)
dist:: $1
# Apply transforms, using either GNU or BSD tar syntax.
# - strip $(CURDIR), this fixes out-of-tree configure
# - strip $(ZMK.Path), this effectively bundles ZMK into the root directory of the archive
# - insert directory with archive name up front
# - rename the .version-from-git file to .version (see GitVersion module)
ifeq ($$(Tarball.isGNU),yes)
$1: Tarball.tarOptions += --absolute-names
$1: Tarball.tarOptions += --xform='s@$$(CURDIR)/@@g'
ifneq ($$(ZMK.Path),.)
$1: Tarball.tarOptions += --xform='s@$$(ZMK.Path)/@@g'
endif
$1: Tarball.tarOptions += --xform='s@.version-from-git@.version@'
$1: Tarball.tarOptions += --xform='s@^@$$($1.Name)/@'
else
$1: Tarball.tarOptions += -s '@$$(CURDIR)/@@g'
ifneq ($$(ZMK.Path),.)
$1: Tarball.tarOptions += -s '@$$(ZMK.Path)/@@g'
endif
$1: Tarball.tarOptions += -s '@^.version-from-git@$$($1.Name)/.version@'
$1: Tarball.tarOptions += -s '@^.@$$($1.Name)/~@'
endif
$1: $$(sort $$($1.Files))
$$(call Silent.Say,TAR,$$@)
$$(Silent.Command)$$(strip $$(Tarball.tar) \
-$$(or $$(Tarball.compressFlag),a)cf $$@ \
$$(if $$(ZMK.IsOutOfTreeBuild),-C $$(ZMK.SrcDir)) \
$$(Tarball.tarOptions) \
$$(patsubst $$(ZMK.SrcDir)/%,%,$$^))
endef
zmk-0.5.1/zmk/Toolchain.mk 0000664 0001750 0001750 00000010054 14027615611 014103 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
$(eval $(call ZMK.Import,OS))
$(eval $(call ZMK.Import,Configure))
# Compiler defaults unless changed by config.$(Project.Name).mk
ifeq ($(OS.Kernel),SunOS)
# Solaris doesn't seem to provide any aliases or symlinks for gcc but make wants to call it "cc".
CC := gcc
endif
CPPFLAGS ?=
CFLAGS ?=
CXXFLAGS ?=
OBJCFLAGS ?=
OBJCXXFLAGS ?=
ARFLAGS = -cr
TARGET_ARCH ?=
LDLIBS ?=
LDFLAGS ?=
# The exe variable expands to .exe when the compiled binary should have such suffix.
exe ?=
# Is zmk debugging enabled for this module?
Toolchain.debug ?= $(findstring toolchain,$(DEBUG))
# What is the image format used by the C compiler?
# If we are not cross compiling then image format is native.
Toolchain.CC.ImageFormat ?= $(OS.ImageFormat)
# What is the image format used by the C++ compiler?
Toolchain.CXX.ImageFormat ?= $(OS.ImageFormat)
# Is the C compiler a cross-compiler?
Toolchain.CC.IsCross ?=
# Is the C++ compiler a cross-compiler?
Toolchain.CXX.IsCross ?=
# Should the compiler be invoked with an explicit sysroot?
Toolchain.SysRoot ?= $(Configure.SysRoot)
# Should compiling produce dependency information for make?
Toolchain.DependencyTracking ?= $(Configure.DependencyTracking)
# Deduce the kind of the selected compiler. Some build rules or compiler
# options depend on the compiler used. As an alternative we could look at
# preprocessor macros but this way seems sufficient for now.
Toolchain.cc ?= $(shell command -v $(CC) 2>/dev/null)
Toolchain.cxx ?= $(shell command -v $(CXX) 2>/dev/null)
# When CC or CXX point to platform default compiler alias, resolve
# them to the real value, which is better to identify the toolchain.
Toolchain.cc := $(if $(findstring $(Toolchain.cc),/usr/bin/cc),$(realpath $(Toolchain.cc)),$(Toolchain.cc))
Toolchain.cxx := $(if $(findstring $(Toolchain.cxx),/usr/bin/c++ /usr/bin/g++),$(realpath $(Toolchain.cxx)),$(Toolchain.cxx))
# Is the C and C++ compiler really available?
Toolchain.CC.IsAvailable ?= $(if $(wildcard $(realpath $(Toolchain.cc))),yes)
Toolchain.CXX.IsAvailable ?= $(if $(wildcard $(realpath $(Toolchain.cxx))),yes)
# What is the version string of the C and the C++ compilers?
Toolchain.cc.version ?= $(if $(Toolchain.CC.IsAvailable),$(shell $(Toolchain.cc) --version))
Toolchain.cxx.version ?= $(if $(Toolchain.CXX.IsAvailable),$(shell $(Toolchain.cxx) --version))
# Import toolchain-specific knowledge.
$(eval $(call ZMK.Import,toolchain.GCC))
$(eval $(call ZMK.Import,toolchain.Clang))
$(eval $(call ZMK.Import,toolchain.Watcom))
$(eval $(call ZMK.Import,toolchain.Tcc))
# Is either the C or C++ compiler a cross compiler?
Toolchain.IsCross ?= $(or $(Toolchain.CC.IsCross),$(Toolchain.CXX.IsCross))
# Is the image format between C and C++ uniform?
ifeq ($(Toolchain.CC.ImageFormat),$(Toolchain.CXX.ImageFormat))
Toolchain.ImageFormat = $(Toolchain.CC.ImageFormat)
else
Toolchain.ImageFormat = Mixed
endif
# If dependency tracking is enabled, pass extra options to the compiler, to
# generate dependency data at the same time as compiling object files.
ifneq (,$(and $(Toolchain.DependencyTracking),$(or $(Toolchain.IsGcc),$(Toolchain.IsClang))))
%.o: CPPFLAGS += -MMD$(if $(ZMK.IsOutOfTreeBuild), -MF $(@:.o=.d))
$(if $(Toolchain.debug),$(info DEBUG: compiling object files will generate make dependency information))
endif
$(if $(Toolchain.debug),$(foreach v,CC CXX CPP CFLAGS CXXFLAGS CPPFLAGS OBJCFLAGS OBJCXXFLAGS ARFLAGS TARGET_ARCH LDLIBS LDFLAGS $(sort $(filter Toolchain.%,$(.VARIABLES))),$(info DEBUG: $v=$($v))))
zmk-0.5.1/zmk/internalTest.mk 0000664 0001750 0001750 00000010361 14064711144 014637 0 ustar zyga zyga # NOTE: This file is not a part of the public ZMK API.
# It is used by zmk self-test suite and it is provided here for convenience.
# Tests are grouped under the "t" target
.PHONY: t
t::
# Pretend that GCC is installed.
# This shields the test from whatever is installed on the host.
define ZMK.isolateHostToolchain
%.log: ZMK.makeOverrides += Toolchain.CC.IsAvailable=yes
%.log: ZMK.makeOverrides += Toolchain.CC.IsClang=
%.log: ZMK.makeOverrides += Toolchain.CC.IsGcc=yes
%.log: ZMK.makeOverrides += Toolchain.CXX.IsAvailable=yes
%.log: ZMK.makeOverrides += Toolchain.CXX.IsClang=
%.log: ZMK.makeOverrides += Toolchain.CXX.IsGcc=yes
%.log: ZMK.makeOverrides += Toolchain.IsClang=
%.log: ZMK.makeOverrides += Toolchain.cc.dumpmachine=
%.log: ZMK.makeOverrides += Toolchain.cc.version=
%.log: ZMK.makeOverrides += Toolchain.cxx.dumpmachine=
%.log: ZMK.makeOverrides += Toolchain.cxx.version=
%.log: ZMK.makeOverrides += Toolchain.g++.dumpmachine=
%.log: ZMK.makeOverrides += Toolchain.gcc.dumpmachine=
endef
# Find the path of the zmk installation
ZMK.test.Path := $(or $(wildcard /usr/local/share/zmk),$(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..))
# Location of the source tree, for out-of-tree testing.
ZMK.test.SrcDir ?= .
# For consistency with real z.mk
ifneq ($(ZMK.test.SrcDir),.)
ZMK.test.IsOutOfTreeBuild = yes
ZMK.test.OutOfTreeSourcePath = $(ZMK.test.SrcDir)/
VPATH = $(ZMK.test.SrcDir)
else
ZMK.test.IsOutOfTreeBuild =
ZMK.test.OutOfTreeSourcePath =
endif
# Put extra test tools on PATH
export PATH := $(ZMK.test.Path)/tests/bin:$(PATH)
# Make overrides can be used in order to test specific behavior
ZMK.makeOverrides ?=
# Indicate that we are testing ZMK.
# In specific cases, we may want to know this.
ZMK.makeOverrides += ZMK.testing=yes
# Make target can be customized for each log file.
# For default logic, see the rule below.
ZMK.makeTarget ?=
ifeq ($(origin OS),environment)
OS.test.Kernel = $(findstring $(OS),Windows_NT)
else
OS.test.Kernel := $(shell uname -s)
endif
# Read a file from disk. Ideally we'd use $(file <) but it doesn't have a
# feature flag to check for and widely used systems do not support reading.
ZMK.test.readFile=$(shell cat "$1")
# Pick a key from a string with key=value pairs
ZMK.test.valueOfKey=$(strip $(patsubst $2=%,%,$(filter $2=%,$1)))
# Use real os-release(5) information if available or synthesize minimal placeholder.
ifneq (,$(findstring $(OS.test.Kernel),Linux FreeBSD NetBSD OpenBSD GNU GNU/kFreeBSD SunOS))
ZMK.test.OSRelease=$(or $(call ZMK.test.readFile,/etc/os-release),$(error zmk integration tests depends on /etc/os-release))
else ifeq ($(OS.test.Kernel),Darwin)
ZMK.test.OSRelease=ID=macos VERSION_ID=$(word 2,$(shell sysctl kern.osproductversion))
else ifeq ($(OS.test.Kernel),Haiku)
ZMK.test.OSRelease=ID=haiku VERSION_ID=zmk-unimplemented)
else ifeq ($(OS.test.Kernel),Windows_NT)
ZMK.test.OSRelease=ID=windows VERSION_ID=zmk-unimplemented
endif
# The full text of os-release(5) file.
# The ID field from the os-release(5) file.
ZMK.test.OSRelease.ID=$(call ZMK.test.valueOfKey,$(ZMK.test.OSRelease),ID)
# The VERSION_ID field from the os-release(5) file.
ZMK.test.OSRelease.VERSION_ID=$(call ZMK.test.valueOfKey,$(ZMK.test.OSRelease),VERSION_ID)
# Tests print a header, unless silent mode is used
# Tests do not use localization
# Tests always remake targets
# Tests print commands instead of invoking them
# Tests do not mention directory changes
# Tests warn about undefined variables
%.log: MAKEFLAGS=
%.log: Test.mk Makefile $(ZMK.test.Path)/z.mk $(wildcard $(ZMK.test.Path)/zmk/*.mk)
@printf '\n### Log file %s ###\n\n' "$@"
# Log creation: run make with appropriate options for the test case
$(strip LANG=C $(MAKE) -Bn $(ZMK.makeOverrides) \
-I $(ZMK.test.Path) \
ZMK.SrcDir=$(ZMK.test.SrcDir) \
--warn-undefined-variables \
--always-make \
--dry-run \
-f $(ZMK.test.SrcDir)/Makefile \
$(or $(ZMK.makeTarget),$(firstword $(subst -, ,$*))) >$@ 2>&1 || true)
# Log analysis: detect references to undefined variables
if grep -F 'warning: undefined variable' $@; then exit 1; fi
# Log analysis: detect attempted usage of missing programs
if grep -i 'command not found' $@; then exit 1; fi
$(CURDIR)/configure configure: $(ZMK.test.Path)/zmk/internalTest.mk
c::
$(call Silent.Say,RM,*.log)
$(Silent.Command)rm -f *.log
zmk-0.5.1/zmk/pvs-filter.awk 0000664 0001750 0001750 00000002443 14027615611 014434 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
# Awk script for taming the output of plog-converter.
# Requires $srcdir and $abssrcdir environment variables.
BEGIN {
FAILED=0;
SRCDIR=ENVIRON["srcdir"];
NSKIP=length(ENVIRON["abssrcdir"]);
# print(sprintf("nskip %d", NSKIP));
}
# Skip the annoying URL notice.
/^www\.viva64\.com\/en\/w:1:1/ { next }
# We know this is an open source project.
/^.*: error: V1042 .*$/ { next }
# Pick up warnings and errors. Use relative file names.
# The +1 below is because awk uses 1-based indexing.
/^.*: (warning|error):/ {
FAILED=1;
# print($0);
print(sprintf("%s%s", SRCDIR, substr($0, NSKIP + 2)));
}
# Exit if warnings or errors were reported.
END { if (FAILED) exit(1); }
zmk-0.5.1/zmk/toolchain.Clang.mk 0000664 0001750 0001750 00000000573 14012052114 015156 0 ustar zyga zyga # Are we using Clang?
Toolchain.CC.IsClang?=$(if $(or $(findstring clang,$(Toolchain.cc)),$(findstring clang,$(Toolchain.cc.version))),yes)
Toolchain.CXX.IsClang?=$(if $(or $(findstring clang,$(Toolchain.cxx)),$(findstring clang,$(Toolchain.cxx.version))),yes)
Toolchain.IsClang?=$(and $(Toolchain.CC.IsClang),$(Toolchain.CXX.IsClang))
# TODO: handle cross compiling with clang.
zmk-0.5.1/zmk/toolchain.GCC.mk 0000664 0001750 0001750 00000006276 14027656407 014561 0 ustar zyga zyga # Are we using GCC?
Toolchain.CC.IsGcc=$(if $(findstring gcc,$(Toolchain.cc)),yes)
Toolchain.CXX.IsGcc=$(if $(and $(if $(findstring clang++,$(Toolchain.cxx)),,not-clang++),$(findstring g++,$(Toolchain.cxx))),yes)
Toolchain.IsGcc=$(and $(Toolchain.CC.IsGcc),$(Toolchain.CXX.IsGcc))
# Logic specific to gcc
ifneq (,$(Toolchain.CC.IsGcc))
# If we are configured then check for cross compilation by mismatch of host and
# build triplets. When this happens set CC. This is important for
# autoconf/automake compatibility.
ifneq (,$(and $(Configure.Configured),$(Configure.HostArchTriplet),$(Configure.BuildArchTriplet)))
ifneq ($(Configure.BuildArchTriplet),$(Configure.HostArchTriplet))
ifeq ($(origin CC),default)
CC = $(Configure.HostArchTriplet)-gcc
$(if $(Toolchain.debug),$(info DEBUG: gcc cross-compiler selected CC=$(CC)))
endif # !default CC
endif # !cross-compiling
endif # !configured
# Indirection for testability.
Toolchain.gcc ?= $(shell command -v gcc 2>/dev/null)
Toolchain.cc.dumpmachine ?= $(shell $(CC) -dumpmachine)
Toolchain.gcc.dumpmachine ?= $(if $(Toolchain.gcc),$(shell gcc -dumpmachine))
# Are we targeting Windows with mingw?
ifneq (,$(findstring mingw,$(Toolchain.cc.dumpmachine)))
exe = .exe
Toolchain.CC.ImageFormat = PE
$(if $(Toolchain.debug),$(info DEBUG: .exe suffix enabled because $(CC) -dumpmachine mentions mingw))
endif # !mingw
# Are we targeting Linux?
ifneq (,$(findstring linux,$(Toolchain.cc.dumpmachine)))
Toolchain.CC.ImageFormat = ELF
endif # !linux
# Is gcc cross-compiling?
ifneq ($(Toolchain.gcc.dumpmachine),$(Toolchain.cc.dumpmachine))
Toolchain.CC.IsCross = yes
$(if $(Toolchain.debug),$(info DEBUG: cross-compiling because gcc -dumpmachine and $(CC) -dumpmachine differ))
endif # !cross
endif # !cc=gcc
# Logic specific to g++
ifneq (,$(Toolchain.CXX.IsGcc))
# If we are configured then check for cross compilation by mismatch of host and
# build triplets. When this happens set CXX. This is important for
# autoconf/automake compatibility.
ifneq (,$(and $(Configure.Configured),$(Configure.HostArchTriplet),$(Configure.BuildArchTriplet)))
ifneq ($(Configure.BuildArchTriplet),$(Configure.HostArchTriplet))
ifeq ($(origin CXX),default)
CXX = $(Configure.HostArchTriplet)-g++
$(if $(Toolchain.debug),$(info DEBUG: g++ cross-compiler selected CXX=$(CXX)))
endif # !default CXX
endif # !cross-compiling
endif # !configured
# Indirection for testability.
Toolchain.g++ ?= $(shell command -v g++ 2>/dev/null)
Toolchain.cxx.dumpmachine ?= $(shell $(CXX) -dumpmachine)
Toolchain.g++.dumpmachine ?= $(if $(Toolchain.g++),$(shell g++ -dumpmachine))
# Are we targeting Windows with mingw?
ifneq (,$(findstring mingw,$(Toolchain.cxx.dumpmachine)))
exe = .exe
Toolchain.CXX.ImageFormat = PE
$(if $(Toolchain.debug),$(info DEBUG: .exe suffix enabled because $(CXX) -dumpmachine mentions mingw))
endif # !mingw
# Are we targeting Linux?
ifneq (,$(findstring linux,$(Toolchain.cxx.dumpmachine)))
Toolchain.CXX.ImageFormat = ELF
endif # !linux
# Is g++ cross compiling?
ifneq ($(Toolchain.g++.dumpmachine),$(Toolchain.cxx.dumpmachine))
Toolchain.CXX.IsCross = yes
$(if $(Toolchain.debug),$(info DEBUG: cross-compiling because g++ -dumpmachine and $(CXX) -dumpmachine differ))
endif # !cross
endif # !cxx=gcc
zmk-0.5.1/zmk/toolchain.Tcc.mk 0000664 0001750 0001750 00000000131 13736672702 014660 0 ustar zyga zyga # Is CC the tcc compiler?
Toolchain.CC.IsTcc=$(if $(findstring tcc,$(Toolchain.cc)),yes)
zmk-0.5.1/zmk/toolchain.Watcom.mk 0000664 0001750 0001750 00000003533 13736672702 015412 0 ustar zyga zyga # Are we using the open Watcom compiler?
Toolchain.CC.IsWatcom=$(if $(findstring watcom,$(Toolchain.cc)),yes)
Toolchain.CXX.IsWatcom=$(if $(findstring watcom,$(Toolchain.cxx)),yes)
Toolchain.IsWatcom=$(and $(Toolchain.CC.IsWatcom),$(Toolchain.CXX.IsWatcom))
# Logic specific to Watcom compiler.
ifneq (,$(Toolchain.CC.IsWatcom))
# Are we building for DOS or 16bit Windows?
ifneq (,$(or $(findstring dos,$(Toolchain.cc)),$(findstring win16,$(Toolchain.cc))))
exe = .exe
Toolchain.CC.ImageFormat = MZ
Toolchain.CC.IsCross = yes
$(if $(Toolchain.debug),$(info DEBUG: .exe suffix enabled because $(CC) name))
$(if $(Toolchain.debug),$(info DEBUG: cross-compiling because Watcom targets DOS))
endif # !cc win16 || dos
# Are we building for 32bit Windows?
ifneq (,$(findstring win32,$(Toolchain.cc)))
exe = .exe
Toolchain.CC.ImageFormat = PE
Toolchain.CC.IsCross = yes
$(if $(Toolchain.debug),$(info DEBUG: .exe suffix enabled because $(CC) name))
$(if $(Toolchain.debug),$(info DEBUG: cross-compiling because Watcom targets Windows))
endif # !cc win32
endif # !cc Watcom
# Logic specific to Watcom
ifneq (,$(Toolchain.CXX.IsWatcom))
# Are we building for DOS or 16bit Windows?
ifneq (,$(or $(findstring dos,$(Toolchain.cxx)),$(findstring win16,$(Toolchain.cxx))))
exe = .exe
Toolchain.CXX.ImageFormat = MZ
Toolchain.CXX.IsCross = yes
$(if $(Toolchain.debug),$(info DEBUG: .exe suffix enabled because $(CXX) name))
$(if $(Toolchain.debug),$(info DEBUG: cross-compiling because Watcom targets DOS))
endif # !cxx win16 || dos
# Are we building for 32bit Windows?
ifneq (,$(findstring win32,$(Toolchain.cxx)))
exe = .exe
Toolchain.CXX.ImageFormat = PE
Toolchain.CXX.IsCross = yes
$(if $(Toolchain.debug),$(info DEBUG: .exe suffix enabled because $(CXX) name))
$(if $(Toolchain.debug),$(info DEBUG: cross-compiling because Watcom targets Windows))
endif # !cxx win32
endif # !cxx Watcom
zmk-0.5.1/.version 0000664 0001750 0001750 00000000006 14064711202 012505 0 ustar zyga zyga 0.5.1
zmk-0.5.1/configure 0000775 0001750 0001750 00000037060 14064711202 012740 0 ustar zyga zyga #!/bin/sh
# Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
# This script was automatically generated by zmk version 0.5.1
# for the zmk project. Executing this script creates a
# configuration file called config.zmk.mk which influences the
# build process of zmk.
while [ "$#" -ge 1 ]; do
case "$1" in
-h|--help)
echo "Usage: ./configure [OPTIONS]"
echo
echo "Compilation options:"
echo " --build=GNU_TRIPLET Describe the build machine with the given GNU_TRIPLET"
echo " --host=GNU_TRIPLET Describe the host machine with the given GNU_TRIPLET"
echo " --target=GNU_TRIPLET Describe the target machine with the given GNU_TRIPLET"
echo " --enable-dependency-tracking"
echo " Track dependencies between files (implicit)"
echo " --disable-dependency-tracking"
echo " Do not generate or use dependency data during builds"
echo " --enable-maintainer-mode Enable maintainer mode (implicit)"
echo " --disable-maintainer-mode Disable maintainer mode"
echo " --enable-static Enable static libraries"
echo " --disable-static Disable static libraries"
echo " --enable-dynamic Enable dynamic or shared libraries"
echo " --disable-dynamic Disable dynamic or shared libraries"
echo
echo "Autotools compatibility options"
echo " --with-libtool-sysroot=DIR Set the compiler sysroot to DIR"
echo
echo "Build-time directory selection:"
echo " --prefix=PREFIX Set prefix for all directories to PREFIX"
echo " --exec-prefix=PREFIX Set prefix for libraries and programs to PREFIX"
echo " --exec_prefix=PREFIX Alternate spelling --exec-prefix"
echo
echo " --bindir=DIR Install user programs to DIR"
echo " --sbindir=DIR Install super-user programs to DIR"
echo " --libdir=DIR Install runtime and development libraries to DIR"
echo " --libexecdir=DIR Install library-internal programs to DIR"
echo " --includedir=DIR Install development header files to DIR"
echo " --oldincludedir=DIR For compatibility with autotools, ignored"
echo " --mandir=DIR Install manual pages to DIR"
echo " --infodir=DIR Install GNU info pages to DIR"
echo " --sysconfdir=DIR Install system configuration files to DIR"
echo " --datadir=DIR Install read-only data files to DIR"
echo
echo " --localstatedir=DIR Store persistent state specific to a machine in DIR"
echo " --runstatedir=DIR Store ephemeral state specific to a machine in DIR"
echo " --sharedstatedir=DIR Store state shared across machines in DIR"
echo
echo "Options for altering program names:"
echo " --program-prefix=PREFIX Put PREFIX before installed program names"
echo " --program-suffix=SUFFIX Put SUFFIX after installed program names"
echo " --program-transform-name=PROGRAM"
echo " Use sed PROGRAM to transform installed program names"
echo
echo "Miscellaneous options:"
echo " --enable-option-checking Report unrecognized configuration options (implicit)"
echo " --disable-option-checking Ignore unrecognized configuration options"
echo " --enable-silent-rules Do not display commands while building"
echo " --disable-silent-rules Display commands while building (implicit)"
echo
echo "Memorized environment variables:"
echo " CC Name of the C compiler"
echo " CXX Name of the C++ compiler"
echo " CFLAGS Options for the C compiler"
echo " CXXFLAGS Options for the C++ compiler"
echo " CPPFLAGS Options for the preprocessor"
echo " LDFLAGS Options for the linker"
exit 0
;;
--version)
echo "z.mk configure script version 0.5.1"
exit 0
;;
*)
break
;;
esac
done
# Given key=value or key="value value", print the value
rhs() {
echo "$*" | cut -d '=' -f 2- | sed -e 's/^"//' -e 's/"$//'
}
configureOptions="$*"
srcdir="$(dirname "$0")"
while [ "$#" -ge 1 ]; do
case "$1" in
--build=*) buildArchTriplet="$(rhs "$1")" && shift ;;
--host=*) hostArchTriplet="$(rhs "$1")" && shift ;;
--target=*) targetArchTriplet="$(rhs "$1")" && shift ;;
--with-libtool-sysroot=*) sysRoot="$(rhs "$1")" && shift ;;
--enable-dependency-tracking) dependencyTracking=yes && shift ;;
--disable-dependency-tracking) dependencyTracking=no && shift ;;
--enable-maintainer-mode) maintainerMode=yes && shift ;;
--disable-maintainer-mode) maintainerMode=no && shift ;;
--enable-silent-rules) silentRules=yes && shift ;;
--disable-silent-rules) silentRules=no && shift ;;
--enable-option-checking) disableOptionChecking=no && shift ;;
--disable-option-checking) disableOptionChecking=yes && shift ;;
--enable-static) staticLibraries=yes && shift ;;
--disable-static) staticLibraries=no && shift ;;
--enable-dynamic) dynamicLibraries=yes && shift ;;
--disable-dynamic) dynamicLibraries=no && shift ;;
--program-prefix=*) programPrefix="$(rhs "$1")" && shift ;;
--program-suffix=*) programSuffix="$(rhs "$1")" && shift ;;
--program-transform-name=*) programTransformName="$(rhs "$1")" && shift ;;
--exec-prefix=*|--exec_prefix=*)exec_prefix="$(rhs "$1")" && shift ;;
--prefix=*) prefix="$(rhs "$1")" && shift ;;
--bindir=*) bindir="$(rhs "$1")" && shift ;;
--sbindir=*) sbindir="$(rhs "$1")" && shift ;;
--libdir=*) libdir="$(rhs "$1")" && shift ;;
--libexecdir=*) libexecdir="$(rhs "$1")" && shift ;;
--datadir=*) datadir="$(rhs "$1")" && shift ;;
--includedir=*) includedir="$(rhs "$1")" && shift ;;
--oldincludedir=*) shift ;; # ignored for compatibility
--infodir=*) infodir="$(rhs "$1")" && shift ;;
--mandir=*) mandir="$(rhs "$1")" && shift ;;
--sysconfdir=*) sysconfdir="$(rhs "$1")" && shift ;;
--localstatedir=*) localstatedir="$(rhs "$1")" && shift ;;
--runstatedir=*) runstatedir="$(rhs "$1")" && shift ;;
--sharedstatedir=*) sharedstatedir="$(rhs "$1")" && shift ;;
CC=*) CC="$(rhs "$1")" && shift ;;
CXX=*) CXX="$(rhs "$1")" && shift ;;
CFLAGS=*) CFLAGS="$(rhs "$1")" && shift ;;
CXXFLAGS=*) CXXFLAGS="$(rhs "$1")" && shift ;;
OBJCFLAGS=*) OBJCFLAGS="$(rhs "$1")" && shift ;;
OBJCXXFLAGS=*) OBJCXXFLAGS="$(rhs "$1")" && shift ;;
CPPFLAGS=*) CPPFLAGS="$(rhs "$1")" && shift ;;
LDFLAGS=*) LDFLAGS="$(rhs "$1")" && shift ;;
ZMK.SrcDir=*) srcdir="$(rhs "$1")" && shift ;;
*)
if [ "${disableOptionChecking:-}" != yes ]; then
echo "configure: unknown option $1" >&2
exit 1
fi
shift
;;
esac
done
{
echo "# Generated by zmk configuration script version 0.5.1"
echo "# Invoked as: $srcdir/configure $configureOptions"
echo
echo "# Location of the source code."
echo "ZMK.SrcDir=$srcdir"
echo
echo "# Build and host architecture triplets."
echo "# Note that those impact compiler selection unless CC and CXX are overridden."
test -n "${buildArchTriplet:-}" && echo "Configure.BuildArchTriplet=$buildArchTriplet" || echo "# Configure.BuildArchTriplet was not specified."
test -n "${hostArchTriplet:-}" && echo "Configure.HostArchTriplet=$hostArchTriplet" || echo "# Configure.HostArchTriplet was not specified."
test -n "${targetArchTriplet:-}" && echo "Configure.TargetArchTriplet=$targetArchTriplet" || echo "# Configure.TargetArchTriplet was not specified."
test -n "${sysRoot:-}" && echo "Configure.SysRoot=$sysRoot" || echo "# Configure.SysRoot was not specified."
echo
echo "# Build-time configuration of application directories."
test -n "${prefix:-}" && echo "prefix=$prefix" || echo "# prefix was not specified."
test -n "${exec_prefix:-}" && echo "exec_prefix=$exec_prefix" || echo "# exec_prefix was not specified."
test -n "${bindir:-}" && echo "bindir=$bindir" || echo "# bindir was not specified."
test -n "${sbindir:-}" && echo "sbindir=$sbindir" || echo "# sbindir was not specified."
test -n "${datadir:-}" && echo "datadir=$datadir" || echo "# datadir was not specified."
test -n "${includedir:-}" && echo "includedir=$includedir" || echo "# includedir was not specified."
test -n "${infodir:-}" && echo "infodir=$infodir" || echo "# infodir was not specified."
test -n "${libdir:-}" && echo "libdir=$libdir" || echo "# libdir was not specified."
test -n "${libexecdir:-}" && echo "libexecdir=$libexecdir" || echo "# libexecdir was not specified."
test -n "${localstatedir:-}" && echo "localstatedir=$localstatedir" || echo "# localstatedir was not specified."
test -n "${mandir:-}" && echo "mandir=$mandir" || echo "# mandir was not specified."
test -n "${runstatedir:-}" && echo "runstatedir=$runstatedir" || echo "# runstatedir was not specified."
test -n "${sharedstatedir:-}" && echo "sharedstatedir=$sharedstatedir" || echo "# sharedstatedir was not specified."
test -n "${sysconfdir:-}" && echo "sysconfdir=$sysconfdir" || echo "# sysconfdir was not specified."
echo
echo "# Inherited environment variables and overrides."
test -n "$CC" && echo "CC=$CC" || echo "# CC was not specified."
test -n "$CXX" && echo "CXX=$CXX" || echo "# CXX was not specified."
test -n "$CFLAGS" && echo "CFLAGS=$CFLAGS" || echo "# CFLAGS was not specified."
test -n "$CXXFLAGS" && echo "CXXFLAGS=$CXXFLAGS" || echo "# CXXFLAGS was not specified."
test -n "$OBJCFLAGS" && echo "OBJCFLAGS=$OBJCFLAGS" || echo "# OBJCFLAGS was not specified."
test -n "$OBJCXXFLAGS" && echo "OBJCXXFLAGS=$OBJCXXFLAGS" || echo "# OBJCXXFLAGS was not specified."
test -n "$CPPFLAGS" && echo "CPPFLAGS=$CPPFLAGS" || echo "# CPPFLAGS was not specified."
test -n "$LDFLAGS" && echo "LDFLAGS=$LDFLAGS" || echo "# LDFLAGS was not specified."
echo
echo "# Track dependencies between objects and source and header files."
case "${dependencyTracking:-implicit}" in
yes)
echo "Configure.DependencyTracking=yes"
;;
no)
echo "Configure.DependencyTracking="
;;
implicit)
echo "# Configure.DependencyTracking was not specified."
echo "# This feature is enabled by default."
;;
esac
echo
echo "# Additional options for package maintainers."
case "${maintainerMode:-implicit}" in
yes)
echo "Configure.MaintainerMode=yes"
;;
no)
echo "Configure.MaintainerMode="
;;
implicit)
echo "# Configure.MaintainerMode was not specified."
echo "# This feature is enabled by default."
;;
esac
echo
echo "# Silence shell commands used by make."
case "${silentRules:-implicit}" in
yes)
echo "Configure.SilentRules=yes"
;;
no)
echo "Configure.SilentRules="
;;
implicit)
echo "# Configure.SilentRules was not specified."
echo "# This feature is disabled by default."
;;
esac
echo "# Support for static libraries."
case "${staticLibraries:-implicit}" in
yes)
echo "Configure.StaticLibraries=yes"
;;
no)
echo "Configure.StaticLibraries="
;;
implicit)
echo "# Configure.StaticLibraries was not specified."
echo "# This feature is enabled by default."
;;
esac
echo
echo "# Support for dynamic or shared libraries."
case "${dynamicLibraries:-implicit}" in
yes)
echo "Configure.DynamicLibraries=yes"
;;
no)
echo "Configure.DynamicLibraries="
;;
implicit)
echo "# Configure.DynamicLibraries was not specified."
echo "# This feature is enabled by default, if supported."
;;
esac
echo
echo "# Program name customization options."
test -n "${programPrefix:-}" && echo "Configure.ProgramPrefix=$programPrefix" || echo "# Configure.ProgramPrefix was not specified."
test -n "${programSuffix:-}" && echo "Configure.ProgramSuffix=$programSuffix" || echo "# Configure.ProgramSuffix was not specified."
test -n "${programTransformName:-}" && echo "Configure.ProgramTransformName=$programTransformName" || echo "# Configure.ProgramTransformName was not specified."
echo
echo "# Remember that the configuration script was executed."
echo "Configure.Configured=yes"
echo "Configure.Options=$configureOptions"
} >"${ZMK_CONFIGURE_MAKEFILE:=config.zmk.mk}"
if [ ! -e Makefile ] && [ ! -e GNUmakefile ]; then
if [ -e "$srcdir"/GNUmakefile ]; then
ln -s "$srcdir"/GNUmakefile GNUmakefile
fi
if [ -e "$srcdir"/Makefile ]; then
ln -s "$srcdir"/Makefile Makefile
fi
fi
zmk-0.5.1/GNUmakefile 0000664 0001750 0001750 00000014023 14064711144 013102 0 ustar zyga zyga # Copyright 2019-2021 Zygmunt Krynicki.
#
# This file is part of zmk.
#
# Zmk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# Zmk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Zmk. If not, see .
NAME = zmk
VERSION = 0.5.1 # This needs to match ZMK.Version
ZMK.SrcDir ?= .
-include config.zmk.mk
ZMK.Path = $(ZMK.SrcDir)
include $(ZMK.Path)/z.mk
# Manual pages present in the package.
ZMK.manPages = \
z.mk.5 \
zmk.AllClean.5 \
zmk.Configure.5 \
zmk.Coverity.5 \
zmk.Directories.5 \
zmk.Library.A.5 \
zmk.Library.DyLib.5 \
zmk.Library.So.5 \
zmk.OS.5 \
zmk.Program.5 \
zmk.Script.5 \
zmk.Silent.5 \
zmk.Symlink.5 \
zmk.Toolchain.5
# Use git to augment version.
$(eval $(call ZMK.Import,GitVersion))
$(eval $(call ZMK.Import,Directories))
$(eval $(call ZMK.Import,Configure))
# Install all of zmk to the sub-directory in the include directory.
# Except for z.mk itself, which should live there directly.
$(foreach f,$(ZMK.DistFiles),$(eval $f.InstallDir=$(includedir)/zmk))
z.mk.InstallDir=$(includedir)
$(foreach f,$(ZMK.DistFiles),$(eval $(call ZMK.Expand,InstallUninstall,$f)))
# Install all of the manual pages, generating them from .in files first.
all:: $(foreach f,$(ZMK.manPages),man/$f)
clean::
$(call Silent.Say,RM,$(addprefix man/,$(ZMK.manPages)))
$(Silent.Command)rm -f $(addprefix man/,$(ZMK.manPages))
ifneq ($(ZMK.SrcDir),.)
$(Silent.Command)test -d man && rmdir man || :
endif
$(CURDIR)/man: # For out-of-tree builds.
$(Silent.Command)install -d $@
man/%: man/%.in | $(CURDIR)/man
$(call Silent.Say,SED,$@)
$(Silent.Command)sed -e 's/@VERSION@/$(VERSION)/g' $< >$@
$(foreach f,$(ZMK.manPages),$(eval $(call ZMK.Expand,ManPage,man/$f)))
# Build the release tarball.
ZMK.releaseArchive?=$(NAME)-$(VERSION).tar.gz
$(ZMK.releaseArchive).Files = GNUmakefile README.md LICENSE NEWS
$(ZMK.releaseArchive).Files += $(addsuffix .in,$(addprefix man/,$(ZMK.manPages)))
$(ZMK.releaseArchive).Files += $(addprefix examples/hello-c/,Makefile Test.mk hello.c)
$(ZMK.releaseArchive).Files += $(addprefix examples/hello-cpp/,Makefile Test.mk hello.cpp)
$(ZMK.releaseArchive).Files += $(addprefix examples/hello-objc/,Makefile Test.mk hello.m README.txt)
$(ZMK.releaseArchive).Files += $(addprefix examples/libhello-c/,Makefile Test.mk hello.c hello.h)
$(ZMK.releaseArchive).Files += $(addprefix examples/libhello-cpp/,Makefile Test.mk hello.cpp hello.h)
$(ZMK.releaseArchive).Files += $(addprefix examples/libhello-objc/,Makefile Test.mk hello.m hello.h)
$(ZMK.releaseArchive).Files += $(addprefix examples/script/,Makefile Test.mk hello.sh)
$(ZMK.releaseArchive).Files += $(addprefix examples/true_false/,Makefile Test.mk true_false.c README.txt)
$(ZMK.releaseArchive).Files += $(addprefix tests/Configure/,Makefile Test.mk integration/Makefile integration/Test.mk)
$(ZMK.releaseArchive).Files += $(addprefix tests/Directories/,Makefile Test.mk)
$(ZMK.releaseArchive).Files += $(addprefix tests/Directory/,Makefile Test.mk)
$(ZMK.releaseArchive).Files += $(addprefix tests/Header/,Makefile Test.mk foo.h include/bar.h froz.h)
$(ZMK.releaseArchive).Files += $(addprefix tests/HeaderGroup/,Makefile Test.mk foo.h bar.h froz.h)
$(ZMK.releaseArchive).Files += $(addprefix tests/Library.A/,Makefile Test.mk foo.c)
$(ZMK.releaseArchive).Files += $(addprefix tests/Library.DyLib/,Makefile Test.mk foo.c bar.c)
$(ZMK.releaseArchive).Files += $(addprefix tests/Library.So/,Makefile Test.mk foo.c bar.c)
$(ZMK.releaseArchive).Files += $(addprefix tests/ManPage/,Makefile Test.mk foo.1 foo.2 foo.3 foo.4 foo.5 foo.6 foo.7 foo.8 foo.9 man/bar.1 man/bar.2 man/bar.3 man/bar.4 man/bar.5 man/bar.6 man/bar.7 man/bar.8 man/bar.9)
$(ZMK.releaseArchive).Files += $(addprefix tests/ObjectGroup/,Makefile Test.mk main.c main.cpp main.m main.cxx main.cc src/main.c)
$(ZMK.releaseArchive).Files += $(addprefix tests/OS/,Makefile Test.mk)
$(ZMK.releaseArchive).Files += $(addprefix tests/Program/,Makefile Test.mk main.c main.cpp main.m main.cxx main.cc src/main.c)
$(ZMK.releaseArchive).Files += $(addprefix tests/Symlink/,Makefile Test.mk)
$(ZMK.releaseArchive).Files += $(addprefix tests/Tarball.Src/,Makefile Test.mk foo.txt home/alice/.gnupg/fake-gpg-data home/bob/.gitkeep home/eve/.gnupg/fake-gpg-data)
$(ZMK.releaseArchive).Files += $(addprefix tests/Toolchain/,Makefile Test.mk integration/Makefile integration/Test.mk)
$(ZMK.releaseArchive).Files += $(addprefix tests/Target.distclean/,Makefile Test.mk)
$(ZMK.releaseArchive).Files += $(addprefix tests/Target.check/,Makefile Test.mk)
$(ZMK.releaseArchive).Files += tests/bin/GREP
$(eval $(call ZMK.Expand,Tarball.Src,$(ZMK.releaseArchive)))
check:: check-unit
# Some hackery is performed to map slashes to dashes, except in "(lib)?hello-".
tests = $(patsubst -%-,%,$(subst /,-,$(subst $(ZMK.SrcDir)/,/,$(dir $(shell find $(ZMK.SrcDir) -name Test.mk)))))
.PHONY: check-unit
check-unit: $(addprefix check-,$(tests))
.PHONY: $(addprefix check-,$(tests))
check-%: ZMK.testDir=$(patsubst examples/libhello/%,examples/libhello-%,$(patsubst examples/hello/%,examples/hello-%,$(subst -,/,$*)))
$(addprefix check-,$(tests)): check-%:
$(call Silent.Say,MAKE-TEST,$(ZMK.testDir))
ifeq ($(ZMK.IsOutOfTreeBuild),yes)
$(Silent.Command)mkdir -p $(ZMK.testDir)
$(Silent.Command)$(strip $(MAKE) \
--warn-undefined-variables \
ZMK.test.SrcDir=$(ZMK.SrcDir)/$(ZMK.testDir) \
-I $(abspath $(ZMK.Path)) \
-C $(ZMK.testDir) \
-f $(ZMK.SrcDir)/$(ZMK.testDir)/Test.mk)
else
$(Silent.Command)$(strip $(MAKE) \
--warn-undefined-variables \
-I $(abspath $(ZMK.Path)) \
-C $(ZMK.testDir) \
-f Test.mk)
endif
hack:
sudo ln -s $(abspath $(ZMK.OutOfTreeSourcePath)z.mk) $(includedir)/z.mk
sudo ln -s $(abspath $(ZMK.OutOfTreeSourcePath)zmk) $(includedir)/zmk
zmk-0.5.1/LICENSE 0000664 0001750 0001750 00000016743 13736672702 012063 0 ustar zyga zyga GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
zmk-0.5.1/NEWS 0000664 0001750 0001750 00000031533 14064711144 011534 0 ustar zyga zyga Changes in 0.5.1
* ZMK now defines `ZMK.BugFixes` as a set of identifiers of issues that were
known and addressed inside the library. Specific bugs may gain stable identifiers
that, once addressed, are added to the list in the next release of the library.
This mechanism is intended to enable hot-fixes, which are applied to the
makefile of a specific project, which update or replace part of zmk to fix a
specific issue while doing so in a way which eventually disables the
workaround.
* The Symlink template is now documented with a dedicated manual page
* The Symlink template no longer retains the sub-directory related to the
placement in the development tree after installation, matching the behavior
of the Program template.
This is a backwards incompatible change resulting from the fact that
previous behavior was simply wrong. There are additional tests checking
various combinations of this behavior now.
This issue is identified in ZMK.BugFixes as zmk-issue-80
* ZMK integration tests no longer fail on Haiku
Changes in 0.5:
* The Program.Test template no longer fails with syntax error when computing
test coverage.
* The Toolchain module no longer misidentifies clang on FreeBSD.
* The Toolchain module has initial integration test suite that checks the real
interaction with the host system. The integration test suite has reference
data for FreeBSD and MacOS.
* The Coverity module gained support for checking if scan result is viable for
submission and an ability to submit the scan automatically, using the new
`upload-coverity-scan` target. See the manual page for additional information
about project configuration.
* ZMK now supports additional static analysis tools: clang-tidy, clang-analyzer
(via scan-build), cppcheck and sparse. They each define a CamelCase-named
module and a Sources attribute which includes the set of files to scan.
* The distclean no longer forgets to run clean target.
* ZMK now allows installing multiple headers simultaneously with the
use of the HeaderGroup template. HeaderGroup supports group customization of
InstallDir and InstallMode and otherwise behaves identical to the Header
template used multiple times, manually.
* The ClangTidy template now passes `-- $(CPPFLAGS)` if there are non-empty
CPPFLAGS defined. This can be used to provide include paths and macro
definitions appropriate for the project.
* The Sparse module now passes $(Sparse.Options) via CFLAGS set at the environment
level before invoking recursive $(MAKE). This avoids clobbering CFLAGS set in
the build system (e.g. to pass -fpic) as make treats command line overrides
differently from environment values.
* The Configure module now supports setting the target triplet. The generated
configuration script handles the --target= command line option and the result
is available as $(Configure.TargetArchTriplet).
* The configure script now accepts --exec_prefix= as an alternate spelling of
--exec-prefix.
* The configure script now accepts but ignores --oldincludedir for compatibility
with some build systems.
* The Configure module now supports configuration of static and dynamic
libraries with the new configuration script options: --enable-static,
--disable-static, --enable-dynamic and --disable-dynamic. Both library types
are enabled by default. The values are stored and inhibit expansion of
appropriate templates.
* The Header and HeaderGroup template no longer expand $(includedir) too early,
allowing customized includedir to be respected.
* The Configure module no longer breaks in out-of-tree builds and no special
care is required to support that anymore.
* ZMK is now able to use an explicit sysroot for all activities.
The configure script now accepts --with-libtool-sysroot which sets
$(Configure.SysRoot). The Toolchain module defines $(Toolchain.SysRoot) which
defaults to whatever was configured. The templates ObjectGroup, Library.So,
Library.DyLib and Program now pass the sysroot argument when
Toolchain.SysRoot is non-empty. Lastly the PVS module similarly passes
a non-empty sysroot when invoking the pre-processor.
Changes in 0.4.2:
* The PVS module no longer fails when running the pvs-report target.
* The Header module no longer clobbers custom InstallDir.
* The Library.DyLib template no longer creates symlink foo -> foo.dylib when
the library is not versioned. In addition the amount of code shared between
Library.So and Library.DyLib has increased.
Changes in 0.4.1:
* The Library.So template no longer creates symlink foo -> foo.so when the
library is not versioned.
* The ObjectGroup template no longer fails during out-of-tree builds with
dependency generation and sub-directories in source file paths by attempting
to put the generated dependency information alongside the source code.
* The ObjectGroup template no longer fails during out-of-tree builds when
the original project explicitly uses $(ZMK.OutOfTreeSourcePath).
* The PVS module no longer fails when the original project uses
sub-directories to organize the source tree.
Backwards incompatible changes in 0.4:
* The Configure module introduces a backwards incompatible change in the
name of the generated configuration file. In older releases the file was
called GNUmakefile.configure.mk, starting with this release the name is
config.$(NAME).mk. $(NAME) is the name of the project, also available as
$(Project.Name). This also restricts the configuration system to projects
that define a name. The background of this change is a realization that prior
approach caused confusing an buggy behavior, where Make would search the
include path, which also contains all of PATH, for *any* file named
GNUmakefile.configure.mk and include the first one it found.
Projects using zmk are advised to change their manually included
configuration file to one that contains their project name.
Changes in 0.4:
* The Symlink template used by Library.So and Library.DyLib will now work
correctly when invoked with -B switch (aka --always-make), by force-creating
symbolic links that already exist.
* Program template no longer forgets to add the .exe suffix to installed executables.
* The ObjectGroup template used by Program, Program.Test, Library.A, Library.So
and Library.DyLib now supports sub-directories in source file names. Object files
created by the object group are now created in directories corresponding to the source
files.
* The ObjectGroup template now supports additional C++ extensions: .cxx and .cc.
This is in addition to the .cpp extension that was supported before.
* The ObjectGroup template used by Program, Program.Test, Library.A, Library.So
and Library.DyLib is now performing rudimentary detection of a missing compiler.
* The GitVersion module now provides GitVersion.Origin attribute
to indicate how the version information was obtained. The value "git" is used
when git history along with git tags were used. The value "file" is used when
the .version file was read.
* The Tarball.Src template no longer breaks when used from a dist archive.
* The Program and Script modules no longer attempt to transform installed name
when the Configure module is not imported.
* The internal toolchain.GCC module no longer attempts to invoke gcc and g++
if they are not installed.
* The ManPage module again checks for errors in manual pages. This feature
was disabled in an earlier release as it was showing a problem with zmk
that was not understood at the time.
* The Tarball.Src module only signs the release if both GPG and GPG keys are
available.
Changes in 0.3.8:
* The release archive now contains the full collection of test files.
Changes in 0.3.7:
* The release archive no longer contains the pre-compiled manual pages. Instead
the .in files are shipped, to be compiled locally.
Changes in 0.3.6:
* InstallUninstall no longer reuses the relative directory in the source tree
to represent the target directory. Instead the InstallDir property is the
only way to influence the final path. This was a late discovery but one that
is ultimately only sensible. ZMK itself was adjusted to install correctly in
this new scheme.
Changes in 0.3.5:
* Make distclean no longer breaks building of packages in Debian, by not
removing the bundled zmk and the configure script that current packaging
helpers cannot yet re-generate from zmk itself.
Changes in 0.3.4:
* GitVersion no longer interferes with downstream packaging of releases
by bundling the .version file for snapshots and tagged releases alike.
Changes in 0.3.3:
* Tests no longer hang on case-insensitive filesystems.
* The Directory module no longer issues warnings on MacOS
Changes in 0.3.2:
* The ManPage module no longer installs files to the /man directory.
Changes in 0.3.1:
* The GitVersion module now follows public/private variable naming scheme.
The only public attribute is GitVersion.Active, which expands to yes if
the module has altered VERSION as compared to what was set in the makefile.
* The Tarball.Src module no longer attempts to sign releases in CI systems
and no longer issues warnings if the GitVersion module is not used.
Changes in 0.3:
* For future extensibility backwards compatibility is dropped. All symbols are
different. By the time this release is finalized a compatibility module may
be introduced, if practical.
- All variables now use CamelCase, not under_score. This includes template
instance variables, so for example "hello.sources" becomes
"hello.Sources".
- All public variables are capitalized. This includes variables scoped with
the "ZMK.PublicName". Private variables are named like "ZMK.privateName"
and cannot be relied for backward compatibility across releases. All
public variables should be documented in the manual page corresponding to
the module or template name.
- All custom variables are prefixed with module name, or "ZMK.".
- Modules are imported with the ZMK.Import function, replacing "import".
Modules no longer have the "Module." prefix as it was somewhat redundant.
- Templates are expanded with the ZMK.Expand function, replacing "spawn".
Templates no longer have the "Template." prefix as it was equally
redundant.
- All module names are now using CamelCase naming. Some modules were
renamed, for example "git-version" became "GitVersion" and "PVS-Studio"
became just "PVS"
* Introduction of manual pages for zmk. This is a longer effort but eventually
all modules, templates, variables and rules will be documented.
* Examples are now part of the distribution archive.
* The true_false example illustrates how preprocessor options can
vary per target, even if the same source file is used in more than one
program.
* Examples are now much more terse and to the point.
* The Directories module now warns if DESTDIR is defined inside a makefile.
* The Toolchain module no longer removes all object files.
* The Toolchain module now prefixes all non-standard variables with
Toolchain, to avoid confusion and clashes with user code.
* The Tarball.Src module no longer signs the release archive
from a git-versioned snapshot.
* The Tarball module, when used on Darwin, no longer now forgets to
add the versioned top-level directory, matching the experience on Linux.
* The GitVersion module now detects some CI systems and alerts the
user of a possibility of a shallow git clone.
* Test suite is now part of the distribution archive. All examples are tested,
some modules are also separately tested, to ensure coverage.
* C++ is now supported for all programs and library types.
* Objective C is now supported for all programs and library types. Certain
special features related to gnu-step were dropped. Those are better applied
in actual project makefiles where they can be precise and accurate.
* Numerous smaller bug were found and fixed.
Changes in 0.2:
* The Template.data module now handles nested directories better.
* The Module.configure module can now synthesize the configure script.
* The configure script now handles --runstatedir=DIR option.
* The configure script no longer considers --build=TRIPLET as cross-compiling,
both --build=TRIPLET and --host=TRIPLET must be used and must differ for
that to happen.
* The configure script now supports --help and --version options.
* The Module.git-version module now strips leading "v" from tags.
* The Module.git-version module no longer clashes with Debian packaging
and now collaborates with Template.tarball.src module to store the version
in a .version file.
* The new Template.tarball.src module now creates GPG signatures for
release tarball and handles the .version file.
* ZMK now generates all required files and stores them into source archives
created with Template.tarball.src. Generated data can be removed with the
distclean target.
Changes in 0.1:
* Initial release with the build system extracted out of libzt.
zmk-0.5.1/README.md 0000664 0001750 0001750 00000003555 14046051017 012313 0 ustar zyga zyga # zmk is a collection of reusable makefiles
ZMK is a feature-rich library for writing Makefiles. It provides a good degree
of features of the classic auto{conf,make} + libtool tool-chain, while being
easier to understand, highly-parallel and, most importantly, devoid of
generated cruft that's just unreadable by humans.
```
include z.mk
Project.Name = hello
Project.Version = 1
hello.Sources = hello.c
$(eval $(call ZMK.Expand,Program,hello))
```
ZMK integrates nicely with package managers which expect autotools, it comes
with a short, readable configuration script that accepts many of the same
options that autoconf would expose. It's just a `make configure` away.
## Features
- Describe programs, test programs, static libraries, shared libraries,
development headers, manual pages and more
- Use familiar targets like "all", "check", "install", "uninstall" and "clean"
- Works out of the box on popular distributions of Linux and MacOS
- Friendly to distribution packaging expecting autotools
- Compile natively with gcc, clang, tcc or the open-watcom compilers
- Cross compile with gcc and open-watcom
- Efficient and incremental, including the install target
## Examples
Please browse the examples present in the git repository. If you had installed
zmk through the Debian package, the examples are added to the `zmk-doc`
package. Use `dpkg -L zmk-doc` to find them.
## Stability Guarantee
ZMK is a responsible library. The project promises not to introduce
backwards-incompatible changes in normal circumstances. ZMK is implemented as a
Make library, which effectively means there are only make rules and variables.
ZMK considers all capitalized symbols, such as `ZMK.Program` to be the public
API covered by the stability guarantee. Internal symbols either start with a
lower case character, or have one immediately following a dot, for example
`zmk.foo` or `ZMK.foo`.
zmk-0.5.1/examples/hello-c/Makefile 0000664 0001750 0001750 00000000446 13736672702 015650 0 ustar zyga zyga include z.mk # Include the zmk library
hello.Sources = hello.c # Define the source files to compile into hello
$(eval $(call ZMK.Expand,Program,hello)) # Expand template for programs with the name hello
zmk-0.5.1/examples/hello-c/Test.mk 0000664 0001750 0001750 00000001170 14012052114 015424 0 ustar zyga zyga #!/usr/bin/make -f
# This file is a part of zmk test system.
include zmk/internalTest.mk
t:: all install uninstall clean
$(eval $(ZMK.isolateHostToolchain))
all: all.log
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF hello-hello.d) -c -o hello-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.c' <$<
GREP -qFx 'cc -o hello hello-hello.o' <$<
install: install.log
GREP -qFx 'install -d /usr/local/bin' <$<
GREP -qFx 'install -m 0755 hello /usr/local/bin/hello' <$<
uninstall: uninstall.log
GREP -qFx 'rm -f /usr/local/bin/hello' <$<
clean: clean.log
GREP -qFx 'rm -f hello' <$<
GREP -qFx 'rm -f ./hello-hello.o' <$<
zmk-0.5.1/examples/hello-c/hello.c 0000664 0001750 0001750 00000000140 13736672702 015446 0 ustar zyga zyga #include
#include
int main(void) {
printf("Hello World\n");
return 0;
}
zmk-0.5.1/examples/hello-cpp/Makefile 0000664 0001750 0001750 00000000446 13736672702 016210 0 ustar zyga zyga include z.mk # Include the zmk library
hello.Sources = hello.cpp # Define the source files to compile into hello
$(eval $(call ZMK.Expand,Program,hello)) # Expand template for programs with the name hello
zmk-0.5.1/examples/hello-cpp/Test.mk 0000664 0001750 0001750 00000001356 14012052114 015772 0 ustar zyga zyga #!/usr/bin/make -f
# This file is a part of zmk test system.
include zmk/internalTest.mk
t:: all install uninstall clean
$(eval $(ZMK.isolateHostToolchain))
# MacOS uses c++, GNU uses g++ by default.
# Pick one for test consistency.
%.log: ZMK.makeOverrides += CXX=c++
all: all.log
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF hello-hello.d) -c -o hello-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.cpp' <$<
GREP -qFx 'c++ -o hello hello-hello.o' <$<
install: install.log
GREP -qFx 'install -d /usr/local/bin' <$<
GREP -qFx 'install -m 0755 hello /usr/local/bin/hello' <$<
uninstall: uninstall.log
GREP -qFx 'rm -f /usr/local/bin/hello' <$<
clean: clean.log
GREP -qFx 'rm -f hello' <$<
GREP -qFx 'rm -f ./hello-hello.o' <$<
zmk-0.5.1/examples/hello-cpp/hello.cpp 0000664 0001750 0001750 00000000135 13736672702 016352 0 ustar zyga zyga #include
int main(void) {
std::cout << "Hello World" << std::endl;
return 0;
}
zmk-0.5.1/examples/hello-objc/Makefile 0000664 0001750 0001750 00000000446 13736672702 016343 0 ustar zyga zyga include z.mk # Include the zmk library
hello.Sources = hello.m # Define the source files to compile into hello
$(eval $(call ZMK.Expand,Program,hello)) # Expand template for programs with the name hello
zmk-0.5.1/examples/hello-objc/README.txt 0000664 0001750 0001750 00000001472 14027657276 016404 0 ustar zyga zyga Notes about Objective C. Unlike C and C++, objective C is differs across
platforms. MacOS has support for Objective C 2.0 from Apple while Linux and
other similar operating systems get Objective C 1.x and the GNU Step
implementation of the Foundation libraries. As such, instead of trying to be
clever, be practical and allow the author specify exactly what they need
manually.
Practical applications will most likely add to CFLAGS the following:
-framework Foundation: for headless MacOS programs
-framework Cocoa: for the graphical MacOS programs
$(shell gnustep-config --base-libs): for headless Linux programs
$(shell gnustep-config --gui-libs): for the rare GNU Step GUI program
Note that CFLAGS are used as a compromise across MacOS make, stuck at an old
version before GPL-3 and Linux make, which is up-to-date.
zmk-0.5.1/examples/hello-objc/Test.mk 0000664 0001750 0001750 00000001177 14012052114 016126 0 ustar zyga zyga #!/usr/bin/make -f
# This file is a part of zmk test system.
include zmk/internalTest.mk
t:: all install uninstall clean
$(eval $(ZMK.isolateHostToolchain))
all: all.log
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF hello-hello.d) -c -o hello-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.m' <$<
GREP -qFx 'cc -o hello hello-hello.o -lobjc' <$<
install: install.log
GREP -qFx 'install -d /usr/local/bin' <$<
GREP -qFx 'install -m 0755 hello /usr/local/bin/hello' <$<
uninstall: uninstall.log
GREP -qFx 'rm -f /usr/local/bin/hello' <$<
clean: clean.log
GREP -qFx 'rm -f hello' <$<
GREP -qFx 'rm -f ./hello-hello.o' <$<
zmk-0.5.1/examples/hello-objc/hello.m 0000664 0001750 0001750 00000000140 13736672702 016153 0 ustar zyga zyga #include
#include
int main(void) {
printf("Hello World\n");
return 0;
}
zmk-0.5.1/examples/libhello-c/Makefile 0000664 0001750 0001750 00000003224 13736672702 016334 0 ustar zyga zyga include z.mk # Include the zmk library
$(eval $(call ZMK.Expand,Header,hello.h)) # Expand template for header files with the name hello.h
$(eval $(call ZMK.Import,Toolchain)) # Import module "toolchain" to know about shared library types
libhello.a.Sources = hello.c # Define the source files to compile into libhello.a
$(eval $(call ZMK.Expand,Library.A,libhello.a)) # Expand template for static libraries with the name libhello.a
ifeq ($(Toolchain.CC.ImageFormat),ELF) # If the C compiler is producing ELF files then ...
libhello.so.1.Sources = hello.c # Define the source files to compile into libhello.so.1
libhello.so.1.VersionScript = # Indicate that we don't have a version script for this library
$(eval $(call ZMK.Expand,Library.So,libhello.so.1)) # Expand template for .so shared libraries with the name libhello.so.1
endif # End the if statement opened earlier
ifeq ($(Toolchain.CC.ImageFormat),Mach-O) # If the C compiler is producing Mach-O files then ...
libhello.1.dylib.Sources = hello.c # Define the source files to compile into libhello.1.dylib
libhello.1.dylib.ExportList = # Indicate that we don't have an export list for this library
$(eval $(call ZMK.Expand,Library.DyLib,libhello.1.dylib)) # Expand template for .dylib shared libraries with the name libhello.1.dylib
endif # End the if statement opened earlier
zmk-0.5.1/examples/libhello-c/Test.mk 0000664 0001750 0001750 00000010356 14012052114 016121 0 ustar zyga zyga #!/usr/bin/make -f
# This file is a part of zmk test system.
include zmk/internalTest.mk
t:: all install uninstall clean
$(eval $(ZMK.isolateHostToolchain))
# Test has three variants, for Linux, MacOS and the rest.
%-other.log: ZMK.makeOverrides += Toolchain.CC.ImageFormat=Irrelevant
%-linux.log: ZMK.makeOverrides += Toolchain.CC.ImageFormat=ELF
%-macos.log: ZMK.makeOverrides += Toolchain.CC.ImageFormat=Mach-O
all: all-other all-linux all-macos
install: install-other install-linux install-macos
uninstall: uninstall-other uninstall-linux uninstall-macos
clean: clean-other clean-linux clean-macos
all-other: all-other.log
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libhello.a-hello.d) -c -o libhello.a-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.c' <$<
GREP -qFx 'ar -cr libhello.a libhello.a-hello.o' <$<
install-other: install-other.log
GREP -qFx 'install -d /usr/local/include' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)hello.h /usr/local/include/hello.h' <$<
GREP -qFx 'install -d /usr/local/lib' <$<
GREP -qFx 'install -m 0644 libhello.a /usr/local/lib/libhello.a' <$<
uninstall-other: uninstall-other.log
GREP -qFx 'rm -f /usr/local/include/hello.h' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.a' <$<
clean-other: clean-other.log
GREP -qFx 'rm -f libhello.a' <$<
GREP -qFx 'rm -f ./libhello.a-hello.o' <$<
all-linux: all-linux.log
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libhello.a-hello.d) -c -o libhello.a-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.c' <$<
GREP -qFx 'ar -cr libhello.a libhello.a-hello.o' <$<
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libhello.so.1-hello.d) -c -o libhello.so.1-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.c' <$<
GREP -qFx 'cc -shared -Wl,-soname=libhello.so.1 -o libhello.so.1 libhello.so.1-hello.o' <$<
GREP -qFx 'ln -sf libhello.so.1 libhello.so' <$<
install-linux: install-linux.log
GREP -qFx 'install -d /usr/local/include' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)hello.h /usr/local/include/hello.h' <$<
GREP -qFx 'install -d /usr/local/lib' <$<
GREP -qFx 'install -m 0644 libhello.a /usr/local/lib/libhello.a' <$<
GREP -qFx 'install -m 0644 libhello.so.1 /usr/local/lib/libhello.so.1' <$<
GREP -qFx 'ln -sf libhello.so.1 /usr/local/lib/libhello.so' <$<
uninstall-linux: uninstall-linux.log
GREP -qFx 'rm -f /usr/local/include/hello.h' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.a' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.so.1' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.so' <$<
clean-linux: clean-linux.log
GREP -qFx 'rm -f libhello.a' <$<
GREP -qFx 'rm -f ./libhello.a-hello.o' <$<
GREP -qFx 'rm -f ./libhello.so.1-hello.o' <$<
GREP -qFx 'rm -f libhello.so.1' <$<
GREP -qFx 'rm -f libhello.so' <$<
all-macos: all-macos.log
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libhello.a-hello.d) -c -o libhello.a-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.c' <$<
GREP -qFx 'ar -cr libhello.a libhello.a-hello.o' <$<
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libhello.1.dylib-hello.d) -c -o libhello.1.dylib-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.c' <$<
GREP -qFx 'cc -dynamiclib -compatibility_version 1.0 -current_version 1.0 -o libhello.1.dylib libhello.1.dylib-hello.o' <$<
GREP -qFx 'ln -sf libhello.1.dylib libhello.dylib' <$<
install-macos: install-macos.log
GREP -qFx 'install -d /usr/local/include' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)hello.h /usr/local/include/hello.h' <$<
GREP -qFx 'install -d /usr/local/lib' <$<
GREP -qFx 'install -m 0644 libhello.a /usr/local/lib/libhello.a' <$<
GREP -qFx 'install -d /usr/local/lib' <$<
GREP -qFx 'install -m 0644 libhello.1.dylib /usr/local/lib/libhello.1.dylib' <$<
GREP -qFx 'ln -sf libhello.1.dylib /usr/local/lib/libhello.dylib' <$<
uninstall-macos: uninstall-macos.log
GREP -qFx 'rm -f /usr/local/include/hello.h' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.a' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.1.dylib' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.dylib' <$<
clean-macos: clean-macos.log
GREP -qFx 'rm -f libhello.a' <$<
GREP -qFx 'rm -f ./libhello.a-hello.o' <$<
GREP -qFx 'rm -f ./libhello.1.dylib-hello.o' <$<
GREP -qFx 'rm -f libhello.1.dylib' <$<
GREP -qFx 'rm -f libhello.dylib' <$<
zmk-0.5.1/examples/libhello-c/hello.c 0000664 0001750 0001750 00000000161 13736672702 016140 0 ustar zyga zyga #include
#include
#include "hello.h"
int hello(void) {
return printf("Hello World\n");
}
zmk-0.5.1/examples/libhello-c/hello.h 0000664 0001750 0001750 00000000037 13736672702 016147 0 ustar zyga zyga #pragma once
int hello(void);
zmk-0.5.1/examples/libhello-cpp/Makefile 0000664 0001750 0001750 00000003230 13736672702 016671 0 ustar zyga zyga include z.mk # Include the zmk library
$(eval $(call ZMK.Expand,Header,hello.h)) # Expand template for header files with the name hello.h
$(eval $(call ZMK.Import,Toolchain)) # Import module "toolchain" to know about shared library types
libhello.a.Sources = hello.cpp # Define the source files to compile into libhello.a
$(eval $(call ZMK.Expand,Library.A,libhello.a)) # Expand template for static libraries with the name libhello.a
ifeq ($(Toolchain.CXX.ImageFormat),ELF) # If the C++ compiler is producing ELF files then ...
libhello.so.1.Sources = hello.cpp # Define the source files to compile into libhello.so.1
libhello.so.1.VersionScript = # Indicate that we don't have a version script for this library
$(eval $(call ZMK.Expand,Library.So,libhello.so.1)) # Expand template for .so shared libraries with the name libhello.so.1
endif # End the if statement opened earlier
ifeq ($(Toolchain.CXX.ImageFormat),Mach-O) # If the C++ compiler is producing Mach-O files then ...
libhello.1.dylib.Sources = hello.cpp # Define the source files to compile into libhello.1.dylib
libhello.1.dylib.ExportList = # Indicate that we don't have an export list for this library
$(eval $(call ZMK.Expand,Library.DyLib,libhello.1.dylib)) # Expand template for .dylib shared libraries with the name libhello.1.dylib
endif # End the if statement opened earlier
zmk-0.5.1/examples/libhello-cpp/Test.mk 0000664 0001750 0001750 00000010577 14012052114 016466 0 ustar zyga zyga #!/usr/bin/make -f
# This file is a part of zmk test system.
include zmk/internalTest.mk
t:: all install uninstall clean
$(eval $(ZMK.isolateHostToolchain))
# MacOS uses c++, GNU uses g++ by default.
%.log: ZMK.makeOverrides += CXX=c++
# Pick one for test consistency.
# Test has three variants, for Linux, MacOS and the rest.
%-other.log: ZMK.makeOverrides += Toolchain.CXX.ImageFormat=Irrelevant
%-linux.log: ZMK.makeOverrides += Toolchain.CXX.ImageFormat=ELF
%-macos.log: ZMK.makeOverrides += Toolchain.CXX.ImageFormat=Mach-O
all: all-other all-linux all-macos
install: install-other install-linux install-macos
uninstall: uninstall-other uninstall-linux uninstall-macos
clean: clean-other clean-linux clean-macos
all-other: all-other.log
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libhello.a-hello.d) -c -o libhello.a-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.cpp' <$<
GREP -qFx 'ar -cr libhello.a libhello.a-hello.o' <$<
install-other: install-other.log
GREP -qFx 'install -d /usr/local/include' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)hello.h /usr/local/include/hello.h' <$<
GREP -qFx 'install -d /usr/local/lib' <$<
GREP -qFx 'install -m 0644 libhello.a /usr/local/lib/libhello.a' <$<
uninstall-other: uninstall-other.log
GREP -qFx 'rm -f /usr/local/include/hello.h' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.a' <$<
clean-other: clean-other.log
GREP -qFx 'rm -f libhello.a' <$<
GREP -qFx 'rm -f ./libhello.a-hello.o' <$<
all-linux: all-linux.log
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libhello.a-hello.d) -c -o libhello.a-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.cpp' <$<
GREP -qFx 'ar -cr libhello.a libhello.a-hello.o' <$<
GREP -qFx 'c++ -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libhello.so.1-hello.d) -c -o libhello.so.1-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.cpp' <$<
GREP -qFx 'c++ -fpic -shared -Wl,-soname=libhello.so.1 -o libhello.so.1 libhello.so.1-hello.o' <$<
GREP -qFx 'ln -sf libhello.so.1 libhello.so' <$<
install-linux: install-linux.log
GREP -qFx 'install -d /usr/local/include' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)hello.h /usr/local/include/hello.h' <$<
GREP -qFx 'install -d /usr/local/lib' <$<
GREP -qFx 'install -m 0644 libhello.a /usr/local/lib/libhello.a' <$<
GREP -qFx 'install -m 0644 libhello.so.1 /usr/local/lib/libhello.so.1' <$<
GREP -qFx 'ln -sf libhello.so.1 /usr/local/lib/libhello.so' <$<
uninstall-linux: uninstall-linux.log
GREP -qFx 'rm -f /usr/local/include/hello.h' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.a' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.so.1' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.so' <$<
clean-linux: clean-linux.log
GREP -qFx 'rm -f libhello.a' <$<
GREP -qFx 'rm -f ./libhello.a-hello.o' <$<
GREP -qFx 'rm -f ./libhello.so.1-hello.o' <$<
GREP -qFx 'rm -f libhello.so.1' <$<
GREP -qFx 'rm -f libhello.so' <$<
all-macos: all-macos.log
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libhello.a-hello.d) -c -o libhello.a-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.cpp' <$<
GREP -qFx 'ar -cr libhello.a libhello.a-hello.o' <$<
GREP -qFx 'c++ -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libhello.1.dylib-hello.d) -c -o libhello.1.dylib-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.cpp' <$<
GREP -qFx 'c++ -fpic -dynamiclib -compatibility_version 1.0 -current_version 1.0 -o libhello.1.dylib libhello.1.dylib-hello.o' <$<
GREP -qFx 'ln -sf libhello.1.dylib libhello.dylib' <$<
install-macos: install-macos.log
GREP -qFx 'install -d /usr/local/include' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)hello.h /usr/local/include/hello.h' <$<
GREP -qFx 'install -d /usr/local/lib' <$<
GREP -qFx 'install -m 0644 libhello.a /usr/local/lib/libhello.a' <$<
GREP -qFx 'install -d /usr/local/lib' <$<
GREP -qFx 'install -m 0644 libhello.1.dylib /usr/local/lib/libhello.1.dylib' <$<
GREP -qFx 'ln -sf libhello.1.dylib /usr/local/lib/libhello.dylib' <$<
uninstall-macos: uninstall-macos.log
GREP -qFx 'rm -f /usr/local/include/hello.h' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.a' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.1.dylib' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.dylib' <$<
clean-macos: clean-macos.log
GREP -qFx 'rm -f libhello.a' <$<
GREP -qFx 'rm -f ./libhello.a-hello.o' <$<
GREP -qFx 'rm -f ./libhello.1.dylib-hello.o' <$<
GREP -qFx 'rm -f libhello.1.dylib' <$<
GREP -qFx 'rm -f libhello.dylib' <$<
zmk-0.5.1/examples/libhello-cpp/hello.cpp 0000664 0001750 0001750 00000000150 13736672702 017036 0 ustar zyga zyga #include
#include "hello.h"
void hello(void) {
std::cout << "Hello World" << std::endl;
}
zmk-0.5.1/examples/libhello-cpp/hello.h 0000664 0001750 0001750 00000000040 13736672702 016501 0 ustar zyga zyga #pragma once
void hello(void);
zmk-0.5.1/examples/libhello-objc/Makefile 0000664 0001750 0001750 00000003224 13736672702 017027 0 ustar zyga zyga include z.mk # Include the zmk library
$(eval $(call ZMK.Expand,Header,hello.h)) # Expand template for header files with the name hello.h
$(eval $(call ZMK.Import,Toolchain)) # Import module "toolchain" to know about shared library types
libhello.a.Sources = hello.m # Define the source files to compile into libhello.a
$(eval $(call ZMK.Expand,Library.A,libhello.a)) # Expand template for static libraries with the name libhello.a
ifeq ($(Toolchain.CC.ImageFormat),ELF) # If the C compiler is producing ELF files then ...
libhello.so.1.Sources = hello.m # Define the source files to compile into libhello.so.1
libhello.so.1.VersionScript = # Indicate that we don't have a version script for this library
$(eval $(call ZMK.Expand,Library.So,libhello.so.1)) # Expand template for .so shared libraries with the name libhello.so.1
endif # End the if statement opened earlier
ifeq ($(Toolchain.CC.ImageFormat),Mach-O) # If the C compiler is producing Mach-O files then ...
libhello.1.dylib.Sources = hello.m # Define the source files to compile into libhello.1.dylib
libhello.1.dylib.ExportList = # Indicate that we don't have an export list for this library
$(eval $(call ZMK.Expand,Library.DyLib,libhello.1.dylib)) # Expand template for .dylib shared libraries with the name libhello.1.dylib
endif # End the if statement opened earlier
zmk-0.5.1/examples/libhello-objc/Test.mk 0000664 0001750 0001750 00000010372 14012052114 016612 0 ustar zyga zyga #!/usr/bin/make -f
# This file is a part of zmk test system.
include zmk/internalTest.mk
t:: all install uninstall clean
$(eval $(ZMK.isolateHostToolchain))
# Test has three variants, for Linux, MacOS and the rest.
%-other.log: ZMK.makeOverrides += Toolchain.CC.ImageFormat=Irrelevant
%-linux.log: ZMK.makeOverrides += Toolchain.CC.ImageFormat=ELF
%-macos.log: ZMK.makeOverrides += Toolchain.CC.ImageFormat=Mach-O
all: all-other all-linux all-macos
install: install-other install-linux install-macos
uninstall: uninstall-other uninstall-linux uninstall-macos
clean: clean-other clean-linux clean-macos
all-other: all-other.log
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libhello.a-hello.d) -c -o libhello.a-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.m' <$<
GREP -qFx 'ar -cr libhello.a libhello.a-hello.o' <$<
install-other: install-other.log
GREP -qFx 'install -d /usr/local/include' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)hello.h /usr/local/include/hello.h' <$<
GREP -qFx 'install -d /usr/local/lib' <$<
GREP -qFx 'install -m 0644 libhello.a /usr/local/lib/libhello.a' <$<
uninstall-other: uninstall-other.log
GREP -qFx 'rm -f /usr/local/include/hello.h' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.a' <$<
clean-other: clean-other.log
GREP -qFx 'rm -f libhello.a' <$<
GREP -qFx 'rm -f ./libhello.a-hello.o' <$<
all-linux: all-linux.log
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libhello.a-hello.d) -c -o libhello.a-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.m' <$<
GREP -qFx 'ar -cr libhello.a libhello.a-hello.o' <$<
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libhello.so.1-hello.d) -c -o libhello.so.1-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.m' <$<
GREP -qFx 'cc -fpic -shared -Wl,-soname=libhello.so.1 -o libhello.so.1 libhello.so.1-hello.o' <$<
GREP -qFx 'ln -sf libhello.so.1 libhello.so' <$<
install-linux: install-linux.log
GREP -qFx 'install -d /usr/local/include' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)hello.h /usr/local/include/hello.h' <$<
GREP -qFx 'install -d /usr/local/lib' <$<
GREP -qFx 'install -m 0644 libhello.a /usr/local/lib/libhello.a' <$<
GREP -qFx 'install -m 0644 libhello.so.1 /usr/local/lib/libhello.so.1' <$<
GREP -qFx 'ln -sf libhello.so.1 /usr/local/lib/libhello.so' <$<
uninstall-linux: uninstall-linux.log
GREP -qFx 'rm -f /usr/local/include/hello.h' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.a' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.so.1' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.so' <$<
clean-linux: clean-linux.log
GREP -qFx 'rm -f libhello.a' <$<
GREP -qFx 'rm -f ./libhello.a-hello.o' <$<
GREP -qFx 'rm -f ./libhello.so.1-hello.o' <$<
GREP -qFx 'rm -f libhello.so.1' <$<
GREP -qFx 'rm -f libhello.so' <$<
all-macos: all-macos.log
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libhello.a-hello.d) -c -o libhello.a-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.m' <$<
GREP -qFx 'ar -cr libhello.a libhello.a-hello.o' <$<
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libhello.1.dylib-hello.d) -c -o libhello.1.dylib-hello.o $(ZMK.test.OutOfTreeSourcePath)hello.m' <$<
GREP -qFx 'cc -fpic -dynamiclib -compatibility_version 1.0 -current_version 1.0 -o libhello.1.dylib libhello.1.dylib-hello.o' <$<
GREP -qFx 'ln -sf libhello.1.dylib libhello.dylib' <$<
install-macos: install-macos.log
GREP -qFx 'install -d /usr/local/include' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)hello.h /usr/local/include/hello.h' <$<
GREP -qFx 'install -d /usr/local/lib' <$<
GREP -qFx 'install -m 0644 libhello.a /usr/local/lib/libhello.a' <$<
GREP -qFx 'install -d /usr/local/lib' <$<
GREP -qFx 'install -m 0644 libhello.1.dylib /usr/local/lib/libhello.1.dylib' <$<
GREP -qFx 'ln -sf libhello.1.dylib /usr/local/lib/libhello.dylib' <$<
uninstall-macos: uninstall-macos.log
GREP -qFx 'rm -f /usr/local/include/hello.h' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.a' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.1.dylib' <$<
GREP -qFx 'rm -f /usr/local/lib/libhello.dylib' <$<
clean-macos: clean-macos.log
GREP -qFx 'rm -f libhello.a' <$<
GREP -qFx 'rm -f ./libhello.a-hello.o' <$<
GREP -qFx 'rm -f ./libhello.1.dylib-hello.o' <$<
GREP -qFx 'rm -f libhello.1.dylib' <$<
GREP -qFx 'rm -f libhello.dylib' <$<
zmk-0.5.1/examples/libhello-objc/hello.h 0000664 0001750 0001750 00000000037 13736672702 016642 0 ustar zyga zyga #pragma once
int hello(void);
zmk-0.5.1/examples/libhello-objc/hello.m 0000664 0001750 0001750 00000000161 13736672702 016645 0 ustar zyga zyga #include
#include
#include "hello.h"
int hello(void) {
return printf("Hello World\n");
}
zmk-0.5.1/examples/script/Makefile 0000664 0001750 0001750 00000000275 13736672702 015631 0 ustar zyga zyga include z.mk # Include the zmk library
$(eval $(call ZMK.Expand,Script,hello.sh)) # Expand template for scripts with the name hello
zmk-0.5.1/examples/script/Test.mk 0000664 0001750 0001750 00000001646 13736672702 015444 0 ustar zyga zyga # This file is a part of zmk test system.
include zmk/internalTest.mk
t:: all install uninstall clean check
all: all.log
GREP -q "Nothing to be done for [\`']all'\." <$<
install: install.log
GREP -qF 'install -d /usr/local/bin' <$<
GREP -qF 'install -m 0755 $(ZMK.test.OutOfTreeSourcePath)hello.sh /usr/local/bin/hello.sh' <$<
uninstall: uninstall.log
GREP -qF 'rm -f /usr/local/bin/hello.sh' <$<
clean: clean.log
GREP -q "Nothing to be done for [\`']clean'\." <$<
check: check-with-shellcheck check-without-shellcheck
check-with-shellcheck.log: ZMK.makeOverrides = ZMK.shellcheck=shellcheck
check-with-shellcheck: check-with-shellcheck.log
GREP -qF 'shellcheck $(ZMK.test.OutOfTreeSourcePath)hello.sh' <$<
check-without-shellcheck.log: ZMK.makeOverrides = ZMK.shellcheck=
check-without-shellcheck: check-without-shellcheck.log
GREP -qF 'echo "ZMK: install shellcheck to analyze $(ZMK.test.OutOfTreeSourcePath)hello.sh"' <$<
zmk-0.5.1/examples/script/hello.sh 0000775 0001750 0001750 00000000035 13736672702 015625 0 ustar zyga zyga #!/bin/sh
echo "Hello World"
zmk-0.5.1/examples/true_false/Makefile 0000664 0001750 0001750 00000001301 13736672702 016445 0 ustar zyga zyga include z.mk # Include the zmk library
true.Sources = true_false.c # Define the source files to compile into true
$(eval $(call ZMK.Expand,Program,true)) # Expand template for programs with the name true
true$(exe): CPPFLAGS += -DEXIT_CODE=EXIT_SUCCESS # Pass macro definition when compiling true
false.Sources = true_false.c # Define the source files to compile into false
$(eval $(call ZMK.Expand,Program,false)) # Expand template for programs with the name false
false$(exe): CPPFLAGS += -DEXIT_CODE=EXIT_FAILURE # Pass macro definition when compiling false
zmk-0.5.1/examples/true_false/README.txt 0000664 0001750 0001750 00000000416 13736672702 016511 0 ustar zyga zyga Templates can be expanded many times, as long as the last argument is
different. Each template describes a distinct set of targets, we can use
target-specific variables to pass preprocessor options unique to each program,
even though they apply to the same source file.
zmk-0.5.1/examples/true_false/Test.mk 0000664 0001750 0001750 00000001123 14012052114 016230 0 ustar zyga zyga #!/usr/bin/make -f
# This file is a part of zmk test system.
include zmk/internalTest.mk
t:: all
$(eval $(ZMK.isolateHostToolchain))
all: all.log
GREP -qFx 'cc -DEXIT_CODE=EXIT_SUCCESS -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF true-true_false.d) -c -o true-true_false.o $(ZMK.test.OutOfTreeSourcePath)true_false.c' <$<
GREP -qFx 'cc -o true true-true_false.o' <$<
GREP -qFx 'cc -DEXIT_CODE=EXIT_FAILURE -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF false-true_false.d) -c -o false-true_false.o $(ZMK.test.OutOfTreeSourcePath)true_false.c' <$<
GREP -qFx 'cc -o false false-true_false.o' <$<
zmk-0.5.1/examples/true_false/true_false.c 0000664 0001750 0001750 00000000073 13736672702 017307 0 ustar zyga zyga #include
int main(void) {
return EXIT_CODE;
}
zmk-0.5.1/man/z.mk.5.in 0000664 0001750 0001750 00000021647 14064705107 013171 0 ustar zyga zyga .Dd Oct 26, 2020
.Os zmk @VERSION@
.Dt z.mk 5 PRM
.Sh NAME
.Nm z.mk
.Nd library for writing featureful Makefiles
.Sh SYNOPSIS
.Bd -literal
# Define name and version of the project.
Project.Name=foo
Project.Version=1.2
# Include the configuration file generated by the configure script, if one
# exists. This enables a multitude of configuration options to be used.
-include config.foo.mk
# Assume the source code is in the current directory. This variable is always
# defined by the generated configuration file, enabling support for out-of-tree
# builds.
ZMK.SrcDir ?= .
# Include z.mk by searching include directories. If zmk is not globally
# installed then ZMK.Version expands to nothing. As a last resort, assume that
# zmk was bundled into the release archive.
include z.mk
ifeq ($(value ZMK.Version),)
include $(ZMK.SrcDir)/z.mk
endif
# ZMK is now ready. Import additional modules or expand templates as necessary.
.Ed
.Sh DESCRIPTION
.Nm z.mk,
also known as
.Nm ZMK ,
is a library of GNU-make compatible makefiles providing an opinionated module
and template system. The library comes with a collection of modules for common
C/C++ software projects: compiling programs, creating libraries, installing
development headers, data files, testing, etc. In addition the library offers
specialized modules for constructing new modules that reuse specific behavior,
such as participating in targets such as
.Nm all , clean , install
or
.Nm uninstall .
.Pp
.Ss Naming Convention
ZMK comes with a convention for development of Make libraries. This is an
informal convention aimed at reducing friction in a untyped language devoid of
any encapsulation system, such as that of Make itself.
.Pp
Almost all variables and functions use a naming convention prefixing all names
with the name of the module followed by a dot. In addition, each name is either
public, meant to be used by others and offering some API stability guarantees,
or private, being a part of the implementation and not the interface one should
rely on, even though nothing in make itself prevents this. Public names are
capitalized, private names start with a lower case character.
.Pp
For example
.Nm ZMK.Version
is a public symbol containing the version of the ZMK library while
.Nm ZMK.z.mk
is a private symbol containing, at the time of this writing, the full path of
the loaded z.mk library.
.Ss Modules
ZMK comes with a module system, which builds on the make include system. A
module is a makefile installed to a zmk-specific directory. Typically each
module defines some variables, one of which can be a template. A module which
defines a template is simply called a template and is discussed below. To
import a module use the following expression:
.Bd -literal
$(eval $(call ZMK.Import,ModuleName))
.Ed
Modules encapsulate a piece of functionality or knowledge. For example, there
is a module which handles well-known UNIX directories. Importing that module
defines variables expanding to each of such directories. In addition, that
module depends on a template handling creation of a directory, expanding that
template many times, ensuring that make knows about all the directories,
contains no duplicate rules and that conventions such as the DESTDIR variable
are respected.
.Pp
Not all modules contain literal make rules. As another example, the
.Nm Toolchain
module knows how to detect and interrogate the compiler toolchain, offering
information useful for other modules. For a full listing of modules built into
zmk see MODULES below.
.Sh MODULES
ZMK provides the following importable modules.
.Ss AllClean
This template interacts with the common targets
.Nm all
and
.Nm clean.
.Ss Configure
This module provides a configuration facility and access to interactive
.Em configure
script.
.Ss Coverity
This unstable module provides support for the Coverity static analyzer.
.Ss Directories
This module provides rules for configurable directories such as
.Nm $(libdir)
or
.Nm $(bindir) .
.Ss Directory
This template provides rules for creating a single directory. It's more
involved than it seems.
.Ss GitVersion
This module allows augmenting project version with information from the Git
version control system.
.Ss Header
This template provides targets for installation of public development headers.
.Ss InstallUninstall
This template provides rules for installing and uninstalling files.
.Ss Library.A
This template provides rules for preparing static libraries.
.Ss Library.DyLib
This template provides rules for preparing Mach-O dynamic libraries.
.Ss Library.So
This template provides rules for preparing ELF dynamic libraries.
.Ss ManPage
This template provides rules for checking and installing manual pages.
.Ss OS
This module provides information about the operating system.
.Ss ObjectGroup
This template provides rules for compiling a group of object files.
.Ss PVS
This module provides rules for working with the PVS static analyzer.
.Ss Program.Test
This template provides rules for compiling and executing test programs as well
as for computing code coverage analysis.
.Ss Program
This template provides rules for compiling, installing and uninstalling executable programs.
.Ss Script
This template provides rules checking, installing and uninstalling executable scripts.
.Ss Symlink
This template provides rules for creating symbolic links.
.Ss Tarball.Src
This template provides rules for creating release archives. It offers utility
targets such as
.Nm distcheck ,
which performs a level of validation of the produced archive.
.Ss Tarball
This template provides rules for constructing arbitrary tarballs. It handles
differences between GNU and BSD tar utilities.
.Ss Toolchain
This module provides information about the configured toolchain. ZMK offers
support for gcc, clang and several less commonly used compilers.
.Sh TARGETS
ZMK provides the following make goals.
.Ss all
This goal builds everything that can be compiled or otherwise built.
.Ss clean
This goal removes all the files that were built.
.Ss coverage
This goal provides information about test coverage.
.Ss fmt
This goal re-formats source code according to the selected standard.
.Ss static-check
This goal runs static check analysis programs.
.Ss check
This goal runs unit test programs.
.Ss install
This goal installs everything that is installable.
.Ss uninstall
This goal removes everything that is installable.
.Ss dist
This goal produces a release archive, or archives.
.Ss distclean
This goal is a superset of clean, removing some files that require a ZMK installation to recreate.
.Ss distcheck
This goal is a superset of dist which produces and tests the release archive.
.Sh VARIABLES
ZMK provides several variables out of the box, even without importing
any additional modules. Those are listed below.
.Ss Project.Name
Name of the software distribution project. This value is typically used for
release archives but it shows up in several other places.
.Ss Project.Version
Version of the project. The value is sometimes interpolated into generated
files. It is also used for release archives. It can be modified
programmatically by the
.Nm GitVersion
module.
.Ss NAME
Compatibility alias for
.Nm Project.Name
.Ss VERSION
Compatibility alias for
.Nm Project.Version
.Ss ZMK.Version
Version of the included zmk library.
.Ss ZMK.Path
Path of the included zmk library. This is used to locate modules to import.
.Ss ZMK.DistFiles
List of files to place into release archives so that the recipient need not
install zmk on their system to build the project from source.
.Ss ZMK.SrcDir
Location of the source tree, when building out-of-tree. This is rarely needed
as out-of-tree builds are supported by all the modules bundled with zmk.
.Ss ZMK.IsOutOfTreeBuild
If building out-of-tree, a non-empty word indicating truth. This is rarely
required but may be of use in specific circumstances. One such example is the
makefile of zmk itself, where certain directories that are present in the
version control system need to be created and removed when building
out-of-tree.
.Ss ZMK.OutOfTreeSourcePath
When building out-of-tree, the full path, including the trailing slash, of the
source directory. This may be a relative path.
.Ss ZMK.ImportedModules
The set of modules imported so far. This can be used for diagnostic purposes.
Please import modules by calling
.Ss ZMK.BugFixes
A list of bug identifiers representing the set of bugs that are resolved in
zmk. Membership test can be used to conditionally enable hot-fixes that patch
a part of ZMK in a given project, when upgrading zmk itself is not feasible.
.Nm ZMK.Import .
.Ss VPATH
When building out-of-tree, ZMK sets
.Nm VPATH
to the out-of-tree source path. This allows make implicit and built-in rules to
find the source code without modification.
.Sh INTERNAL VARIABLES
.Ss ZMK.z.mk
Path of the entry point of the zmk library.
.Ss ZMK.comma
Variable expanding to a comma.
.Ss ZMK.newline
Variable expanding to a newline.
.Ss ZMK.hash
Variable expanding to a hash-or-pound symbol.
.Sh HISTORY
The primary interface of zmk was first documented zmk 0.4
.Sh AUTHORS
.An "Zygmunt Krynicki" Aq Mt me@zygoon.pl
zmk-0.5.1/man/zmk.AllClean.5.in 0000664 0001750 0001750 00000001710 13736672702 014563 0 ustar zyga zyga .Dd May 3, 2020
.Os zmk @VERSION@
.Dt zmk.AllClean 5 PRM
.Sh NAME
.Nm AllClean
.Nd template for files that can built and cleaned
.Sh SYNOPSIS
.Bd -literal
include z.mk
$(eval $(call ZMK.Expand,AllClean,instanceName))
.Ed
.Sh DESCRIPTION
The
.Nm AllClean
template once
.Em expanded
with a target
.Em instance name
makes
.Nm all
depend on
.Nm $(instanceName) ,
and makes
.Nm clean
remove
.Nm $(instanceName) .
It can be used to avoid duplicating the same two rules across many
buildable entities. It is used internally by other templates.
.Pp
Actual rules for building
.Nm $(instanceName)
need to be provided separately.
.Sh TARGETS
This module provides the following targets.
.Ss all
This
.Em phony
target depends on
.Nm $(instanceName) .
.Ss clean
This
.Em phony
target removes
.Nm $(instanceName) .
.Sh VARIABLES
This module does not provide any variables.
.Sh HISTORY
The
.Nm
template first appeared in zmk 0.3
.Sh AUTHORS
.An "Zygmunt Krynicki" Aq Mt me@zygoon.pl
zmk-0.5.1/man/zmk.Configure.5.in 0000664 0001750 0001750 00000020036 14027615611 015021 0 ustar zyga zyga .Dd Dec 28, 2020
.Os zmk @VERSION@
.Dt zmk.Configure.5 PRM
.Sh NAME
.Nm Configure
.Nd module providing build time configuration system
.Sh SYNOPSIS
.Bd -literal
include z.mk
$(eval $(call ZMK.Import,Configure))
.Ed
.Sh DESCRIPTION
The
.Nm
module provides two sides of the build-time configuration system. On one hand
side it provides the familiar
.Em configure
script, which can be used to set up various settings, prepare a directory for
.Em out-of-tree build ,
and integrate with project specific configuration settings. On the other hand
it exposes the collected information as a set of variables, allowing the rest
of the build system to modify its behavior accordingly.
.Sh TARGETS
This module provides the following targets.
.Ss configure
This target generates the configuration script. The script is also
automatically placed inside the source archive, so that the recipient
does not need to have a local installation of
.Em zmk
to build a project from source.
.Ss config.$(NAME).mk
This target is named after the configuration file created by the
.Nm configure
script. The rules are such, that if the configure script is newer than the
configuration file, then the script is re-executed to generate a possibly
updated configuration file.
.Ss distclean
This
.Em phony
target removes the configuration file
.Nm config.$(NAME).mk .
In
.Em maintainer mode ,
the configuration file is also removed.
.Sh VARIABLES
This module provides the following variables.
.Ss Configure.HostArchTriplet
This variable is set by the
.Nm configure
script when invoked with the
.Em --host=...
option. It represents the
.Em triplet
describing the system which will eventually execute
the compiled binaries. This is in contrast to the system that
is preforming the build.
.Pp
Unlike in
.Em autoconf
this variable is not set automatically. It is usually provided by
.Em Linux distribution packaging
which follows the up-to-date conventions on architecture triplet names.
The triplet contains three components, separated by dashes, the
.Em CPU architecture ,
.Em Kernel name
and
.Em Operating System name .
Popular values include
.Em x86_64-linux-gnu ,
.Em aarch64-linux-gnu
and
.Em riscv64-linux-gnu .
Note that there is a lot of variability in the architecture name and special
cases related to the ARM architecture.
.Ss Configure.BuildArchTriplet
This variable is set by the
.Nm configure
script when invoked with the
.Em --build=...
option. It represents the
.Em triplet
describing the system which is performing the build process. This is in
contrast to the system that will execute the built binaries.
.Pp
When both
.Nm Configure.HostArchTriplet
and
.Nm Configure.BuildArchTriplet
are set and their values differ and
when
.Nm CC
and
.Nm CXX
are not overridden, then zmk automatically selects a
.Em cross-compiler
from the
.Em GNU Compiler Collection
named
.Em $(Configure.HostArchTriplet)-gcc
and
.Em $(Configure.HostArchTriplet)-g++
for the C and C++ compilers, respectively.
.Ss Configure.TargetArchTriplet
This variable is set by the
.Nm configure
script when invoked with the
.Em --target=...
option. It represents the
.Em triplet
describing the system for which any generated code will be made. This variable
is needed infrequently, usually by tools such as compilers, to prepare them for
creating binary code for a given architecture.
.Ss Configure.SysRoot
This variable is set by the
.Nm configure
script when invoked with the
.Em --with-libtool-sysroot=...
option. It represents the explicit root directory of the file system where the
compiler should look for libraries and headers. It is typically used during
cross-compilation, to isolate the build process from whatever headers and
libraries are installed natively on the system.
.Ss Configure.DependencyTracking
This variable is controlled by the
.Nm configure
script options
.Em --enable-dependency-tracking
(default) and
.Em --disable-dependency-tracking .
When enabled it expands to
.Em yes
and causes compatible compilers to generate dependency information when
compiling source files, that is subsequently used by Make to understand
relationship between all the source files and object files.
.Pp
When performing pristine builds in a scratch environment that does not
contain any old object files, this setting can be disabled to speed up the
build a little.
.Ss Configure.MaintainerMode
This variable is controlled by the
.Nm configure
script options
.Em --enable-maintainer-mode
(default) and
.Em --disable-maintainer-mode .
When enabled it expands to
.Em yes
and impacts the
.Nm configure
and
.Nm config.$(NAME).mk
targets as described earlier.
.Ss Configure.SilentRules
This variable is controlled by the
.Nm configure
script options
.Em --enable-silent-rules
and
.Em --disable-silent-rules
(default). When enabled it expands to
.Em yes
and silences make rules defined by zmk.
.Ss Configure.StaticLibraries
This variable is controlled by the
.Nm configure
script options
.Em --enable-static
(default) and
.Em --disable-static .
When static libraries are disabled the template
.Nm Library.A
becomes inactive.
.Ss Configure.DynamicLibraries
This variable is controlled by the
.Nm configure
script options
.Em --enable-dynamic
(default) and
.Em --disable-dynamic .
When dynamic libraries are disabled the templates
.Nm Library.So
and
.Nm Library.DyLib
become inactive.
.Ss Configure.ProgramPrefix
This variable is set by the
.Nm configure
script when invoked with the
.Em --program-prefix=...
option.
.Pp
The argument is the prefix added to installed name of all the programs built
with the
.Nm Program
and the
.Nm Script
templates.
.Ss Configure.ProgramSuffix
This variable is set by the
.Nm configure
script when invoked with the
.Em --program-suffix=...
option.
.Pp
The argument is the suffix added to installed name of all the programs built
with the
.Nm Program
and the
.Nm Script
templates.
.Ss Configure.ProgramTransformName
This variable is set by the
.Nm configure
script when invoked with the
.Em --program-transform-name=...
option.
.Pp
The argument is a sed expression used to transform the installed name of all
the programs built with the
.Nm Program
and the
.Nm Script
templates. The transformation affects the entire name, together with any
prefix or suffix defined by their options.
.Ss Configure.Configured
This variable expands to
.Em yes
when the
.Nm configure
script was used to customize the build process. It can be used to offer
default behaviors that are appropriate to a given project, without
interacting with customizations performed by distribution packaging.
.Ss Configure.Options
This variable expands to the command line arguments passed to the
.Nm configure
script. It is used for automatic re-configuration supported by
.Em maintainer mode .
It can be also provided to the
.Em pre-processor
to embed the information about build-time configuration into the application
or library binary.
.Sh FILES
.Ss configure
Automatically generated POSIX shell script mimicking the appearance and
behavior of a similar file provided by GNU autoconf. This script should not be
committed to version control systems. This script is added to release archives,
as it allows one to compile a project from source without additionally
depending on zmk libraries.
.Ss config.$(NAME).mk
Project specific configuration file generated by executing the
.Nm configure script.
.Sh EXAMPLES
The
.Nm Configure
module is automatically imported and is implicitly available when templates
such as
.Nm Program
or
.Nm Script
are used. It does not require any additional input files. All customization
is available directly from the project makefile.
.Sh HISTORY
The
.Nm
module first appeared in zmk 0.3. Starting with version 0.4 the configuration
module provides the configure script and configuration persistence only to
projects which define their
.Nm
NAME .
.Sh BUGS
Versions prior to 0.4 used a fixed name for the configuration file created by
running the
.Em configure
script, namely
.Em GNUmakefile.configured.mk .
This caused issues with make's PATH traversal when searching for include
candidates that was resolved by using configuration files specific to a given
project, called
.Em config.$(NAME).mk .
.Sh AUTHORS
.An "Zygmunt Krynicki" Aq Mt me@zygoon.pl
zmk-0.5.1/man/zmk.Coverity.5.in 0000664 0001750 0001750 00000005262 14027615611 014710 0 ustar zyga zyga .Dd Jan 8 2021
.Os zmk @VERSION@
.Dt zmk.Coverity 5 PRM
.Sh NAME
.Nm Coverity
.Nd Module for interacting with Coverity static analysis tool
.Sh SYNOPSIS
.Bd -literal
include z.mk
# additional definitions required
$(eval $(call ZMK.Import,Coverity))
.Ed
.Sh DESCRIPTION
The module
.Nm Coverity
allows preparing and uploading scan artifacts to a hosted coverity instance.
.Sh TARGETS
This module provides the following targets.
.Ss upload-coverity-scan
This
.Em phony
target uses
.Nm curl
to upload the archived scan artifacts to the coverity scanning service.
.Ss clean
This
.Em phony
target removes the
.Nm cov-int
directory as well as the
.Nm cov-int.$(NAME)-$(VERSION).tar.gz
archive.
.Ss cov-int
This target invokes the
.Nm cov-build
program to forcibly re-build the whole project and collect information for analysis.
.Ss cov-int.$(NAME)-$(VERSION).tar.gz
This target archives the
.Nm cov-int
directory.
.Sh VARIABLES
This module provides the following variables.
.Ss Coverity.Sources
List of source files to consider as analysis dependency.
.Pp
There is no default value. This variable must be set before importing the
module.
.Ss Coverity.ProjectName
Name of the project registered on the Coverity instance
.Pp
There is no default value. This variable must be set before importing the
module.
.Ss Coverity.Email
E-mail address of the project maintainer, as registered on the Coverity
instance.
.Pp
There is no default value. This variable must be set before importing the
module.
.Ss Coverity.Token
The token used to authorize uploads of scan artifacts.
.Pp
There is no default value. This variable must be set before importing the
module.
.Ss Coverity.ScanURL
The URL used for submitting scan artifacts.
.Pp
The default value is
.Em https://scan.coverity.com/builds
.Sh BUGS
This module uses recursive make invocation and is therefore not safe to execute
concurrently with other scanners that use this strategy.
.Sh EXAMPLES
The following example shows how Coverity can be used to scan a sample project.
The code assumes that local installation of coverity scanner is in
.Em /opt/cov-analysis-linux64-2019.03 .
The project name, maintainer email are provided in-line but the authentication
token is expected to be provided through the environment variable
.Nm COVERITY_TOKEN .
.Bd -literal
include z.mk
COVERITY_TOKEN ?=
ifneq (,$(COVERITY_TOKEN)) # enable coverity if secret token is available
Coverity.Sources=foo.c
Coverity.ProjectName=foo
Coverity.Email=maintainer@example.com
Coverity.Token=$(COVERITY_TOKEN)
cov-int: PATH := $(PATH):/opt/cov-analysis-linux64-2019.03/bin
$(eval $(call ZMK.Import,Coverity))
endif
.Ed
.Sh HISTORY
The
.Nm
module first appeared in zmk 0.1
.Sh AUTHORS
.An "Zygmunt Krynicki" Aq Mt me@zygoon.pl
zmk-0.5.1/man/zmk.Directories.5.in 0000664 0001750 0001750 00000011267 13773062345 015371 0 ustar zyga zyga .Dd May 3, 2020
.Os zmk @VERSION@
.Dt zmk.Directories 5 PRM
.Sh NAME
.Nm Directories
.Nd module providing names and rules for common directories
.Sh SYNOPSIS
.Bd -literal
include z.mk
$(eval $(call ZMK.Import,Directories))
.Ed
.Sh DESCRIPTION
The module
.Nm
provides names and rules for commonly used directories. Is is used indirectly
by other targets, to know where to install files of various types, but can be
also imported and used directly for custom rules.
.Pp
All directories are derived from the value of
.Nm prefix .
The default value is
.Em /usr/local ,
which is suitable for locally-built and installed software packages.
Linux distribution packages are compiled with prefix of
.Em /usr ,
along with dedicated values of
.Nm sysconfdir
and other variables. This customization is usually handled by invoking the
.Em configure
script with specific command-line options.
.Sh TARGETS
This module provides targets that create all the directories mentioned below,
also taking into account the
.Nm $(DESTDIR)
variable.
.Sh VARIABLES
This module provides the following variables.
.Ss DESTDIR
Temporary staging location used while building software packages. It is
prepended to all installation targets, to allow them to be redirected to
another directory, usually without root privileges.
.Ss prefix
Prefix of all the other directories.
.Pp
The default value is
.Em /usr/local .
.Ss exec_prefix
Prefix of directories where executables are installed.
.Pp
The default value is
.Em $(prefix) .
.Ss bindir
Directory with programs available to all users.
.Pp
The default value is
.Em $(exec_prefix)/bin .
.Ss sbindir
Directory with programs available to system administrators.
.Pp
The default value is
.Em $(exec_prefix)/sbin .
.Ss libexecdir
Directory with programs used not directly invoked by the user.
.Pp
The default value is
.Em $(exec_prefix)/libexec .
.Pp
This directory differs between two major distribution lines, RedHat and Debian
and their respective derivatives. The former uses
.Em /usr/libexec
while the latter uses
.Em /usr/lib .
.Ss datarootdir
Directory several classes of data files.
.Pp
The default value is
.Em $(prefix)/share .
.Ss datadir
Directory with architecture independent data files.
.Pp
The default value is
.Em $(datarootdir) .
.Ss sysconfdir
Directory with system configuration files.
.Pp
The default value is
.Em $(prefix)/etc .
.Pp
In distribution packaging this directory is typically overridden to be detached
from prefix and hold the literal value
.Em /etc .
.Ss sharedstatedir
Directory with system state shared among machines on the network.
Virtually extinct, do not use it.
.Pp
The default value is
.Em $(prefix)/com .
.Ss localstatedir
Directory with persistent system state, private to the current machine.
.Pp
The default value is
.Em $(prefix)/var .
.Ss runstatedir
Directory with ephemeral system state, private to the current machine.
.Pp
The default value is
.Em $(prefix)/run .
.Ss includedir
Directory with C, C++ and Objective C header files.
.Pp
The default value is
.Em $(prefix)/include .
.Ss docdir
Directory with documentation specific to the project.
.Pp
The default value is
.Em $(prefix)/doc/$(Project.Name) .
Since the value depends on Project.Name, it is only defined
when Project.Name is non-empty.
.Ss infodir
Directory with documentation in the Info format.
.Pp
The default value is
.Em $(prefix)/doc/info .
.Ss libdir
Directory with static or dynamic libraries.
.Pp
The default value is
.Em $(exec_prefix)/lib .
.Pp
This directory differs between Linux distributions. Some distributions
differentiate between 32bit and 64bit libraries while others store libraries in
a directory named after the architecture triplet they are compiled for. It is
common for one system to use a mixture of directories used at the same time,
mainly to adhere to file system hierarchy standards.
.Ss localedir
Directory with localization catalogs, including message translation tables.
.Pp
The default value is
.Em $(datarootdir)/locale .
.Ss mandir
Directory root for manual pages. Actual manual pages are stored
in sub-directories named after the manual section number.
.Pp
The default value is
.Em $(datarootdir)/man .
.Ss man1dir .. man9dir
Directory with manual pages of a specific section.
.Pp
The default value is
.Em $(mandir)/man1
\&..
.Em $(mandir)/man9 .
.Sh EXAMPLES
The following example illustrates a way to install the program
.Em foo
to the directory with programs available to all the users. The
.Em order-only
prerequisite ensures that the target directory is created.
.Bd -literal -offset indent
include z.mk
$(eval $(call ZMK.Import,Directories))
$(DESTDIR)$(bindir)/foo: foo | $(DESTDIR)$(bindir)
install $< $@
.Ed
.Sh HISTORY
The
.Nm
module first appeared in zmk 0.3
.Sh AUTHORS
.An "Zygmunt Krynicki" Aq Mt me@zygoon.pl
zmk-0.5.1/man/zmk.Library.A.5.in 0000664 0001750 0001750 00000001034 14027615611 014660 0 ustar zyga zyga .Dd Feb 2, 2021
.Os zmk @VERSION@
.Dt zmk.Library.A 5 PRM
.Sh NAME
.Nm Library.A
.Nd template for compiling C/C++/ObjC static libraries
.Sh SYNOPSIS
.Bd -literal
include z.mk
# libName is any valid identifier.
libName.a.Sources = hello.c
$(eval $(call ZMK.Expand,Library.A,libName.a))
.Ed
.Sh DESCRIPTION
This manual page is a stub.
.Pp
When
.Nm configure
script is invoked with
.Em --disable-static
then this template behaves as if it was empty.
.Sh TARGETS
.Sh VARIABLES
.Sh HISTORY
.Sh AUTHORS
.An "Zygmunt Krynicki" Aq Mt me@zygoon.pl
zmk-0.5.1/man/zmk.Library.DyLib.5.in 0000664 0001750 0001750 00000001064 14027615611 015506 0 ustar zyga zyga .Dd Feb 2, 2021
.Os zmk @VERSION@
.Dt zmk.Library.DyLib 5 PRM
.Sh NAME
.Nm Library.So
.Nd template for compiling C/C++/ObjC shared Mach-O libraries
.Sh SYNOPSIS
.Bd -literal
include z.mk
# libName is any valid identifier.
libName.dylib.Sources = hello.c
$(eval $(call ZMK.Expand,Library.DyLib,libName.dylib))
.Ed
.Sh DESCRIPTION
This manual page is a stub.
.Pp
When
.Nm configure
script is invoked with
.Em --disable-shared
then this template behaves as if it was empty.
.Sh TARGETS
.Sh VARIABLES
.Sh HISTORY
.Sh AUTHORS
.An "Zygmunt Krynicki" Aq Mt me@zygoon.pl
zmk-0.5.1/man/zmk.Library.So.5.in 0000664 0001750 0001750 00000001045 14027615611 015063 0 ustar zyga zyga .Dd Feb 2, 2021
.Os zmk @VERSION@
.Dt zmk.Library.So 5 PRM
.Sh NAME
.Nm Library.So
.Nd template for compiling C/C++/ObjC shared ELF libraries
.Sh SYNOPSIS
.Bd -literal
include z.mk
# libName is any valid identifier.
libName.so.Sources = hello.c
$(eval $(call ZMK.Expand,Library.So,libName.so))
.Ed
.Sh DESCRIPTION
This manual page is a stub.
.Pp
When
.Nm configure
script is invoked with
.Em --disable-shared
then this template behaves as if it was empty.
.Sh TARGETS
.Sh VARIABLES
.Sh HISTORY
.Sh AUTHORS
.An "Zygmunt Krynicki" Aq Mt me@zygoon.pl
zmk-0.5.1/man/zmk.OS.5.in 0000664 0001750 0001750 00000003066 13736672702 013437 0 ustar zyga zyga .Dd May 3, 2020
.Os zmk @VERSION@
.Dt zmk.OS 5 PRM
.Sh NAME
.Nm OS
.Nd module providing operating system information
.Sh SYNOPSIS
.Bd -literal
include z.mk
$(eval $(call ZMK.Import,OS))
.Ed
.Sh DESCRIPTION
The module
.Nm
provides information about the operating system executing zmk. It can be used
to provide tailored behavior and account for differences between UNIX flavours.
.Sh TARGETS
This module does not provide any targets.
.Sh VARIABLES
This module provides the following variables.
.Ss OS.Kernel
Identifier of the operating system kernel.
.Pp
Known values are listed in the following table.
\# See tbl(1) for explanation of the syntax.
.TS
tab(:) box;
cb | cb
r | l .
Value:Description
=:=
Darwin:The MacOS kernel
FreeBSD:The FreeBSD kernel
GNU/kFreeBSD:The FreeBSD kernel with GNU userspace
GNU:The Hurd kernel
Linux:All Linux kernel
NetBSD:The NetBSD kernel
OpenBSD:The OpenBSD kernel
SunOS:The Solaris kernel
Windows_NT:The Windows kernel
Haiku:The Haiku kernel
.TE
.Ss OS.ImageFormat
Identifier or the application image format used.
.TS
tab(:) box;
cb | cb
r | l .
Value:Description
=:=
ELF:Used by most UNIX-like systems, except Darwin
Mach-O:Used by MacOS
PE:Used by Windows
MZ:Used by DOS
.TE
.Pp
Due to
.Em cross-compiling
it is more useful to look at
.Nm Toolchain.ImageFormat
instead.
.Sh IMPLEMENTATION NOTES
Windows is detected by the presence and specific value of the
.Nm OS
environment variable. All other kernels are identified by invoking
.Em uname -s .
.Sh HISTORY
The
.Nm
module first appeared in zmk 0.1
.Sh AUTHORS
.An "Zygmunt Krynicki" Aq Mt me@zygoon.pl
zmk-0.5.1/man/zmk.Program.5.in 0000664 0001750 0001750 00000007512 13744101003 014501 0 ustar zyga zyga .Dd May 3, 2020
.Os zmk @VERSION@
.Dt zmk.Program 5 PRM
.Sh NAME
.Nm Program
.Nd template for compiling C/C++/ObjC programs
.Sh SYNOPSIS
.Bd -literal
include z.mk
# programName is any valid identifier.
programName.Sources = hello.c
$(eval $(call ZMK.Expand,Program,programName))
.Ed
.Sh DESCRIPTION
The template
.Nm Program
once
.Em expanded
with a
.Em program name
to creates rules for compiling, cleaning, installing and removing a single
program written in C, C++ or Objective C.
.Pp
Source files are compiled to object files prefixed with
.Em $(programName)- ,
so that a single source file can be compiled separately with
distinct preprocessor, compiler and linker options.
.Pp
When cross-compiling for
.Em Windows
or
.Em DOS ,
the
.Em $(exe)
variable expands to
.Em .exe
.Sh TARGETS
This module provides the following targets.
.Ss $(programName)$(exe)
This target represents the program executable.
.Ss all
This
.Em phony
target depends on
.Em $(programName)$(exe)
.Ss clean
This
.Em phony
target removes
.Em $(programName)$(exe)
as well as constituent
.Em object files
and
.Em dependency files .
.Ss install
This
.Em phony
target copies
.Em $(programName)
to
.Em $(programName.InstallDir) ,
with the name
.Em $(programName.InstallName)
and mode
.Em $(programName.InstallMode) .
The target directory is automatically created if required.
.Pp
The variables
.Nm Configure.ProgramPrefix ,
.Nm Configure.ProgramSuffix
and
.Nm Configure.ProgramTransformName
automatically impact the installed names of all the programs.
.Ss uninstall
This
.Em phony
target removes
.Em $(programName)$(exe)
as installed by the
.Em install
target.
.Sh VARIABLES
This module provides the following variables.
.Ss $(programName).Sources
List of source files to compile.
.Pp
There is no default value. This variable must be set before
.Em expanding
the template.
.Ss $(programName).Objects
List of object files to link.
.Pp
The default value is all the elements of
.Em $(programName).Sources
with the added prefix
.Em $(programName)-
and with the extension replaced by
.Em .o .
.Ss $(programName).Linker
Linker required to link object files together.
.Pp
The default value depends on the type of source files used, ensuring that C++
sources are linked with the C++ linker.
.Ss $(programName).InstallDir
The directory
.Em $(programName)$(exe)
is installed to.
.Pp
The default value is
.Em $(bindir)
but
.Em $(sbindir)
or
.Em $(libexecdir)
are commonly used as well. The special value
.Em noinst
disables the rules related to installation and uninstallation.
.Ss $(programName).InstallName
The name of the program after installation.
.Pp
The default value is
.Em $(programName)
.Ss $(programName).InstallMode
The UNIX mode
.Em $(programName)$(exe)
is installed with.
.Pp
The default value is
.Em 0755 .
.Ss DESTDIR
Path added to all installation targets.
.Pp
This variable is normally set externally, to install a compiled program
into a staging area during construction of a compiled binary package.
.Ss CFLAGS, CXXFLAGS, OBJCFLAGS
Options for the C, C++ and the Objective C compiler, respectively.
.Ss CPPFLAGS
Options for the preprocessor.
.Sh IMPLEMENTATION NOTES
.Nm
uses
.Nm InstallUninstall
to handle installation and removal.
The
.Nm exe
variable is automatically set to
.Em .exe
where appropriate.
.Sh EXAMPLES
With the following
.Em true_false.c
file:
.Bd -literal -offset indent-two
#include
int main(void) {
return EXIT_CODE;
}
.Ed
.Pp
The following
.Em Makefile
builds the classic programs
.Em true
and
.Em false .
.Bd -literal -offset indent-two
include z.mk
true.Sources = true_false.c
$(eval $(call ZMK.Expand,Program,true))
true$(exe): CPPFLAGS += -DEXIT_CODE=EXIT_SUCCESS
false.Sources = true_false.c
$(eval $(call ZMK.Expand,Program,false))
false$(exe): CPPFLAGS += -DEXIT_CODE=EXIT_FAILURE
.Ed
.Sh HISTORY
The
.Nm
template first appeared in zmk 0.1
.Sh AUTHORS
.An "Zygmunt Krynicki" Aq Mt me@zygoon.pl
zmk-0.5.1/man/zmk.Script.5.in 0000664 0001750 0001750 00000004510 13736672702 014355 0 ustar zyga zyga .Dd May 3, 2020
.Os zmk @VERSION@
.Dt zmk.Script 5 PRM
.Sh NAME
.Nm Script
.Nd template for describing interpreted scripts
.Sh SYNOPSIS
.Bd -literal
include z.mk
# scriptName is the name of the script file
$(eval $(call ZMK.Expand,Program,scriptName))
.Ed
.Sh DESCRIPTION
The template
.Nm Script
once
.Em expanded
with a
.Em script name
to creates rules for installing and removing a single script written in an
interpreted programming language.
.Pp
If the script is a
.Em shell script
then it can be automatically checked with
.Nm shellcheck ,
if available.
.Sh TARGETS
This module provides the following targets.
.Ss install
This
.Em phony
target copies
.Em $(scriptName)
to
.Em $(scriptName.InstallDir) ,
with the name
.Em $(scriptName.InstallName)
and mode
.Em $(scriptName.InstallMode) .
The target directory is automatically created if required.
.Pp
The variables
.Nm Configure.ProgramPrefix ,
.Nm Configure.ProgramSuffix
and
.Nm Configure.ProgramTransformName
automatically impact the installed names of all the scripts.
.Ss uninstall
This
.Em phony
target removes
.Em $(scriptName)
as installed by the
.Em install
target.
.Ss static-check-shellcheck
This
.Em phony
target uses
.Nm shellcheck
to perform static analysis of compatible scripts.
.Ss static-check
This
.Em phony
target depends on the target
.Nm static-check-shellcheck .
.Sh VARIABLES
This module provides the following variables.
.Ss $(scriptName).Interpreter
Name of the script interpreter.
.Pp
The default value is inferred from the extension of the file name.
.Ss $(scriptName).InstallDir
The directory
.Em $(scriptName)
is installed to.
.Pp
The default value is
.Em $(bindir) .
The special value
.Em noinst
disables the rules related to installation and uninstallation.
.Ss $(scriptName).InstallName
The name of the script after installation.
.Pp
The default value is
.Em $(scriptName)
.Ss $(scriptName).InstallMode
The UNIX mode
.Em $(scriptName)
is installed with.
.Pp
The default value is
.Em 0755 .
.Ss DESTDIR
Path added to all installation targets.
.Pp
This variable is normally set externally, to install a compiled program
into a staging area during construction of a compiled binary package.
.Sh IMPLEMENTATION NOTES
.Nm
uses
.Nm InstallUninstall
to handle installation and removal.
.Sh HISTORY
The
.Nm
template first appeared in zmk 0.1
.Sh AUTHORS
.An "Zygmunt Krynicki" Aq Mt me@zygoon.pl
zmk-0.5.1/man/zmk.Silent.5.in 0000664 0001750 0001750 00000003607 13773062345 014352 0 ustar zyga zyga .Dd October 21, 2020
.Os zmk @VERSION@
.Dt zmk.Silent 5 PRM
.Sh NAME
.Nm Silent
.Nd module for supporting silent rules
.Sh SYNOPSIS
.Bd -literal
include z.mk
$(eval $(call ZMK.Import,Silent))
.Ed
.Sh DESCRIPTION
The
.Nm Silent
module, once
.Em imported ,
provides functions and variables for supporting
.Em silent rules .
Silent rules are a configuration option, trading precision of the exact
commands used by the build system, for better visibility of warnings and other
output. When enabled, actual commands executed by Make are hidden and a
symbolic representation replaced with a symbolic representation devoid of
details.
.Pp
Silent rules are usually a configuration option of a specific build workspace.
To enable, execute the
.Em configure
script with the option
.Em --enable-silent-rules .
.Sh TARGETS
This module does not provide any targets.
.Sh VARIABLES
This module provides the following variables.
.Ss Silent.Active
The global silent mode toggle. Any non-empty value enables silent rules.
This is automatically configured by the
.Nm Configure
module.
.Ss Silent.Command
Expands to
.Em @
when silent rules are active. Can be placed in front of commands of a make rule
to cause make not to echo the command itself. It should be paired with
.Nm Silent.Say
for the complete experience.
.Ss Silent.Say
Function expanding to a shell command printing the 1st and 2nd argument.
The first argument should be the symbolic name of the tool, such as CC
or LD. The second argument should be the resulting file, i.e. $@.
.Sh EXAMPLES
A hypothetical rule for compiling .foo files to .fooobj files, supporting silent
rules, might look like this.
.Bd -literal -offset indent
include z.mk
$(eval $(call ZMK.Import,Silent))
%.fooobj: %.foo
$(eval $(call Silent.Say,FOOCC,$@))
$(Silent.Command)foocc -c $^ -o $@
.Ed
.Sh HISTORY
The
.Nm
module first appeared in zmk 0.4
.Sh AUTHORS
.An "Zygmunt Krynicki" Aq Mt me@zygoon.pl
zmk-0.5.1/man/zmk.Symlink.5.in 0000664 0001750 0001750 00000005060 14064705643 014534 0 ustar zyga zyga .Dd Jun 21, 2021
.Os zmk @VERSION@
.Dt zmk.Symlink 5 PRM
.Sh NAME
.Nm Symlink
.Nd template for creating symbolic links
.Sh SYNOPSIS
.Bd -literal
include z.mk
# "link" is any valid identifier.
link.SymlinkTarget = target
$(eval $(call ZMK.Expand,Symlink,link))
.Ed
.Sh DESCRIPTION
The template
.Nm Symlink
once
.Em expanded
with a
.Em link name
to creates rules for creating, removing, installing and removing a single
symbolic link to a given target file.
.Pp
This template behaves like the Program template, in that it creates the
symbolic link both locally, during development as well as when the project
is installed.
.Sh TARGETS
This module provides the following targets.
.Ss $(link)
This target represents the symbolic link
.Ss all
This
.Em phony
target depends on
.Em $(link)
.Ss clean
This
.Em phony
target removes
.Em $(link)
.Ss install
This target creates the symbolic link
.Em $(link)
in
.Em $(link.InstallDir) ,
with the name
.Em $(link.InstallName)
The target directory is automatically created if required.
.Ss uninstall
This
.Em phony
target removes
.Em $(link)
as installed by the
.Em install
target.
.Sh VARIABLES
This module provides the following variables.
.Ss $(link).SymlinkTarget
The target of the symbolic link.
.Pp
There is no default value. This variable must be set before
.Em expanding
the template.
.Ss $(programName).InstallDir
The directory
.Em $(link)
is installed to.
.Pp
There is no default value. This variable must be set before
.Em expanding
the template. To avoid installation set the install directory
to the special value
.Em noinst .
.Ss $(link).InstallName
The name of the program after installation.
.Pp
The default value is
.Em $(link)
with the directory part removed.
.Ss DESTDIR
Path added to all installation targets.
.Pp
This variable is normally set externally, to install a compiled program
into a staging area during construction of a compiled binary package.
.Sh BUGS
Prior to version 0.5.1, the
.Em install
target misbehaved when
.Em $(link)
contains a non-empty directory prefix. Incorrectly, the same prefix is
replicated, somewhat confusingly in the installed symlink.
.Pp
Consider this example:
.Bd -literal 4
include z.mk
subdir/link.SymlinkTarget = target
subdir/link.InstallDir = $(bindir)
$(eval $(call ZMK.Expand,Symlink,subdir/link))
.Ed
Running
.Em make install
on the following example would create the symbolic link
.Em $(bindir)/subdir/link -> target,
which was unexpected.
.Pp
This bug was given the identifier
.Em zmk-issue-80 .
.Sh HISTORY
The
.Nm
template first appeared in zmk 0.1
.Sh AUTHORS
.An "Zygmunt Krynicki" Aq Mt me@zygoon.pl
zmk-0.5.1/man/zmk.Toolchain.5.in 0000664 0001750 0001750 00000015433 14027615611 015025 0 ustar zyga zyga .Dd May 3, 2020
.Os zmk @VERSION@
.Dt zmk.Toolchain 5 PRM
.Sh NAME
.Nm Toolchain
.Nd module providing information and configuration about compiler toolchain
.Sh SYNOPSIS
.Bd -literal
include z.mk
$(eval $(call ZMK.Import,Toolchain))
.Ed
.Sh DESCRIPTION
The
.Nm
module encapsulates information about the used C and C++ compilers.
This knowledge is mainly consumed internally by other modules and
templates, but can be used directly to construct custom rules.
.Sh TARGETS
This module does not provide any targets.
.Sh VARIABLES
This module provides the following variables.
.Pp
Please take note that make supports
.Em target-specific variables ,
where a specific variable, for example
.Nm CFLAGS
or
.Nm LDLIBS
takes a particular value only while building a specific target as well as all
the targets that it depends on. This scheme is removes the need for additional
variables manually customized to a specific target.
.Ss CC
The C compiler.
.Ss CPP
The pre-processor, responsible for macros and include directives.
.Ss CXX
The C++ compiler.
.Ss CFLAGS
Configuration options for the C compiler.
.Pp
This variable should be used to pass options such as
.Em -Wall ,
.Em -O2 ,
or
.Em -fpic .
Please refer to your compiler manual for details.
.Pp
This variable is often abused, mainly for simplicity, as a kitchen-sink that
holds all of the compiler and linker options. This is discouraged.
.Ss CPPFLAGS
Configurations options for the pre-processor.
.Pp
This variable should be used to provide command line options that alter the include search path,
such as
.Em -I ,
or define a pre-processor macro, such as
.Em -D .
.Ss CXXFLAGS
Configuration options for the C++ compiler. This variable the equivalent of
.Nm CFLAGS
for the C++ compiler.
.Ss OBJCFLAGS
Configuration options for the Objective C compiler. This variable the
equivalent of
.Nm CFLAGS
for the Objective C compiler.
.Ss ARFLAGS
Configuration options for the
.Nm ar
program.
.Ss TARGET_ARCH
Compiler options for performing architecture selection.
.Pp
This variable is not used by zmk. Cross compilation is supported
by selecting a cross-compiling
.Nm CC
or
.Nm CXX .
.Ss LDLIBS
Additional libraries to link with.
.Pp
Libraries are provided in the form
.Em -lfoo
where
.Em foo
is the name of the library, without the prefix
.Em lib .
Given the choice of static and dynamic libraries, the linker will prefer
dynamic linking. You can a specific library statically with the following option
sequence.
.Em -Wl,-dn -lfoo -Wl,-dy .
The first segment
.Em -Wl,-dn
turns off dynamic linking
.Em -lfoo
links to the library
.Em libfoo.a
while the final
.Em -Wl,-dy
turns dynamic linking back again. Note that using this sequence the final
executable is not entirely statically linked. If
.Em libfoo.a
has any additional dependences those must be linked as well, either dynamically
or statically.
.Ss LDFLAGS
Configuration options for the linker.
.Pp
This variable should be used to provide command line options that alter the
linker search path, such as
.Em -L ,
or customize linker behavior. Note that the linker is not invoked directly, but
through the compiler front-end. For example, when using gcc, one would
typically pass
.Em -Wl,foo
in order to pass the option
.Em foo
to the linker.
.Ss exe
The suffix for executables. It is either empty or has the value
.Em .exe ,
if the
.Em image format
of the resulting executable is either
.Nm PE
or
.Nm MZ .
.Pp
This variable is automatically used by zmk when building executables.
\#
\# The following variables are specific to zmk.
\#
.Ss Toolchain.SysRoot
Path of the root directory where the compiler looks for
headers and libraries. A non-empty value causes
.Em --sysroot=$(Toolchain.SysRoot)
to be passed to the compiler whenever it is used for
compiling, linking or pre-processing.
.Pp
The default value is
.Em $(Configure.SysRoot) ,
namely the preference from the configuration system.
.Ss Toolchain.DependencyTracking
Expands to
.Em yes ,
if compilation of C, C++ and Objective C source files
will automatically generate dependency rules for Make.
.Pp
The default value is
.Em $(Configure.DependencyTracking) ,
namely the preference from the configuration system.
.Ss Toolchain.ImageFormat
Identifier or the application image format generated by
.Em both
the C compiler or the C++ compiler. If the two compilers produce different
image formats, for example because one is a
.Em cross-compiler
the effective value is
.Em Mixed .
.Ss Toolchain.IsCross
Expands to
.Em yes
if programs created by
.Em either
the C compiler or the C++ compiler cannot be executed on the machine
performing the build.
\#
\# Toolchain detection flags.
\#
.Ss Toolchain.IsGcc
Expands to
.Em yes ,
if both the C and C++ compilers are from the
.Em GNU Compiler Collection .
.Ss Toolchain.IsClang
Expands to
.Em yes ,
if both the C and C++ compilers are from the
.Em clang
project.
.Ss Toolchain.IsWatcom
Expands to
.Em yes ,
if both the C and C++ compilers are from the
.Em Open Watcom
compiler.
\#
\# Variables specific to either the C or the C++ compiler.
\#
.Ss Toolchain.CC.IsAvaiable
Expands to
.Em yes
if the C compiler is available.
.Ss Toolchain.CC.ImageFormat
Identifier or the application image format generated by the C
compiler. Refer to the documentation of
.Nm OS.ImageFormat
for a description of known formats.
.Pp
Unless
.Em cross-compiling ,
the default value is
.Em $(OS.ImageFormat) .
.Ss Toolchain.CC.IsCross
Expands to
.Em yes
if programs created by the C compiler cannot be executed on the
machine performing the build.
.Ss Toolchain.CC.IsGcc
Expands to
.Em yes ,
if the selected C compiler is the
.Em GNU Compiler Collection .
This variable, as well as several others documented below, can be
used to conditionally enable compiler specific options in a manner
that does not break when another compiler is used.
.Ss Toolchain.CC.IsClang
Expands to
.Em yes ,
if the selected C compiler is
.Em clang .
.Ss Toolchain.CC.IsWatcom
Expands to
.Em yes ,
if the selected C compiler is the
.Em Open Watcom
compiler.
.Ss Toolchain.CC.IsTcc
Expands to
.Em yes ,
if the selected C compiler is the
.Em Tiny C Compiler .
.Ss Toolchain.CXX.IsAvaiable
Expands to
.Em yes
if the C++ compiler is available.
.Ss Toolchain.CXX.ImageFormat
Identifier or the application image format generated by the C++ compiler.
.Pp
Unless
.Em cross-compiling ,
the default value is
.Em $(OS.ImageFormat) .
.Ss Toolchain.CXX.IsCross
Expands to
.Em yes
if programs created by the C++ compiler cannot be executed on the
machine performing the build.
.Ss Toolchain.CXX.IsGcc
Expands to
.Em yes ,
if the selected C++ compiler is the
.Em GNU Compiler Collection .
.Ss Toolchain.CXX.IsClang
Expands to
.Em yes ,
if the selected C++ compiler is
.Em clang .
.Ss Toolchain.CXX.IsWatcom
Expands to
.Em yes ,
if the selected C++ compiler is the
.Em Open Watcom
compiler.
.Sh EXAMPLES
.Sh HISTORY
The
.Nm
module first appeared in zmk 0.3
.Sh AUTHORS
.An "Zygmunt Krynicki" Aq Mt me@zygoon.pl
zmk-0.5.1/tests/Configure/Makefile 0000664 0001750 0001750 00000000107 14030055553 015547 0 ustar zyga zyga NAME=test
include z.mk
$(eval $(call ZMK.Import,Configure))
debug: ; zmk-0.5.1/tests/Configure/Test.mk 0000664 0001750 0001750 00000023456 14027615611 015376 0 ustar zyga zyga #!/usr/bin/make -f
include zmk/internalTest.mk
t:: \
configure-shellcheck \
configure-enable-option-checking \
configure-disable-option-checking \
debug-defaults \
debug-configure \
config-defaults \
config-build \
config-host \
config-target \
config-with-libtool-sysroot \
config-enable-dependency-tracking \
config-disable-dependency-tracking \
config-enable-maintainer-mode \
config-disable-maintainer-mode \
config-enable-silent-rules \
config-disable-silent-rules \
config-enable-static \
config-disable-static \
config-enable-dynamic \
config-disable-dynamic \
config-program-prefix \
config-program-suffix \
config-program-transform-name \
config-prefix \
config-exec-prefix \
config-exec_prefix \
config-bindir \
config-sbindir \
config-libdir \
config-libexecdir \
config-includedir \
config-oldincludedir \
config-mandir \
config-infodir \
config-sysconfdir \
config-datadir \
config-localstatedir \
config-runstatedir \
config-sharedstatedir \
# Test logs will contain debugging messages specific to the configure module
%.log: ZMK.makeOverrides += DEBUG=configure
# The configure script is generated.
configure: MAKEFLAGS=B
configure: Makefile $(ZMK.test.Path)/z.mk $(wildcard $(ZMK.test.Path)/zmk/*.mk)
$(MAKE) --no-print-directory -I $(ZMK.test.Path) -f $(ZMK.test.SrcDir)/Makefile $@
c::
rm -f configure
# The configure script writes a configuration file. Note that normally the file
# is config.$(NAME).mk but the test redirects that to a different file to
# enable parallelism.
configureOptions ?=
configureOptions += $(if $(ZMK.test.IsOutOfTreeBuild),ZMK.SrcDir=$(ZMK.test.SrcDir))
config.%.mk: configure Test.mk
$(strip ZMK_CONFIGURE_MAKEFILE=$@ ./$< $(configureOptions))
c::
rm -f config.*.mk
configure-shellcheck: configure
if [ "`command -v shellcheck`" != "" ]; then shellcheck $<; fi
configure-enable-option-checking: export ZMK_CONFIGURE_MAKEFILE=config.enable-option-checking.mk
configure-enable-option-checking: configure
./$< --enable-option-checking --foo 2>&1 | GREP -qFx 'configure: unknown option --foo'
! ./$< --enable-option-checking --foo 2>/dev/null
test ! -e $(ZMK_CONFIGURE_MAKEFILE)
configure-disable-option-checking: export ZMK_CONFIGURE_MAKEFILE=config.disable-option-checking.mk
configure-disable-option-checking: configure
./$< --disable-option-checking --foo
debug-defaults: debug-defaults.log
# Debug messages show the state of internal variables.
# Note that here we also measure the default values of an un-configured build.
GREP -qFx 'DEBUG: Configure.HostArchTriplet=' <$<
GREP -qFx 'DEBUG: Configure.BuildArchTriplet=' <$<
GREP -qFx 'DEBUG: Configure.TargetArchTriplet=' <$<
GREP -qFx 'DEBUG: Configure.SysRoot=' <$<
GREP -qFx 'DEBUG: Configure.DependencyTracking=yes' <$<
GREP -qFx 'DEBUG: Configure.MaintainerMode=yes' <$<
GREP -qFx 'DEBUG: Configure.SilentRules=' <$<
GREP -qFx 'DEBUG: Configure.StaticLibraries=yes' <$<
GREP -qFx 'DEBUG: Configure.DynamicLibraries=yes' <$<
GREP -qFx 'DEBUG: Configure.ProgramPrefix=' <$<
GREP -qFx 'DEBUG: Configure.ProgramSuffix=' <$<
GREP -qFx 'DEBUG: Configure.ProgramTransformName=' <$<
GREP -qFx 'DEBUG: Configure.Configured=' <$<
GREP -qFx 'DEBUG: Configure.Options=' <$<
debug-configure.log: ZMK.makeTarget=configure
debug-configure: debug-configure.log
# The configure script can be remade.
GREP -qFx 'echo "$${ZMK_CONFIGURE_SCRIPT}" >configure' <$<
config-defaults: config.defaults.mk
# Minimal defaults are set
GREP -qFx 'ZMK.SrcDir=$(ZMK.test.SrcDir)' <$<
GREP -qFx 'Configure.Configured=yes' <$<
GREP -qFx 'Configure.Options=$(if $(ZMK.test.IsOutOfTreeBuild),ZMK.SrcDir=$(ZMK.test.SrcDir))' <$<
# Other options are not explicitly set.
# Note the lack of whole-line matching (-x).
GREP -v -qF 'Configure.BuildArchTriplet=' <$<
GREP -v -qF 'Configure.HostArchTriplet=' <$<
GREP -v -qF 'Configure.TargetArchTriplet=' <$<
GREP -v -qF 'Configure.SysRoot=' <$<
GREP -v -qF 'Configure.DependencyTracking=' <$<
GREP -v -qF 'Configure.MaintainerMode=' <$<
GREP -v -qF 'Configure.SilentRules=' <$<
GREP -v -qF 'Configure.StaticLibraries=' <$<
GREP -v -qF 'Configure.DynamicLibraries=' <$<
GREP -v -qF 'Configure.ProgramPrefix=' <$<
GREP -v -qF 'Configure.ProgramSuffix=' <$<
GREP -v -qF 'Configure.ProgramTransformName=' <$<
config.build.mk: configureOptions += --build=foo-linux-gnu
config-build: config.build.mk
# configure --build= sets Configure.BuildArchTriplet
GREP -qFx 'Configure.BuildArchTriplet=foo-linux-gnu' <$<
GREP -qFx 'Configure.Options=$(if $(ZMK.test.IsOutOfTreeBuild),ZMK.SrcDir=$(ZMK.test.SrcDir) )--build=foo-linux-gnu' <$<
config.host.mk: configureOptions += --host=foo-linux-gnu
config-host: config.host.mk
# configure --host= sets Configure.HostArchTriplet
GREP -qFx 'Configure.HostArchTriplet=foo-linux-gnu' <$<
GREP -qFx 'Configure.Options=$(if $(ZMK.test.IsOutOfTreeBuild),ZMK.SrcDir=$(ZMK.test.SrcDir) )--host=foo-linux-gnu' <$<
config.target.mk: configureOptions += --target=foo-linux-gnu
config-target: config.target.mk
# configure --target= sets Configure.TargetArchTriplet
GREP -qFx 'Configure.TargetArchTriplet=foo-linux-gnu' <$<
GREP -qFx 'Configure.Options=$(if $(ZMK.test.IsOutOfTreeBuild),ZMK.SrcDir=$(ZMK.test.SrcDir) )--target=foo-linux-gnu' <$<
config.with-libtool-sysroot.mk: configureOptions += --with-libtool-sysroot=/path
config-with-libtool-sysroot: config.with-libtool-sysroot.mk
# configure --with-libtool-sysroot= sets Configure.SysRoot
GREP -qFx 'Configure.SysRoot=/path' <$<
GREP -qFx 'Configure.Options=$(if $(ZMK.test.IsOutOfTreeBuild),ZMK.SrcDir=$(ZMK.test.SrcDir) )--with-libtool-sysroot=/path' <$<
config.enable-dependency-tracking.mk: configureOptions += --enable-dependency-tracking
config-enable-dependency-tracking: config.enable-dependency-tracking.mk
# configure --enable-dependency-tracking sets Configure.DependencyTracking=yes
GREP -qFx 'Configure.DependencyTracking=yes' <$<
config.disable-dependency-tracking.mk: configureOptions += --disable-dependency-tracking
config-disable-dependency-tracking: config.disable-dependency-tracking.mk
# configure --disable-dependency-tracking sets Configure.DependencyTracking= (empty but set)
GREP -qFx 'Configure.DependencyTracking=' <$<
config.enable-maintainer-mode.mk: configureOptions += --enable-maintainer-mode
config-enable-maintainer-mode: config.enable-maintainer-mode.mk
# configure --enable-maintainer-mode sets Configure.MaintainerMode=yes
GREP -qFx 'Configure.MaintainerMode=yes' <$<
config.disable-maintainer-mode.mk: configureOptions += --disable-maintainer-mode
config-disable-maintainer-mode: config.disable-maintainer-mode.mk
# configure --disable-dependency-tracking sets Configure.MaintainerMode= (empty but set)
GREP -qFx 'Configure.MaintainerMode=' <$<
config.enable-silent-rules.mk: configureOptions += --enable-silent-rules
config-enable-silent-rules: config.enable-silent-rules.mk
# configure --enable-silent-rules sets Configure.SilentRules=yes
GREP -qFx 'Configure.SilentRules=yes' <$<
config.disable-silent-rules.mk: configureOptions += --disable-silent-rules
config-disable-silent-rules: config.disable-silent-rules.mk
# configure --disable-dependency-tracking sets Configure.SilentRules= (empty but set)
GREP -qFx 'Configure.SilentRules=' <$<
config.enable-static.mk: configureOptions += --enable-static
config-enable-static: config.enable-static.mk
# configure --enable-static sets Configure.StaticLibraries=yes
GREP -qFx 'Configure.StaticLibraries=yes' <$<
config.disable-static.mk: configureOptions += --disable-static
config-disable-static: config.disable-static.mk
# configure --disable-static sets Configure.StaticLibraries= (empty but set)
GREP -qFx 'Configure.StaticLibraries=' <$<
config.enable-dynamic.mk: configureOptions += --enable-dynamic
config-enable-dynamic: config.enable-dynamic.mk
# configure --enable-dynamic sets Configure.DynamicLibraries=yes
GREP -qFx 'Configure.DynamicLibraries=yes' <$<
config.disable-dynamic.mk: configureOptions += --disable-dynamic
config-disable-dynamic: config.disable-dynamic.mk
# configure --disable-dynamic sets Configure.DynamicLibraries= (empty but set)
GREP -qFx 'Configure.DynamicLibraries=' <$<
config.program-prefix.mk: configureOptions += --program-prefix=awesome-
config-program-prefix: config.program-prefix.mk
# configure --program-prefix=foo sets Configure.ProgramPrefix=foo
GREP -qFx 'Configure.ProgramPrefix=awesome-' <$<
config.program-suffix.mk: configureOptions += --program-suffix=-real
config-program-suffix: config.program-suffix.mk
# configure --program-suffix=foo sets Configure.ProgramSuffix=foo
GREP -qFx 'Configure.ProgramSuffix=-real' <$<
config.program-transform-name.mk: configureOptions += --program-transform-name=s/foo/bar/
config-program-transform-name: config.program-transform-name.mk
# configure --program-transform-name=foo sets Configure.ProgramTransformName=foo
GREP -qFx 'Configure.ProgramTransformName=s/foo/bar/' <$<
config.prefix.mk: configureOptions += --prefix=/foo
config-prefix: config.prefix.mk
# configure --prefix=/foo sets prefix=/foo
GREP -qFx 'prefix=/foo' <$<
config.exec-prefix.mk: configureOptions += --exec-prefix=/foo
config-exec-prefix: config.exec-prefix.mk
# configure --exec-prefix=/foo sets exec_prefix=/foo
GREP -qFx 'exec_prefix=/foo' <$<
config.exec_prefix.mk: configureOptions += --exec_prefix=/foo
config-exec_prefix: config.exec_prefix.mk
# configure --exec_prefix=/foo sets exec_prefix=/foo
GREP -qFx 'exec_prefix=/foo' <$<
dirs=bindir sbindir libdir libexecdir includedir mandir infodir sysconfdir datadir localstatedir runstatedir sharedstatedir
$(foreach d,$(dirs),config.$d.mk): configureOptions += --$*=/foo
$(addprefix config-,$(dirs)): config-%: config.%.mk
# configure --$*=/foo sets $*=/foo
GREP -qFx '$*=/foo' <$<
config.oldincludedir.mk: configureOptions += --oldincludedir=/unused
config-oldincludedir: config.oldincludedir.mk
# configure --oldincludedir=/unused doesn't do anything
GREP -v -qFx '/unused' <$<
zmk-0.5.1/tests/Configure/integration/Makefile 0000664 0001750 0001750 00000000127 14027615611 020077 0 ustar zyga zyga include z.mk
Project.Name=foo
Project.Version=1
$(eval $(call ZMK.Import,Configure))
zmk-0.5.1/tests/Configure/integration/Test.mk 0000664 0001750 0001750 00000000651 14027615611 017711 0 ustar zyga zyga #!/usr/bin/make -f
include zmk/internalTest.mk
t:: integration
# Test logs will contain debugging messages specific to the configure module
%.log: ZMK.makeOverrides += DEBUG=configure
integration: integration.log
GREP -qFx 'DEBUG: ZMK.SrcDir=$(ZMK.test.SrcDir)' <$<
GREP -qFx 'DEBUG: ZMK.IsOutOfTreeBuild=$(ZMK.test.IsOutOfTreeBuild)' <$<
GREP -qFx 'DEBUG: ZMK.OutOfTreeSourcePath=$(ZMK.test.OutOfTreeSourcePath)' <$<
zmk-0.5.1/tests/Directories/Makefile 0000664 0001750 0001750 00000000153 13736672702 016120 0 ustar zyga zyga include z.mk
$(eval $(call ZMK.Import,Directories))
debug:: $(addprefix $(DESTDIR),$(Directories.POSIX))
zmk-0.5.1/tests/Directories/Test.mk 0000664 0001750 0001750 00000011163 13773062345 015730 0 ustar zyga zyga #!/usr/bin/make -f
include zmk/internalTest.mk
t:: debug-defaults debug-name-defined debug-destdir debug-prefix \
debug-sysconfdir debug-libexecdir debug-silent-rules
# Test logs will contain debugging messages
%.log: ZMK.makeOverrides += DEBUG=directories,directory
debug-defaults: debug-defaults.log
GREP -qFx 'DEBUG: prefix=/usr/local' <$<
GREP -qFx 'install -d /usr' <$<
GREP -qFx 'install -d /usr/local' <$<
GREP -qFx 'install -d /usr/local/bin' <$<
GREP -qFx 'install -d /usr/local/sbin' <$<
GREP -qFx 'install -d /usr/local/libexec' <$<
GREP -qFx 'install -d /usr/local/share' <$<
GREP -qFx 'install -d /usr/local/etc' <$<
GREP -qFx 'install -d /usr/local/com' <$<
GREP -qFx 'install -d /usr/local/var' <$<
GREP -qFx 'install -d /usr/local/var/run' <$<
GREP -qFx 'install -d /usr/local/include' <$<
GREP -qFx 'install -d /usr/local/shareinfo' <$<
GREP -qFx 'install -d /usr/local/lib' <$<
GREP -qFx 'install -d /usr/local/share/locale' <$<
GREP -qFx 'install -d /usr/local/share/man' <$<
GREP -qFx 'install -d /usr/local/share/man/man1' <$<
GREP -qFx 'install -d /usr/local/share/man/man2' <$<
GREP -qFx 'install -d /usr/local/share/man/man3' <$<
GREP -qFx 'install -d /usr/local/share/man/man4' <$<
GREP -qFx 'install -d /usr/local/share/man/man5' <$<
GREP -qFx 'install -d /usr/local/share/man/man6' <$<
GREP -qFx 'install -d /usr/local/share/man/man7' <$<
GREP -qFx 'install -d /usr/local/share/man/man8' <$<
GREP -qFx 'install -d /usr/local/share/man/man9' <$<
debug-silent-rules.log: ZMK.makeOverrides += Silent.Active=yes
debug-silent-rules: debug-silent-rules.log
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr"' <$<
debug-name-defined.log: ZMK.makeOverrides += NAME=test
debug-name-defined: debug-name-defined.log
GREP -qFx 'install -d /usr/local/share/doc/test' <$<
debug-destdir.log: ZMK.makeOverrides += DESTDIR=/destdir
debug-destdir: debug-destdir.log
GREP -qFx 'DEBUG: prefix=/usr/local' <$<
GREP -qFx 'DEBUG: DESTDIR=/destdir' <$<
GREP -qFx 'mkdir -p /destdir' <$<
GREP -qFx 'install -d /destdir/usr/local' <$<
GREP -qFx 'install -d /destdir/usr/local/bin' <$<
GREP -qFx 'install -d /destdir/usr/local/sbin' <$<
GREP -qFx 'install -d /destdir/usr/local/libexec' <$<
GREP -qFx 'install -d /destdir/usr/local/share' <$<
GREP -qFx 'install -d /destdir/usr/local/etc' <$<
GREP -qFx 'install -d /destdir/usr/local/com' <$<
GREP -qFx 'install -d /destdir/usr/local/var' <$<
GREP -qFx 'install -d /destdir/usr/local/var/run' <$<
GREP -qFx 'install -d /destdir/usr/local/include' <$<
GREP -qFx 'install -d /destdir/usr/local/shareinfo' <$<
GREP -qFx 'install -d /destdir/usr/local/lib' <$<
GREP -qFx 'install -d /destdir/usr/local/share/locale' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man1' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man2' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man3' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man4' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man5' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man6' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man7' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man8' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man9' <$<
debug-prefix.log: ZMK.makeOverrides += prefix=/usr
debug-prefix: debug-prefix.log
GREP -qFx 'DEBUG: prefix=/usr' <$<
GREP -qFx 'install -d /usr' <$<
GREP -qFx 'install -d /usr/bin' <$<
GREP -qFx 'install -d /usr/sbin' <$<
GREP -qFx 'install -d /usr/libexec' <$<
GREP -qFx 'install -d /usr/share' <$<
GREP -qFx 'install -d /usr/etc' <$<
GREP -qFx 'install -d /usr/com' <$<
GREP -qFx 'install -d /usr/var' <$<
GREP -qFx 'install -d /usr/var/run' <$<
GREP -qFx 'install -d /usr/include' <$<
GREP -qFx 'install -d /usr/shareinfo' <$<
GREP -qFx 'install -d /usr/lib' <$<
GREP -qFx 'install -d /usr/share/locale' <$<
GREP -qFx 'install -d /usr/share/man' <$<
GREP -qFx 'install -d /usr/share/man/man1' <$<
GREP -qFx 'install -d /usr/share/man/man2' <$<
GREP -qFx 'install -d /usr/share/man/man3' <$<
GREP -qFx 'install -d /usr/share/man/man4' <$<
GREP -qFx 'install -d /usr/share/man/man5' <$<
GREP -qFx 'install -d /usr/share/man/man6' <$<
GREP -qFx 'install -d /usr/share/man/man7' <$<
GREP -qFx 'install -d /usr/share/man/man8' <$<
GREP -qFx 'install -d /usr/share/man/man9' <$<
debug-sysconfdir.log: ZMK.makeOverrides += sysconfdir=/etc
debug-sysconfdir: debug-sysconfdir.log
GREP -qFx "install -d /etc" <$<
debug-libexecdir.log: ZMK.makeOverrides += prefix=/usr libexecdir=/usr/lib/NAME
debug-libexecdir: debug-libexecdir.log
GREP -qFx "install -d /usr/lib/NAME" <$<
zmk-0.5.1/tests/Directory/Makefile 0000664 0001750 0001750 00000001566 13736672702 015621 0 ustar zyga zyga include z.mk
$(eval $(call ZMK.Import,Directories))
# Relative directory in the build tree
$(eval $(call ZMK.Expand,Directory,subdir/subsubdir))
# Sub-directory of a known directory.
$(eval $(call ZMK.Expand,Directory,$(libdir)/extra))
# Custom directory with duplicates and trailing slash.
$(eval $(call ZMK.Expand,Directory,/foo))
$(eval $(call ZMK.Expand,Directory,/foo))
$(eval $(call ZMK.Expand,Directory,/foo/))
# Custom directories with implicitly defined parents.
$(eval $(call ZMK.Expand,Directory,/custom/long/path))
# Custom directories with explicitly defined parents.
$(eval $(call ZMK.Expand,Directory,/))
$(eval $(call ZMK.Expand,Directory,/other))
$(eval $(call ZMK.Expand,Directory,/other/custom/))
$(eval $(call ZMK.Expand,Directory,/other/custom/path))
debug:: subdir/subsubdir $(addprefix $(DESTDIR),$(libdir)/extra /foo /custom/long/path /other/custom/path)
zmk-0.5.1/tests/Directory/Test.mk 0000664 0001750 0001750 00000006607 13773062345 015427 0 ustar zyga zyga #!/usr/bin/make -f
include zmk/internalTest.mk
t:: debug debug-silent-rules debug-destdir
# Test logs will contain debugging messages
%.log: ZMK.makeOverrides += DEBUG=directory
# Some logs have slent rules enabled
%-silent-rules.log: ZMK.makeOverrides += Silent.Active=yes
# Some logs have DESTDIR set to /destdir
%-destdir.log: ZMK.makeOverrides += DESTDIR=/destdir
debug: debug.log
# Directory in the build tree
GREP -qFx 'install -d subdir' <$<
GREP -qFx 'install -d subdir/subsubdir' <$<
# Extension of standard directory.
GREP -qFx 'install -d /usr/local/lib' <$<
GREP -qFx 'install -d /usr/local/lib/extra' <$<
# Custom shallow directory.
GREP -qFx 'install -d /foo' <$<
# Custom deep directory with implicit parent rules.
GREP -qFx 'install -d /custom' <$<
GREP -qFx 'install -d /custom/long' <$<
GREP -qFx 'install -d /custom/long/path' <$<
# Custom deep directory with explicit parent rules.
GREP -qFx 'install -d /other' <$<
GREP -qFx 'install -d /other/custom' <$<
GREP -qFx 'install -d /other/custom/path' <$<
debug-silent-rules: debug-silent-rules.log
# Directory in the build tree
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "subdir"' <$<
GREP -qFx '#install -d subdir' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "subdir/subsubdir"' <$<
GREP -qFx '#install -d subdir/subsubdir' <$<
# Extension of standard directory.
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr"' <$<
GREP -qFx '#install -d /usr' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr/local"' <$<
GREP -qFx '#install -d /usr/local' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr/local/lib"' <$<
GREP -qFx '#install -d /usr/local/lib' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr/local/lib/extra"' <$<
GREP -qFx '#install -d /usr/local/lib/extra' <$<
# Custom shallow directory.
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/foo"' <$<
GREP -qFx '#install -d /foo' <$<
# Custom deep directory with implicit parent rules.
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/custom"' <$<
GREP -qFx '#install -d /custom' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/custom/long"' <$<
GREP -qFx '#install -d /custom/long' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/custom/long/path"' <$<
GREP -qFx '#install -d /custom/long/path' <$<
# Custom deep directory with explicit parent rules.
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/other"' <$<
GREP -qFx '#install -d /other' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/other/custom"' <$<
GREP -qFx '#install -d /other/custom' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/other/custom/path"' <$<
GREP -qFx '#install -d /other/custom/path' <$<
debug-destdir: debug-destdir.log
# Directory in the build tree - note lack of destdir
GREP -qFx 'install -d subdir' <$<
GREP -qFx 'install -d subdir/subsubdir' <$<
# DESTDIR is created.
GREP -qFx 'mkdir -p /destdir' <$<
# Extension of standard directory.
GREP -qFx 'install -d /destdir/usr/local/lib' <$<
GREP -qFx 'install -d /destdir/usr/local/lib/extra' <$<
# Custom shallow directory.
GREP -qFx 'install -d /destdir/foo' <$<
# Custom deep directory with implicit parent rules.
GREP -qFx 'install -d /destdir/custom' <$<
GREP -qFx 'install -d /destdir/custom/long' <$<
GREP -qFx 'install -d /destdir/custom/long/path' <$<
# Custom deep directory with explicit parent rules.
GREP -qFx 'install -d /destdir/other' <$<
GREP -qFx 'install -d /destdir/other/custom' <$<
GREP -qFx 'install -d /destdir/other/custom/path' <$<
zmk-0.5.1/tests/Header/Makefile 0000664 0001750 0001750 00000000265 14027615611 015026 0 ustar zyga zyga include z.mk
$(eval $(call ZMK.Expand,Header,foo.h))
$(eval $(call ZMK.Expand,Header,include/bar.h))
froz.h.InstallDir = $(includedir)/froz
$(eval $(call ZMK.Expand,Header,froz.h))
zmk-0.5.1/tests/Header/Test.mk 0000664 0001750 0001750 00000007324 14027615611 014641 0 ustar zyga zyga #!/usr/bin/make -f
# This file is a part of zmk test system.
include zmk/internalTest.mk
t:: all install uninstall clean \
all-silent-rules install-silent-rules uninstall-silent-rules clean-silent-rules \
all-destdir install-destdir uninstall-destdir clean-destdir
# Test logs will contain debugging messages
%.log: ZMK.makeOverrides += DEBUG=header
# Some logs have slent rules enabled
%-silent-rules.log: ZMK.makeOverrides += Silent.Active=yes
# Some logs have DESTDIR set to /destdir
%-destdir.log: ZMK.makeOverrides += DESTDIR=/destdir
# Test depends on source files
%.log: foo.h include/bar.h froz.h
all: all.log
GREP -qF 'Nothing to be done for' <$<
install: install.log
GREP -qFx 'install -d /usr' <$<
GREP -qFx 'install -d /usr/local' <$<
GREP -qFx 'install -d /usr/local/include' <$<
GREP -qFx 'install -d /usr/local/include/froz' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.h /usr/local/include/foo.h' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)include/bar.h /usr/local/include/bar.h' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)froz.h /usr/local/include/froz/froz.h' <$<
uninstall: uninstall.log
GREP -qFx 'rm -f /usr/local/include/foo.h' <$<
GREP -qFx 'rm -f /usr/local/include/bar.h' <$<
GREP -qFx 'rm -f /usr/local/include/froz/froz.h' <$<
clean: clean.log
GREP -qF 'Nothing to be done for' <$<
all-silent-rules: all-silent-rules.log
GREP -qF 'Nothing to be done for' <$<
install-silent-rules: install-silent-rules.log
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr"' <$<
GREP -qFx '#install -d /usr' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr/local"' <$<
GREP -qFx '#install -d /usr/local' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr/local/include"' <$<
GREP -qFx '#install -d /usr/local/include' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr/local/include/froz"' <$<
GREP -qFx '#install -d /usr/local/include/froz' <$<
GREP -qFx 'printf " %-16s %s\n" "INSTALL" "/usr/local/include/foo.h"' <$<
GREP -qFx '#install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.h /usr/local/include/foo.h' <$<
GREP -qFx 'printf " %-16s %s\n" "INSTALL" "/usr/local/include/bar.h"' <$<
GREP -qFx '#install -m 0644 $(ZMK.test.OutOfTreeSourcePath)include/bar.h /usr/local/include/bar.h' <$<
GREP -qFx 'printf " %-16s %s\n" "INSTALL" "/usr/local/include/froz/froz.h"' <$<
GREP -qFx '#install -m 0644 $(ZMK.test.OutOfTreeSourcePath)froz.h /usr/local/include/froz/froz.h' <$<
uninstall-silent-rules: uninstall-silent-rules.log
GREP -qFx 'printf " %-16s %s\n" "RM" "/usr/local/include/foo.h"' <$<
GREP -qFx '#rm -f /usr/local/include/foo.h' <$<
GREP -qFx 'printf " %-16s %s\n" "RM" "/usr/local/include/bar.h"' <$<
GREP -qFx '#rm -f /usr/local/include/bar.h' <$<
GREP -qFx 'printf " %-16s %s\n" "RM" "/usr/local/include/froz/froz.h"' <$<
GREP -qFx '#rm -f /usr/local/include/froz/froz.h' <$<
clean-silent-rules: clean-silent-rules.log
GREP -qF 'Nothing to be done for' <$<
all-destdir: all-destdir.log
GREP -qF 'Nothing to be done for' <$<
install-destdir: install-destdir.log
GREP -qFx 'mkdir -p /destdir' <$<
GREP -qFx 'install -d /destdir/usr/local/include' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.h /destdir/usr/local/include/foo.h' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)include/bar.h /destdir/usr/local/include/bar.h' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)froz.h /destdir/usr/local/include/froz/froz.h' <$<
uninstall-destdir: uninstall-destdir.log
GREP -qFx 'rm -f /destdir/usr/local/include/foo.h' <$<
GREP -qFx 'rm -f /destdir/usr/local/include/bar.h' <$<
GREP -qFx 'rm -f /destdir/usr/local/include/froz/froz.h' <$<
clean-destdir: clean-destdir.log
GREP -qF 'Nothing to be done for' <$<
zmk-0.5.1/tests/Header/foo.h 0000664 0001750 0001750 00000000035 13773112563 014322 0 ustar zyga zyga #pragma once
int foo(void);
zmk-0.5.1/tests/Header/froz.h 0000664 0001750 0001750 00000000036 14012052114 014476 0 ustar zyga zyga #pragma once
int froz(void);
zmk-0.5.1/tests/Header/include/bar.h 0000664 0001750 0001750 00000000035 13736672702 015733 0 ustar zyga zyga #pragma once
int bar(void);
zmk-0.5.1/tests/HeaderGroup/Makefile 0000664 0001750 0001750 00000000304 14027615611 016035 0 ustar zyga zyga include z.mk
foobar.Headers = foo.h bar.h
$(eval $(call ZMK.Expand,HeaderGroup,foobar))
froz.InstallDir = $(includedir)/sub/dir
froz.Headers = froz.h
$(eval $(call ZMK.Expand,HeaderGroup,froz))
zmk-0.5.1/tests/HeaderGroup/Test.mk 0000664 0001750 0001750 00000007676 14027615611 015670 0 ustar zyga zyga #!/usr/bin/make -f
# This file is a part of zmk test system.
include zmk/internalTest.mk
t:: all install uninstall clean \
all-silent-rules install-silent-rules uninstall-silent-rules clean-silent-rules \
all-destdir install-destdir uninstall-destdir clean-destdir
# Test logs will contain debugging messages
%.log: ZMK.makeOverrides += DEBUG=header
# Some logs have slent rules enabled
%-silent-rules.log: ZMK.makeOverrides += Silent.Active=yes
# Some logs have DESTDIR set to /destdir
%-destdir.log: ZMK.makeOverrides += DESTDIR=/destdir
# Test depends on source files
%.log: foo.h bar.h
all: all.log
GREP -qF 'Nothing to be done for' <$<
install: install.log
GREP -qFx 'install -d /usr' <$<
GREP -qFx 'install -d /usr/local' <$<
GREP -qFx 'install -d /usr/local/include' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.h /usr/local/include/foo.h' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)bar.h /usr/local/include/bar.h' <$<
GREP -qFx 'install -d /usr/local/include/sub' <$<
GREP -qFx 'install -d /usr/local/include/sub/dir' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)froz.h /usr/local/include/sub/dir/froz.h' <$<
uninstall: uninstall.log
GREP -qFx 'rm -f /usr/local/include/foo.h' <$<
GREP -qFx 'rm -f /usr/local/include/bar.h' <$<
clean: clean.log
GREP -qF 'Nothing to be done for' <$<
all-silent-rules: all-silent-rules.log
GREP -qF 'Nothing to be done for' <$<
install-silent-rules: install-silent-rules.log
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr"' <$<
GREP -qFx '#install -d /usr' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr/local"' <$<
GREP -qFx '#install -d /usr/local' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr/local/include"' <$<
GREP -qFx '#install -d /usr/local/include' <$<
GREP -qFx 'printf " %-16s %s\n" "INSTALL" "/usr/local/include/foo.h"' <$<
GREP -qFx '#install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.h /usr/local/include/foo.h' <$<
GREP -qFx 'printf " %-16s %s\n" "INSTALL" "/usr/local/include/bar.h"' <$<
GREP -qFx '#install -m 0644 $(ZMK.test.OutOfTreeSourcePath)bar.h /usr/local/include/bar.h' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr/local/include/sub"' <$<
GREP -qFx '#install -d /usr/local/include/sub' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr/local/include/sub/dir"' <$<
GREP -qFx '#install -d /usr/local/include/sub/dir' <$<
GREP -qFx 'printf " %-16s %s\n" "INSTALL" "/usr/local/include/sub/dir/froz.h"' <$<
GREP -qFx '#install -m 0644 $(ZMK.test.OutOfTreeSourcePath)froz.h /usr/local/include/sub/dir/froz.h' <$<
uninstall-silent-rules: uninstall-silent-rules.log
GREP -qFx 'printf " %-16s %s\n" "RM" "/usr/local/include/foo.h"' <$<
GREP -qFx '#rm -f /usr/local/include/foo.h' <$<
GREP -qFx 'printf " %-16s %s\n" "RM" "/usr/local/include/bar.h"' <$<
GREP -qFx '#rm -f /usr/local/include/bar.h' <$<
GREP -qFx 'printf " %-16s %s\n" "RM" "/usr/local/include/sub/dir/froz.h"' <$<
GREP -qFx '#rm -f /usr/local/include/sub/dir/froz.h' <$<
clean-silent-rules: clean-silent-rules.log
GREP -qF 'Nothing to be done for' <$<
all-destdir: all-destdir.log
GREP -qF 'Nothing to be done for' <$<
install-destdir: install-destdir.log
GREP -qFx 'mkdir -p /destdir' <$<
GREP -qFx 'install -d /destdir/usr/local/include' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.h /destdir/usr/local/include/foo.h' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)bar.h /destdir/usr/local/include/bar.h' <$<
GREP -qFx 'install -d /destdir/usr/local/include/sub' <$<
GREP -qFx 'install -d /destdir/usr/local/include/sub/dir' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)froz.h /destdir/usr/local/include/sub/dir/froz.h' <$<
uninstall-destdir: uninstall-destdir.log
GREP -qFx 'rm -f /destdir/usr/local/include/foo.h' <$<
GREP -qFx 'rm -f /destdir/usr/local/include/bar.h' <$<
GREP -qFx 'rm -f /destdir/usr/local/include/sub/dir/froz.h' <$<
clean-destdir: clean-destdir.log
GREP -qF 'Nothing to be done for' <$<
zmk-0.5.1/tests/HeaderGroup/bar.h 0000664 0001750 0001750 00000000035 14027615611 015313 0 ustar zyga zyga #pragma once
int bar(void);
zmk-0.5.1/tests/HeaderGroup/foo.h 0000664 0001750 0001750 00000000035 14027615611 015332 0 ustar zyga zyga #pragma once
int foo(void);
zmk-0.5.1/tests/HeaderGroup/froz.h 0000664 0001750 0001750 00000000036 14027615611 015530 0 ustar zyga zyga #pragma once
int froz(void);
zmk-0.5.1/tests/Library.A/Makefile 0000664 0001750 0001750 00000000125 13736672702 015426 0 ustar zyga zyga include z.mk
libfoo.a.Sources = foo.c
$(eval $(call ZMK.Expand,Library.A,libfoo.a))
zmk-0.5.1/tests/Library.A/Test.mk 0000664 0001750 0001750 00000011603 14027615611 015227 0 ustar zyga zyga #!/usr/bin/make -f
# This file is a part of zmk test system.
include zmk/internalTest.mk
t:: all install uninstall clean \
all-silent-rules install-silent-rules uninstall-silent-rules clean-silent-rules \
all-destdir install-destdir uninstall-destdir clean-destdir \
all-enable-static-libs all-disable-static-libs
$(eval $(ZMK.isolateHostToolchain))
# Test logs will contain debugging messages
%.log: ZMK.makeOverrides += DEBUG=library.a
# Some logs have silent rules enabled
%-silent-rules.log: ZMK.makeOverrides += Silent.Active=yes
# Some logs have DESTDIR set to /destdir
%-destdir.log: ZMK.makeOverrides += DESTDIR=/destdir
# Some logs behave as if configure --enable-static was used
%-enable-static-libs.log: ZMK.makeOverrides += Configure.StaticLibraries=yes
# Some logs behave as if configure --disable-static was used
%-disable-static-libs.log: ZMK.makeOverrides += Configure.StaticLibraries=
# Test depends on source files
%.log: foo.c
all: all.log
# Default target compiles source to object files belonging to the library.
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libfoo.a-foo.d) -c -o libfoo.a-foo.o $(ZMK.test.OutOfTreeSourcePath)foo.c' <$<
# Default target combines object files into an archive
GREP -qFx 'ar -cr libfoo.a libfoo.a-foo.o' <$<
install: install.log
# Installing creates the prerequisite directories
GREP -qFx 'install -d /usr' <$<
GREP -qFx 'install -d /usr/local' <$<
# Installing creates the library directory
GREP -qFx 'install -d /usr/local/lib' <$<
# Installing copies the library
GREP -qFx 'install -m 0644 libfoo.a /usr/local/lib/libfoo.a' <$<
uninstall: uninstall.log
# Uninstalling removes the library
GREP -qFx 'rm -f /usr/local/lib/libfoo.a' <$<
clean: clean.log
# Cleaning removes the library
GREP -qFx 'rm -f libfoo.a' <$<
# Cleaning removes the object files belonging to the library
GREP -qFx 'rm -f ./libfoo.a-foo.o' <$<
# Cleaning removes the dependency files
GREP -qFx 'rm -f ./libfoo.a-foo.d' <$<
all-silent-rules: all-silent-rules.log
# Default target compiles source to object files belonging to the library.
GREP -qFx 'printf " %-16s %s\n" "CC" "libfoo.a-foo.o"' <$<
GREP -qFx '#cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libfoo.a-foo.d) -c -o libfoo.a-foo.o $(ZMK.test.OutOfTreeSourcePath)foo.c' <$<
# Default target combines object files into an archive
GREP -qFx 'printf " %-16s %s\n" "AR" "libfoo.a"' <$<
GREP -qFx '#ar -cr libfoo.a libfoo.a-foo.o' <$<
install-silent-rules: install-silent-rules.log
# Installing creates the prerequisite directories
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr"' <$<
GREP -qFx '#install -d /usr' <$<
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr/local"' <$<
GREP -qFx '#install -d /usr/local' <$<
# Installing creates the library directory
GREP -qFx 'printf " %-16s %s\n" "MKDIR" "/usr/local/lib"' <$<
GREP -qFx '#install -d /usr/local/lib' <$<
# Installing copies the library
GREP -qFx 'printf " %-16s %s\n" "INSTALL" "/usr/local/lib/libfoo.a"' <$<
GREP -qFx '#install -m 0644 libfoo.a /usr/local/lib/libfoo.a' <$<
uninstall-silent-rules: uninstall-silent-rules.log
GREP -qFx '#rm -f /usr/local/lib/libfoo.a' <$<
clean-silent-rules: clean-silent-rules.log
# Cleaning removes the library
GREP -qFx '#rm -f libfoo.a' <$<
# Cleaning removes the object files belonging to the library
GREP -qFx '#rm -f ./libfoo.a-foo.o' <$<
# Cleaning removes the dependency files
GREP -qFx '#rm -f ./libfoo.a-foo.d' <$<
all-destdir: all-destdir.log
# Default target compiles source to object files belonging to the library.
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libfoo.a-foo.d) -c -o libfoo.a-foo.o $(ZMK.test.OutOfTreeSourcePath)foo.c' <$<
# Default target combines object files into an archive
GREP -qFx 'ar -cr libfoo.a libfoo.a-foo.o' <$<
install-destdir: install-destdir.log
# Installing creates the prerequisite directories
GREP -qFx 'mkdir -p /destdir' <$<
GREP -qFx 'install -d /destdir/usr' <$<
GREP -qFx 'install -d /destdir/usr/local' <$<
# Installing creates the library directory
GREP -qFx 'install -d /destdir/usr/local/lib' <$<
# Installing copies the library
GREP -qFx 'install -m 0644 libfoo.a /destdir/usr/local/lib/libfoo.a' <$<
uninstall-destdir: uninstall-destdir.log
# Uninstalling removes the library
GREP -qFx 'rm -f /destdir/usr/local/lib/libfoo.a' <$<
clean-destdir: clean-destdir.log
# Cleaning removes the library
GREP -qFx 'rm -f libfoo.a' <$<
# Cleaning removes the object files belonging to the library
GREP -qFx 'rm -f ./libfoo.a-foo.o' <$<
# Cleaning removes the dependency files
GREP -qFx 'rm -f ./libfoo.a-foo.d' <$<
all-enable-static-libs: all-enable-static-libs.log
# Configuring --enable-static enables compilation of static libraries.
GREP -qFx 'ar -cr libfoo.a libfoo.a-foo.o' <$<
all-disable-static-libs: all-disable-static-libs.log
# Configuring --disable-static disables compilation of static libraries.
GREP -v -qFx 'ar -cr libfoo.a libfoo.a-foo.o' <$<
zmk-0.5.1/tests/Library.A/foo.c 0000664 0001750 0001750 00000000153 13745374026 014714 0 ustar zyga zyga #include
#include
int foo(void);
int foo(void) {
return printf("Hello World\n");
}
zmk-0.5.1/tests/Library.DyLib/Makefile 0000664 0001750 0001750 00000000271 14012052114 016224 0 ustar zyga zyga include z.mk
libfoo.1.dylib.Sources = foo.c
$(eval $(call ZMK.Expand,Library.DyLib,libfoo.1.dylib))
libbar.dylib.Sources = bar.c
$(eval $(call ZMK.Expand,Library.DyLib,libbar.dylib))
zmk-0.5.1/tests/Library.DyLib/Test.mk 0000664 0001750 0001750 00000014667 14027615611 016067 0 ustar zyga zyga #!/usr/bin/make -f
# This file is a part of zmk test system.
include zmk/internalTest.mk
t:: all install uninstall clean \
all-sysroot \
all-destdir install-destdir uninstall-destdir clean-destdir \
all-enable-dynamic-libs all-disable-dynamic-libs
$(eval $(ZMK.isolateHostToolchain))
# Test logs will contain debugging messages
%.log: ZMK.makeOverrides += DEBUG=library.dylib
# Some logs have DESTDIR set to /destdir
%-destdir.log: ZMK.makeOverrides += DESTDIR=/destdir
# Some logs behave as if configure --enable-dynamic was used
%-enable-dynamic-libs.log: ZMK.makeOverrides += Configure.DynamicLibraries=yes
# Some logs behave as if configure --disable-dynamic was used
%-disable-dynamic-libs.log: ZMK.makeOverrides += Configure.DynamicLibraries=
# Some logs behave as if a sysroot was requested.
%-sysroot.log: ZMK.makeOverrides += Toolchain.SysRoot=/path
# Test depends on source files
%.log: foo.c
all: all.log
# Building a dynamic library compiles objects
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libfoo.1.dylib-foo.d) -c -o libfoo.1.dylib-foo.o $(ZMK.test.OutOfTreeSourcePath)foo.c' <$<
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libbar.dylib-bar.d) -c -o libbar.dylib-bar.o $(ZMK.test.OutOfTreeSourcePath)bar.c' <$<
# Links objects together
GREP -qFx 'cc -dynamiclib -compatibility_version 1.0 -current_version 1.0 -o libfoo.1.dylib libfoo.1.dylib-foo.o' <$<
GREP -qFx 'cc -dynamiclib -compatibility_version 1.0 -current_version 1.0 -o libbar.dylib libbar.dylib-bar.o' <$<
# And provides the .dylib alias, when the library is versioned
GREP -qFx 'ln -sf libfoo.1.dylib libfoo.dylib' <$<
GREP -v -qFx 'ln -sf libbar.dylib libbar' <$<
install: install.log
# Installing dynamic libraries creates parent directories.
GREP -qFx 'install -d /usr' <$<
GREP -qFx 'install -d /usr/local' <$<
GREP -qFx 'install -d /usr/local/lib' <$<
# Installing dynamic libraries copies the dynamic library.
GREP -qFx 'install -m 0644 libfoo.1.dylib /usr/local/lib/libfoo.1.dylib' <$<
GREP -qFx 'install -m 0644 libbar.dylib /usr/local/lib/libbar.dylib' <$<
# Installing dynamic libraries creates the alias, when the library is versioned.
GREP -qFx 'ln -sf libfoo.1.dylib /usr/local/lib/libfoo.dylib' <$<
GREP -v -qFx 'ln -sf libbar.dylib /usr/local/lib/libbar' <$<
uninstall: uninstall.log
# Uninstalling dynamic libraries removes the dynamic library and the alias.
GREP -qFx 'rm -f /usr/local/lib/libfoo.1.dylib' <$<
GREP -qFx 'rm -f /usr/local/lib/libfoo.dylib' <$<
# If the library is versioned, the alias is removed as well.>>
GREP -qFx 'rm -f /usr/local/lib/libbar.dylib' <$<
# Libraries without versions do not emit incorrect bare filename.
GREP -v -qFx 'rm -f /usr/local/lib/libbar' <$<
clean: clean.log
# Cleaning dynamic libraries removes the dynamic library and the alias.
GREP -qFx 'rm -f libfoo.1.dylib' <$<
GREP -qFx 'rm -f libfoo.dylib' <$<
GREP -qFx 'rm -f libbar.dylib' <$<
# Cleaning dynamic libraries removes the object files and dependency files.
GREP -qFx 'rm -f ./libfoo.1.dylib-foo.o' <$<
GREP -qFx 'rm -f ./libfoo.1.dylib-foo.d' <$<
GREP -qFx 'rm -f ./libbar.dylib-bar.o' <$<
GREP -qFx 'rm -f ./libbar.dylib-bar.d' <$<
all-sysroot: all-sysroot.log
# Building a dynamic library compiles object against the configured sysroot
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libfoo.1.dylib-foo.d) -c --sysroot=/path -o libfoo.1.dylib-foo.o $(ZMK.test.OutOfTreeSourcePath)foo.c' <$<
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libbar.dylib-bar.d) -c --sysroot=/path -o libbar.dylib-bar.o $(ZMK.test.OutOfTreeSourcePath)bar.c' <$<
# Links objects together with the configured sysroot in scope.
GREP -qFx 'cc -dynamiclib -compatibility_version 1.0 -current_version 1.0 --sysroot=/path -o libfoo.1.dylib libfoo.1.dylib-foo.o' <$<
GREP -qFx 'cc -dynamiclib -compatibility_version 1.0 -current_version 1.0 --sysroot=/path -o libbar.dylib libbar.dylib-bar.o' <$<
all-destdir: all-destdir.log
# Building a dynamic library compiles objects
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libfoo.1.dylib-foo.d) -c -o libfoo.1.dylib-foo.o $(ZMK.test.OutOfTreeSourcePath)foo.c' <$<
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libbar.dylib-bar.d) -c -o libbar.dylib-bar.o $(ZMK.test.OutOfTreeSourcePath)bar.c' <$<
# Links objects together
GREP -qFx 'cc -dynamiclib -compatibility_version 1.0 -current_version 1.0 -o libfoo.1.dylib libfoo.1.dylib-foo.o' <$<
GREP -qFx 'cc -dynamiclib -compatibility_version 1.0 -current_version 1.0 -o libbar.dylib libbar.dylib-bar.o' <$<
# And provides the .dylib alias
GREP -qFx 'ln -sf libfoo.1.dylib libfoo.dylib' <$<
install-destdir: install-destdir.log
# Installing dynamic libraries creates parent directories.
GREP -qFx 'mkdir -p /destdir' <$<
GREP -qFx 'install -d /destdir/usr' <$<
GREP -qFx 'install -d /destdir/usr/local' <$<
GREP -qFx 'install -d /destdir/usr/local/lib' <$<
# Installing dynamic libraries copies the dynamic library.
GREP -qFx 'install -m 0644 libfoo.1.dylib /destdir/usr/local/lib/libfoo.1.dylib' <$<
# Installing dynamic libraries creates the alias.
GREP -qFx 'ln -sf libfoo.1.dylib /destdir/usr/local/lib/libfoo.dylib' <$<
uninstall-destdir: uninstall-destdir.log
# Uninstalling dynamic libraries removes the dynamic library and the alias.
GREP -qFx 'rm -f /destdir/usr/local/lib/libfoo.1.dylib' <$<
GREP -qFx 'rm -f /destdir/usr/local/lib/libfoo.dylib' <$<
GREP -qFx 'rm -f /destdir/usr/local/lib/libbar.dylib' <$<
GREP -v -qFx 'rm -f /usr/local/lib/libbar' <$<
clean-destdir: clean-destdir.log
# Cleaning dynamic libraries removes the dynamic library and the alias.
GREP -qFx 'rm -f libfoo.1.dylib' <$<
GREP -qFx 'rm -f libfoo.dylib' <$<
GREP -qFx 'rm -f libbar.dylib' <$<
# Cleaning dynamic libraries removes the object files and dependency files.
GREP -qFx 'rm -f ./libfoo.1.dylib-foo.o' <$<
GREP -qFx 'rm -f ./libfoo.1.dylib-foo.d' <$<
GREP -qFx 'rm -f ./libbar.dylib-bar.o' <$<
GREP -qFx 'rm -f ./libbar.dylib-bar.d' <$<
all-enable-dynamic-libs: all-enable-dynamic-libs.log
# Configuring --enable-dynamic enables compilation of dynamic libraries.
GREP -qFx 'cc -dynamiclib -compatibility_version 1.0 -current_version 1.0 -o libfoo.1.dylib libfoo.1.dylib-foo.o' <$<
all-disable-dynamic-libs: all-disable-dynamic-libs.log
# Configuring --disable-dynamic disables compilation of dynamic libraries.
GREP -v -qFx 'cc -dynamiclib -compatibility_version 1.0 -current_version 1.0 -o libfoo.1.dylib libfoo.1.dylib-foo.o' <$<
zmk-0.5.1/tests/Library.DyLib/bar.c 0000664 0001750 0001750 00000000153 14012052114 015473 0 ustar zyga zyga #include
#include
int bar(void);
int bar(void) {
return printf("Hello World\n");
}
zmk-0.5.1/tests/Library.DyLib/foo.c 0000664 0001750 0001750 00000000153 13736672702 015541 0 ustar zyga zyga #include
#include
int foo(void);
int foo(void) {
return printf("Hello World\n");
}
zmk-0.5.1/tests/Library.So/Makefile 0000664 0001750 0001750 00000000247 13773070635 015632 0 ustar zyga zyga include z.mk
libfoo.so.1.Sources = foo.c
$(eval $(call ZMK.Expand,Library.So,libfoo.so.1))
libbar.so.Sources = bar.c
$(eval $(call ZMK.Expand,Library.So,libbar.so))
zmk-0.5.1/tests/Library.So/Test.mk 0000664 0001750 0001750 00000013755 14027615611 015442 0 ustar zyga zyga #!/usr/bin/make -f
# This file is a part of zmk test system.
include zmk/internalTest.mk
t:: all install uninstall clean \
all-sysroot \
all-destdir install-destdir uninstall-destdir clean-destdir \
all-enable-dynamic-libs all-disable-dynamic-libs
$(eval $(ZMK.isolateHostToolchain))
# Test logs will contain debugging messages
%.log: ZMK.makeOverrides += DEBUG=library.so
# Some logs have DESTDIR set to /destdir
%-destdir.log: ZMK.makeOverrides += DESTDIR=/destdir
# Some logs behave as if configure --enable-dynamic was used
%-enable-dynamic-libs.log: ZMK.makeOverrides += Configure.DynamicLibraries=yes
# Some logs behave as if configure --disable-dynamic was used
%-disable-dynamic-libs.log: ZMK.makeOverrides += Configure.DynamicLibraries=
# Some logs behave as if a sysroot was requested.
%-sysroot.log: ZMK.makeOverrides += Toolchain.SysRoot=/path
# Test depends on source files
%.log: foo.c
all: all.log
# Building a shared library compiles objects
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libfoo.so.1-foo.d) -c -o libfoo.so.1-foo.o $(ZMK.test.OutOfTreeSourcePath)foo.c' <$<
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libbar.so-bar.d) -c -o libbar.so-bar.o $(ZMK.test.OutOfTreeSourcePath)bar.c' <$<
# Links objects together
GREP -qFx 'cc -shared -Wl,-soname=libfoo.so.1 -o libfoo.so.1 libfoo.so.1-foo.o' <$<
GREP -qFx 'cc -shared -Wl,-soname=libbar.so -o libbar.so libbar.so-bar.o' <$<
# And provides the .so alias, when the library is versioned
GREP -qFx 'ln -sf libfoo.so.1 libfoo.so' <$<
GREP -v -qFx 'ln -sf libbar.so libbar' <$<
install: install.log
# Installing shared libraries creates parent directories.
GREP -qFx 'install -d /usr' <$<
GREP -qFx 'install -d /usr/local' <$<
GREP -qFx 'install -d /usr/local/lib' <$<
# Installing shared libraries copies the shared library.
GREP -qFx 'install -m 0644 libfoo.so.1 /usr/local/lib/libfoo.so.1' <$<
GREP -qFx 'install -m 0644 libbar.so /usr/local/lib/libbar.so' <$<
# Installing shared libraries creates the alias, when the library is versioned.
GREP -qFx 'ln -sf libfoo.so.1 /usr/local/lib/libfoo.so' <$<
GREP -v -qFx 'ln -sf libbar.so /usr/local/lib/libbar' <$<
uninstall: uninstall.log
# Uninstalling shared libraries removes the shared library.
GREP -qFx 'rm -f /usr/local/lib/libfoo.so.1' <$<
GREP -qFx 'rm -f /usr/local/lib/libbar.so' <$<
# If the library is versioned, the alias is removed as well.>>
GREP -qFx 'rm -f /usr/local/lib/libfoo.so' <$<
# Libraries without versions do not emit incorrect bare filename.
GREP -v -qFx 'rm -f /usr/local/lib/libbar' <$<
clean: clean.log
# Cleaning shared libraries removes the shared library and the alias.>
GREP -qFx 'rm -f libfoo.so.1' <$<
GREP -qFx 'rm -f libfoo.so' <$<
GREP -qFx 'rm -f libbar.so' <$<
# Cleaning shared libraries removes the object files and dependency files.
GREP -v -qFx 'rm -f /usr/local/lib/libbar' <$<
GREP -qFx 'rm -f ./libfoo.so.1-foo.o' <$<
GREP -qFx 'rm -f ./libbar.so-bar.o' <$<
GREP -qFx 'rm -f ./libbar.so-bar.d' <$<
all-sysroot: all-sysroot.log
# Building a shared library compiles objects against the configured sysroot.
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libfoo.so.1-foo.d) -c --sysroot=/path -o libfoo.so.1-foo.o $(ZMK.test.OutOfTreeSourcePath)foo.c' <$<
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libbar.so-bar.d) -c --sysroot=/path -o libbar.so-bar.o $(ZMK.test.OutOfTreeSourcePath)bar.c' <$<
# Links objects together with the configured sysroot in scope.
GREP -qFx 'cc -shared -Wl,-soname=libfoo.so.1 --sysroot=/path -o libfoo.so.1 libfoo.so.1-foo.o' <$<
GREP -qFx 'cc -shared -Wl,-soname=libbar.so --sysroot=/path -o libbar.so libbar.so-bar.o' <$<
all-destdir: all-destdir.log
# Building a shared library compiles objects
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libfoo.so.1-foo.d) -c -o libfoo.so.1-foo.o $(ZMK.test.OutOfTreeSourcePath)foo.c' <$<
GREP -qFx 'cc -fpic -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF libbar.so-bar.d) -c -o libbar.so-bar.o $(ZMK.test.OutOfTreeSourcePath)bar.c' <$<
# Links objects together
GREP -qFx 'cc -shared -Wl,-soname=libfoo.so.1 -o libfoo.so.1 libfoo.so.1-foo.o' <$<
GREP -qFx 'cc -shared -Wl,-soname=libbar.so -o libbar.so libbar.so-bar.o' <$<
# And provides the .so alias
GREP -qFx 'ln -sf libfoo.so.1 libfoo.so' <$<
install-destdir: install-destdir.log
# Installing shared libraries creates parent directories.
GREP -qFx 'mkdir -p /destdir' <$<
GREP -qFx 'install -d /destdir/usr' <$<
GREP -qFx 'install -d /destdir/usr/local' <$<
GREP -qFx 'install -d /destdir/usr/local/lib' <$<
# Installing shared libraries copies the shared library.
GREP -qFx 'install -m 0644 libfoo.so.1 /destdir/usr/local/lib/libfoo.so.1' <$<
# Installing shared libraries creates the alias.
GREP -qFx 'ln -sf libfoo.so.1 /destdir/usr/local/lib/libfoo.so' <$<
uninstall-destdir: uninstall-destdir.log
# Uninstalling shared libraries removes the shared library and the alias.
GREP -qFx 'rm -f /destdir/usr/local/lib/libfoo.so.1' <$<
GREP -qFx 'rm -f /destdir/usr/local/lib/libfoo.so' <$<
GREP -qFx 'rm -f /destdir/usr/local/lib/libbar.so' <$<
GREP -v -qFx 'rm -f /usr/local/lib/libbar' <$<
clean-destdir: clean-destdir.log
# Cleaning shared libraries removes the shared library and the alias.
GREP -qFx 'rm -f libfoo.so.1' <$<
GREP -qFx 'rm -f libfoo.so' <$<
GREP -qFx 'rm -f libbar.so' <$<
# Cleaning shared libraries removes the object files and dependency files.
GREP -qFx 'rm -f ./libfoo.so.1-foo.o' <$<
GREP -qFx 'rm -f ./libfoo.so.1-foo.d' <$<
GREP -qFx 'rm -f ./libbar.so-bar.o' <$<
GREP -qFx 'rm -f ./libbar.so-bar.d' <$<
all-enable-dynamic-libs: all-enable-dynamic-libs.log
# Configuring --enable-dynamic enables compilation of dynamic libraries.
GREP -qFx 'cc -shared -Wl,-soname=libfoo.so.1 -o libfoo.so.1 libfoo.so.1-foo.o' <$<
all-disable-dynamic-libs: all-disable-dynamic-libs.log
# Configuring --disable-dynamic disables compilation of dynamic libraries.
GREP -v -qFx 'cc -shared -Wl,-soname=libfoo.so.1 -o libfoo.so.1 libfoo.so.1-foo.o' <$<
zmk-0.5.1/tests/Library.So/bar.c 0000664 0001750 0001750 00000000153 13773070635 015076 0 ustar zyga zyga #include
#include
int bar(void);
int bar(void) {
return printf("Hello World\n");
}
zmk-0.5.1/tests/Library.So/foo.c 0000664 0001750 0001750 00000000153 13736672702 015117 0 ustar zyga zyga #include
#include
int foo(void);
int foo(void) {
return printf("Hello World\n");
}
zmk-0.5.1/tests/ManPage/Makefile 0000664 0001750 0001750 00000001425 13736672702 015157 0 ustar zyga zyga include z.mk
$(eval $(call ZMK.Expand,ManPage,foo.1))
$(eval $(call ZMK.Expand,ManPage,foo.2))
$(eval $(call ZMK.Expand,ManPage,foo.3))
$(eval $(call ZMK.Expand,ManPage,foo.4))
$(eval $(call ZMK.Expand,ManPage,foo.5))
$(eval $(call ZMK.Expand,ManPage,foo.6))
$(eval $(call ZMK.Expand,ManPage,foo.7))
$(eval $(call ZMK.Expand,ManPage,foo.8))
$(eval $(call ZMK.Expand,ManPage,foo.9))
$(eval $(call ZMK.Expand,ManPage,man/bar.1))
$(eval $(call ZMK.Expand,ManPage,man/bar.2))
$(eval $(call ZMK.Expand,ManPage,man/bar.3))
$(eval $(call ZMK.Expand,ManPage,man/bar.4))
$(eval $(call ZMK.Expand,ManPage,man/bar.5))
$(eval $(call ZMK.Expand,ManPage,man/bar.6))
$(eval $(call ZMK.Expand,ManPage,man/bar.7))
$(eval $(call ZMK.Expand,ManPage,man/bar.8))
$(eval $(call ZMK.Expand,ManPage,man/bar.9))
zmk-0.5.1/tests/ManPage/Test.mk 0000664 0001750 0001750 00000016314 13736672702 014772 0 ustar zyga zyga #!/usr/bin/make -f
include zmk/internalTest.mk
t:: install install-destdir uninstall
# Test logs will contain debugging messages
%.log: ZMK.makeOverrides += DEBUG=manpage
# Some logs have DESTDIR set to /destdir
%-destdir.log: ZMK.makeOverrides += DESTDIR=/destdir
install: install.log
# Prerequisite directories are created
GREP -qFx 'install -d /usr' <$<
GREP -qFx 'install -d /usr/local' <$<
GREP -qFx 'install -d /usr/local/share' <$<
GREP -qFx 'install -d /usr/local/share/man' <$<
# The install target installs manual pages and the directories they belong to.
GREP -qFx 'install -d /usr/local/share/man/man1' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.1 /usr/local/share/man/man1/foo.1' <$<
GREP -qFx 'install -d /usr/local/share/man/man2' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.2 /usr/local/share/man/man2/foo.2' <$<
GREP -qFx 'install -d /usr/local/share/man/man3' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.3 /usr/local/share/man/man3/foo.3' <$<
GREP -qFx 'install -d /usr/local/share/man/man4' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.4 /usr/local/share/man/man4/foo.4' <$<
GREP -qFx 'install -d /usr/local/share/man/man5' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.5 /usr/local/share/man/man5/foo.5' <$<
GREP -qFx 'install -d /usr/local/share/man/man6' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.6 /usr/local/share/man/man6/foo.6' <$<
GREP -qFx 'install -d /usr/local/share/man/man7' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.7 /usr/local/share/man/man7/foo.7' <$<
GREP -qFx 'install -d /usr/local/share/man/man8' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.8 /usr/local/share/man/man8/foo.8' <$<
GREP -qFx 'install -d /usr/local/share/man/man9' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.9 /usr/local/share/man/man9/foo.9' <$<
# Manual pages that are provided by path locally are not retaining that path
# in the installed location. If desired this can be customised by setting
# InstallDir on the appropriate objects.
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.1 /usr/local/share/man/man1/bar.1' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.2 /usr/local/share/man/man2/bar.2' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.3 /usr/local/share/man/man3/bar.3' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.4 /usr/local/share/man/man4/bar.4' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.5 /usr/local/share/man/man5/bar.5' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.6 /usr/local/share/man/man6/bar.6' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.7 /usr/local/share/man/man7/bar.7' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.8 /usr/local/share/man/man8/bar.8' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.9 /usr/local/share/man/man9/bar.9' <$<
install-destdir: install-destdir.log
# Destdir is created
GREP -qFx 'mkdir -p /destdir' <$<
# Prerequisite directories are created
GREP -qFx 'install -d /destdir/usr' <$<
GREP -qFx 'install -d /destdir/usr/local' <$<
GREP -qFx 'install -d /destdir/usr/local/share' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man' <$<
# The install target installs manual pages and the directories they belong to.
GREP -qFx 'install -d /destdir/usr/local/share/man/man1' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.1 /destdir/usr/local/share/man/man1/foo.1' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man2' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.2 /destdir/usr/local/share/man/man2/foo.2' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man3' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.3 /destdir/usr/local/share/man/man3/foo.3' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man4' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.4 /destdir/usr/local/share/man/man4/foo.4' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man5' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.5 /destdir/usr/local/share/man/man5/foo.5' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man6' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.6 /destdir/usr/local/share/man/man6/foo.6' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man7' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.7 /destdir/usr/local/share/man/man7/foo.7' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man8' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.8 /destdir/usr/local/share/man/man8/foo.8' <$<
GREP -qFx 'install -d /destdir/usr/local/share/man/man9' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)foo.9 /destdir/usr/local/share/man/man9/foo.9' <$<
# Manual pages that are provided by path locally are not retaining that path
# in the installed location. If desired this can be customised by setting
# InstallDir on the appropriate objects.
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.1 /destdir/usr/local/share/man/man1/bar.1' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.2 /destdir/usr/local/share/man/man2/bar.2' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.3 /destdir/usr/local/share/man/man3/bar.3' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.4 /destdir/usr/local/share/man/man4/bar.4' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.5 /destdir/usr/local/share/man/man5/bar.5' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.6 /destdir/usr/local/share/man/man6/bar.6' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.7 /destdir/usr/local/share/man/man7/bar.7' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.8 /destdir/usr/local/share/man/man8/bar.8' <$<
GREP -qFx 'install -m 0644 $(ZMK.test.OutOfTreeSourcePath)man/bar.9 /destdir/usr/local/share/man/man9/bar.9' <$<
uninstall: uninstall.log
# The uninstall target removes manual pages.
GREP -qFx 'rm -f /usr/local/share/man/man1/foo.1' <$<
GREP -qFx 'rm -f /usr/local/share/man/man2/foo.2' <$<
GREP -qFx 'rm -f /usr/local/share/man/man3/foo.3' <$<
GREP -qFx 'rm -f /usr/local/share/man/man4/foo.4' <$<
GREP -qFx 'rm -f /usr/local/share/man/man5/foo.5' <$<
GREP -qFx 'rm -f /usr/local/share/man/man6/foo.6' <$<
GREP -qFx 'rm -f /usr/local/share/man/man7/foo.7' <$<
GREP -qFx 'rm -f /usr/local/share/man/man8/foo.8' <$<
GREP -qFx 'rm -f /usr/local/share/man/man9/foo.9' <$<
GREP -qFx 'rm -f /usr/local/share/man/man1/bar.1' <$<
GREP -qFx 'rm -f /usr/local/share/man/man2/bar.2' <$<
GREP -qFx 'rm -f /usr/local/share/man/man3/bar.3' <$<
GREP -qFx 'rm -f /usr/local/share/man/man4/bar.4' <$<
GREP -qFx 'rm -f /usr/local/share/man/man5/bar.5' <$<
GREP -qFx 'rm -f /usr/local/share/man/man6/bar.6' <$<
GREP -qFx 'rm -f /usr/local/share/man/man7/bar.7' <$<
GREP -qFx 'rm -f /usr/local/share/man/man8/bar.8' <$<
GREP -qFx 'rm -f /usr/local/share/man/man9/bar.9' <$<
zmk-0.5.1/tests/ManPage/foo.1 0000664 0001750 0001750 00000000000 13736672702 014350 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/foo.2 0000664 0001750 0001750 00000000000 13736672702 014351 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/foo.3 0000664 0001750 0001750 00000000000 13736672702 014352 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/foo.4 0000664 0001750 0001750 00000000000 13736672702 014353 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/foo.5 0000664 0001750 0001750 00000000000 13736672702 014354 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/foo.6 0000664 0001750 0001750 00000000000 13736672702 014355 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/foo.7 0000664 0001750 0001750 00000000000 13736672702 014356 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/foo.8 0000664 0001750 0001750 00000000000 13736672702 014357 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/foo.9 0000664 0001750 0001750 00000000000 13736672702 014360 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/man/bar.1 0000664 0001750 0001750 00000000000 13736672702 015104 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/man/bar.2 0000664 0001750 0001750 00000000000 13736672702 015105 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/man/bar.3 0000664 0001750 0001750 00000000000 13736672702 015106 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/man/bar.4 0000664 0001750 0001750 00000000000 13736672702 015107 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/man/bar.5 0000664 0001750 0001750 00000000000 13736672702 015110 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/man/bar.6 0000664 0001750 0001750 00000000000 13736672702 015111 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/man/bar.7 0000664 0001750 0001750 00000000000 13736672702 015112 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/man/bar.8 0000664 0001750 0001750 00000000000 13736672702 015113 0 ustar zyga zyga zmk-0.5.1/tests/ManPage/man/bar.9 0000664 0001750 0001750 00000000000 13736672702 015114 0 ustar zyga zyga zmk-0.5.1/tests/OS/Makefile 0000664 0001750 0001750 00000000104 13736672702 014161 0 ustar zyga zyga include z.mk
$(eval $(call ZMK.Import,OS))
.PHONY: debug
debug: ;
zmk-0.5.1/tests/OS/Test.mk 0000664 0001750 0001750 00000004206 13736672702 014000 0 ustar zyga zyga #!/usr/bin/make -f
include zmk/internalTest.mk
t:: debug-linux debug-freebsd debug-openbsd debug-netbsd \
debug-hurd debug-gnu-kfreebsd debug-solaris \
debug-darwin debug-windows debug-haiku debug-unknown
# Test logs will contain debugging messages
%.log: ZMK.makeOverrides += DEBUG=os
debug-linux.log: ZMK.makeOverrides += OS.Kernel=Linux
debug-linux: debug-linux.log
GREP -qFx 'DEBUG: OS.Kernel=Linux' <$<
GREP -qFx 'DEBUG: OS.ImageFormat=ELF' <$<
debug-freebsd.log: ZMK.makeOverrides += OS.Kernel=FreeBSD
debug-freebsd: debug-freebsd.log
GREP -qFx 'DEBUG: OS.Kernel=FreeBSD' <$<
GREP -qFx 'DEBUG: OS.ImageFormat=ELF' <$<
debug-openbsd.log: ZMK.makeOverrides += OS.Kernel=OpenBSD
debug-openbsd: debug-openbsd.log
GREP -qFx 'DEBUG: OS.Kernel=OpenBSD' <$<
GREP -qFx 'DEBUG: OS.ImageFormat=ELF' <$<
debug-netbsd.log: ZMK.makeOverrides += OS.Kernel=NetBSD
debug-netbsd: debug-netbsd.log
GREP -qFx 'DEBUG: OS.Kernel=NetBSD' <$<
GREP -qFx 'DEBUG: OS.ImageFormat=ELF' <$<
debug-hurd.log: ZMK.makeOverrides += OS.Kernel=GNU
debug-hurd: debug-hurd.log
GREP -qFx 'DEBUG: OS.Kernel=GNU' <$<
GREP -qFx 'DEBUG: OS.ImageFormat=ELF' <$<
debug-gnu-kfreebsd.log: ZMK.makeOverrides += OS.Kernel=GNU/kFreeBSD
debug-gnu-kfreebsd: debug-gnu-kfreebsd.log
GREP -qFx 'DEBUG: OS.Kernel=GNU/kFreeBSD' <$<
GREP -qFx 'DEBUG: OS.ImageFormat=ELF' <$<
debug-solaris.log: ZMK.makeOverrides += OS.Kernel=SunOS
debug-solaris: debug-solaris.log
GREP -qFx 'DEBUG: OS.Kernel=SunOS' <$<
GREP -qFx 'DEBUG: OS.ImageFormat=ELF' <$<
debug-darwin.log: ZMK.makeOverrides += OS.Kernel=Darwin
debug-darwin: debug-darwin.log
GREP -qFx 'DEBUG: OS.Kernel=Darwin' <$<
GREP -qFx 'DEBUG: OS.ImageFormat=Mach-O' <$<
debug-windows.log: export OS=Windows_NT
debug-windows: debug-windows.log
GREP -qFx 'DEBUG: OS.Kernel=Windows_NT' <$<
GREP -qFx 'DEBUG: OS.ImageFormat=PE' <$<
debug-haiku.log: ZMK.makeOverrides += OS.Kernel=Haiku
debug-haiku: debug-haiku.log
GREP -qFx 'DEBUG: OS.Kernel=Haiku' <$<
GREP -qFx 'DEBUG: OS.ImageFormat=ELF' <$<
debug-unknown.log: ZMK.makeOverrides += OS.Kernel=Unknown
debug-unknown: debug-unknown.log
GREP -Eq '[*]{3} unsupported operating system kernel Unknown\.' <$<
zmk-0.5.1/tests/ObjectGroup/Makefile 0000664 0001750 0001750 00000001170 13773062345 016064 0 ustar zyga zyga include z.mk
group1.Sources = main.c
$(eval $(call ZMK.Expand,ObjectGroup,group1))
group2.Sources = main.cpp
$(eval $(call ZMK.Expand,ObjectGroup,group2))
group3.Sources = main.m
$(eval $(call ZMK.Expand,ObjectGroup,group3))
# Alternative C++ extensions
group4.Sources = main.cxx
$(eval $(call ZMK.Expand,ObjectGroup,group4))
group5.Sources = main.cc
$(eval $(call ZMK.Expand,ObjectGroup,group5))
# Source code can be in arbitrary tree structure.
group6.Sources = src/main.c
$(eval $(call ZMK.Expand,ObjectGroup,group6))
.PHONY: build
build: group1-main.o group2-main.o group3-main.o group4-main.o group5-main.o src/group6-main.o
zmk-0.5.1/tests/ObjectGroup/Test.mk 0000664 0001750 0001750 00000005614 14027615611 015674 0 ustar zyga zyga #!/usr/bin/make -f
# This file is a part of zmk test system.
include zmk/internalTest.mk
t:: build build-sysroot clean
$(eval $(ZMK.isolateHostToolchain))
# MacOS uses c++, GNU uses g++ by default.
# Pick one for test consistency.
%.log: ZMK.makeOverrides += CXX=c++
# Some logs behave as if a sysroot was requested.
%-sysroot.log: ZMK.makeOverrides += Toolchain.SysRoot=/path
# Test depends on source files
%.log: main.c main.cc main.cpp main.cxx main.m src/main.c
build: build.log
# C/C++/ObjC object files can be built.
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF group1-main.d) -c -o group1-main.o $(ZMK.test.OutOfTreeSourcePath)main.c' <$<
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF group2-main.d) -c -o group2-main.o $(ZMK.test.OutOfTreeSourcePath)main.cpp' <$<
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF group3-main.d) -c -o group3-main.o $(ZMK.test.OutOfTreeSourcePath)main.m' <$<
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF group4-main.d) -c -o group4-main.o $(ZMK.test.OutOfTreeSourcePath)main.cxx' <$<
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF group5-main.d) -c -o group5-main.o $(ZMK.test.OutOfTreeSourcePath)main.cc' <$<
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF src/group6-main.d) -c -o src/group6-main.o $(ZMK.test.OutOfTreeSourcePath)src/main.c' <$<
build-sysroot: build-sysroot.log
# C/C++/ObjC object files can be built against an explicitly configured sysroot.
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF group1-main.d) -c --sysroot=/path -o group1-main.o $(ZMK.test.OutOfTreeSourcePath)main.c' <$<
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF group2-main.d) -c --sysroot=/path -o group2-main.o $(ZMK.test.OutOfTreeSourcePath)main.cpp' <$<
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF group3-main.d) -c --sysroot=/path -o group3-main.o $(ZMK.test.OutOfTreeSourcePath)main.m' <$<
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF group4-main.d) -c --sysroot=/path -o group4-main.o $(ZMK.test.OutOfTreeSourcePath)main.cxx' <$<
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF group5-main.d) -c --sysroot=/path -o group5-main.o $(ZMK.test.OutOfTreeSourcePath)main.cc' <$<
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF src/group6-main.d) -c --sysroot=/path -o src/group6-main.o $(ZMK.test.OutOfTreeSourcePath)src/main.c' <$<
clean: clean.log
# C/C++/ObjC object files can be cleaned.
GREP -qFx 'rm -f ./group1-main.o' <$<
GREP -qFx 'rm -f ./group1-main.d' <$<
GREP -qFx 'rm -f ./group2-main.o' <$<
GREP -qFx 'rm -f ./group2-main.d' <$<
GREP -qFx 'rm -f ./group3-main.o' <$<
GREP -qFx 'rm -f ./group3-main.d' <$<
GREP -qFx 'rm -f ./group4-main.o' <$<
GREP -qFx 'rm -f ./group4-main.d' <$<
GREP -qFx 'rm -f ./group5-main.o' <$<
GREP -qFx 'rm -f ./group5-main.d' <$<
GREP -qFx 'rm -f src/group6-main.o' <$<
GREP -qFx 'rm -f src/group6-main.d' <$<
zmk-0.5.1/tests/ObjectGroup/main.c 0000664 0001750 0001750 00000000140 13773062345 015510 0 ustar zyga zyga #include
#include
int main(void) {
printf("Hello World\n");
return 0;
}
zmk-0.5.1/tests/ObjectGroup/main.cc 0000664 0001750 0001750 00000000135 13773062345 015657 0 ustar zyga zyga #include
int main(void) {
std::cout << "Hello World" << std::endl;
return 0;
}
zmk-0.5.1/tests/ObjectGroup/main.cpp 0000664 0001750 0001750 00000000135 13773062345 016054 0 ustar zyga zyga #include
int main(void) {
std::cout << "Hello World" << std::endl;
return 0;
}
zmk-0.5.1/tests/ObjectGroup/main.cxx 0000664 0001750 0001750 00000000135 13773062345 016074 0 ustar zyga zyga #include
int main(void) {
std::cout << "Hello World" << std::endl;
return 0;
}
zmk-0.5.1/tests/ObjectGroup/main.m 0000664 0001750 0001750 00000000140 13773062345 015522 0 ustar zyga zyga #include
#include
int main(void) {
printf("Hello World\n");
return 0;
}
zmk-0.5.1/tests/ObjectGroup/src/main.c 0000664 0001750 0001750 00000000145 13773062345 016304 0 ustar zyga zyga #include
#include
int main(void) {
printf("Hello Underworld\n");
return 0;
}
zmk-0.5.1/tests/Program/Makefile 0000664 0001750 0001750 00000001145 14064705107 015244 0 ustar zyga zyga include z.mk
prog1.Sources = main.c
$(eval $(call ZMK.Expand,Program,prog1))
prog2.Sources = main.cpp
$(eval $(call ZMK.Expand,Program,prog2))
prog3.Sources = main.m
$(eval $(call ZMK.Expand,Program,prog3))
# Alternative C++ extensions
prog4.Sources = main.cxx
$(eval $(call ZMK.Expand,Program,prog4))
prog5.Sources = main.cc
$(eval $(call ZMK.Expand,Program,prog5))
# Source code can be in arbitrary tree structure.
prog6.Sources = src/main.c
$(eval $(call ZMK.Expand,Program,prog6))
# The binary can be in arbitrary tree structure.
subdir/prog7.Sources = main.c
$(eval $(call ZMK.Expand,Program,subdir/prog7))
zmk-0.5.1/tests/Program/Test.mk 0000664 0001750 0001750 00000021761 14064705107 015062 0 ustar zyga zyga #!/usr/bin/make -f
# This file is a part of zmk test system.
include zmk/internalTest.mk
t:: all all-sysroot install uninstall clean
$(eval $(ZMK.isolateHostToolchain))
# MacOS uses c++, GNU uses g++ by default.
# Pick one for test consistency.
%.log: ZMK.makeOverrides += CXX=c++
# Some logs behave as if a sysroot was requested.
%-sysroot.log: ZMK.makeOverrides += Toolchain.SysRoot=/path
# Test depends on source files
%.log: main.c main.cc main.cpp main.cxx main.m src/main.c
all: all.log
# C/C++/ObjC programs can be built.
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF prog1-main.d) -c -o prog1-main.o $(ZMK.test.OutOfTreeSourcePath)main.c' <$<
GREP -qFx 'cc -o prog1 prog1-main.o' <$<
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF prog2-main.d) -c -o prog2-main.o $(ZMK.test.OutOfTreeSourcePath)main.cpp' <$<
GREP -qFx 'c++ -o prog2 prog2-main.o' <$<
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF prog3-main.d) -c -o prog3-main.o $(ZMK.test.OutOfTreeSourcePath)main.m' <$<
GREP -qFx 'cc -o prog3 prog3-main.o -lobjc' <$<
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF prog4-main.d) -c -o prog4-main.o $(ZMK.test.OutOfTreeSourcePath)main.cxx' <$<
GREP -qFx 'c++ -o prog4 prog4-main.o' <$<
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF prog5-main.d) -c -o prog5-main.o $(ZMK.test.OutOfTreeSourcePath)main.cc' <$<
GREP -qFx 'c++ -o prog5 prog5-main.o' <$<
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF src/prog6-main.d) -c -o src/prog6-main.o $(ZMK.test.OutOfTreeSourcePath)src/main.c' <$<
GREP -qFx 'cc -o prog6 src/prog6-main.o' <$<
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF subdir/prog7-main.d) -c -o subdir/prog7-main.o $(ZMK.test.OutOfTreeSourcePath)main.c' <$<
GREP -qFx 'cc -o subdir/prog7 subdir/prog7-main.o' <$<
all-sysroot: all-sysroot.log
# C/C++/ObjC programs can be built against the configured sysroot.
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF prog1-main.d) -c --sysroot=/path -o prog1-main.o $(ZMK.test.OutOfTreeSourcePath)main.c' <$<
GREP -qFx 'cc --sysroot=/path -o prog1 prog1-main.o' <$<
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF prog2-main.d) -c --sysroot=/path -o prog2-main.o $(ZMK.test.OutOfTreeSourcePath)main.cpp' <$<
GREP -qFx 'c++ --sysroot=/path -o prog2 prog2-main.o' <$<
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF prog3-main.d) -c --sysroot=/path -o prog3-main.o $(ZMK.test.OutOfTreeSourcePath)main.m' <$<
GREP -qFx 'cc --sysroot=/path -o prog3 prog3-main.o -lobjc' <$<
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF prog4-main.d) -c --sysroot=/path -o prog4-main.o $(ZMK.test.OutOfTreeSourcePath)main.cxx' <$<
GREP -qFx 'c++ --sysroot=/path -o prog4 prog4-main.o' <$<
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF prog5-main.d) -c --sysroot=/path -o prog5-main.o $(ZMK.test.OutOfTreeSourcePath)main.cc' <$<
GREP -qFx 'c++ --sysroot=/path -o prog5 prog5-main.o' <$<
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF src/prog6-main.d) -c --sysroot=/path -o src/prog6-main.o $(ZMK.test.OutOfTreeSourcePath)src/main.c' <$<
GREP -qFx 'cc --sysroot=/path -o prog6 src/prog6-main.o' <$<
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF subdir/prog7-main.d) -c --sysroot=/path -o subdir/prog7-main.o $(ZMK.test.OutOfTreeSourcePath)main.c' <$<
GREP -qFx 'cc --sysroot=/path -o subdir/prog7 subdir/prog7-main.o' <$<
install: install.log
# C/C++/ObjC programs can be installed.
GREP -qFx 'install -d /usr/local/bin' <$<
GREP -qFx 'install -m 0755 prog1 /usr/local/bin/prog1' <$<
GREP -qFx 'install -m 0755 prog2 /usr/local/bin/prog2' <$<
GREP -qFx 'install -m 0755 prog3 /usr/local/bin/prog3' <$<
GREP -qFx 'install -m 0755 prog4 /usr/local/bin/prog4' <$<
GREP -qFx 'install -m 0755 prog5 /usr/local/bin/prog5' <$<
GREP -qFx 'install -m 0755 prog6 /usr/local/bin/prog6' <$<
GREP -qFx 'install -m 0755 subdir/prog7 /usr/local/bin/prog7' <$<
uninstall: uninstall.log
# C/C++/ObjC programs can be uninstalled.
GREP -qFx 'rm -f /usr/local/bin/prog1' <$<
GREP -qFx 'rm -f /usr/local/bin/prog2' <$<
GREP -qFx 'rm -f /usr/local/bin/prog3' <$<
GREP -qFx 'rm -f /usr/local/bin/prog4' <$<
GREP -qFx 'rm -f /usr/local/bin/prog5' <$<
GREP -qFx 'rm -f /usr/local/bin/prog6' <$<
GREP -qFx 'rm -f /usr/local/bin/prog7' <$<
clean: clean.log
# C/C++/ObjC programs can be cleaned.
GREP -qFx 'rm -f ./prog1-main.o' <$<
GREP -qFx 'rm -f ./prog1-main.d' <$<
GREP -qFx 'rm -f prog1' <$<
GREP -qFx 'rm -f ./prog2-main.o' <$<
GREP -qFx 'rm -f ./prog2-main.d' <$<
GREP -qFx 'rm -f prog2' <$<
GREP -qFx 'rm -f ./prog3-main.o' <$<
GREP -qFx 'rm -f ./prog3-main.d' <$<
GREP -qFx 'rm -f prog3' <$<
GREP -qFx 'rm -f ./prog4-main.o' <$<
GREP -qFx 'rm -f ./prog4-main.d' <$<
GREP -qFx 'rm -f prog4' <$<
GREP -qFx 'rm -f ./prog5-main.o' <$<
GREP -qFx 'rm -f ./prog5-main.d' <$<
GREP -qFx 'rm -f prog5' <$<
GREP -qFx 'rm -f src/prog6-main.o' <$<
GREP -qFx 'rm -f src/prog6-main.d' <$<
GREP -qFx 'rm -f prog6' <$<
GREP -qFx 'rm -f subdir/prog7' <$<
t:: all-exe
all-exe.log: ZMK.makeOverrides += exe=.exe
all-exe: all-exe.log
# C/C++ programs respect the .exe suffix (during building)
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF prog1-main.d) -c -o prog1-main.o $(ZMK.test.OutOfTreeSourcePath)main.c' <$<
GREP -qFx 'cc -o prog1.exe prog1-main.o' <$<
GREP -qFx 'c++ -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF prog2-main.d) -c -o prog2-main.o $(ZMK.test.OutOfTreeSourcePath)main.cpp' <$<
GREP -qFx 'c++ -o prog2.exe prog2-main.o' <$<
t:: install-custom-install-name
install-custom-install-name.log: ZMK.makeOverrides += prog1.InstallName=Prog1 subdir/prog7.InstallName=Prog7
install-custom-install-name: install-custom-install-name.log
# Program can have a custom InstallName
GREP -qFx 'install -d /usr/local/bin' <$<
GREP -qFx 'install -m 0755 prog1 /usr/local/bin/Prog1' <$<
GREP -qFx 'install -m 0755 subdir/prog7 /usr/local/bin/Prog7' <$<
t:: install-custom-install-mode
install-custom-install-mode.log: ZMK.makeOverrides += prog1.InstallMode=0700
install-custom-install-mode: install-custom-install-mode.log
# Program can have a custom InstallMode
GREP -qFx 'install -m 0700 prog1 /usr/local/bin/prog1' <$<
t:: install-custom-install-dir
install-custom-install-dir.log: ZMK.makeOverrides += prog1.InstallDir=/usr/local/sbin subdir/prog7.InstallDir=/usr/local/sbin
install-custom-install-dir: install-custom-install-dir.log
# Program can have a custom InstallDir
GREP -qFx 'install -m 0755 prog1 /usr/local/sbin/prog1' <$<
GREP -qFx 'install -m 0755 subdir/prog7 /usr/local/sbin/prog7' <$<
t:: install-custom-deep-install-dir
install-custom-deep-install-dir.log: ZMK.makeOverrides += prog1.InstallDir=/usr/local/lib/custom/bin subdir/prog7.InstallDir=/usr/local/lib/custom/bin
install-custom-deep-install-dir: install-custom-deep-install-dir.log
# Program with nested directories in InstallDir creates each directory.
GREP -qFx 'install -d /usr/local/lib' <$<
GREP -qFx 'install -d /usr/local/lib/custom' <$<
GREP -qFx 'install -d /usr/local/lib/custom/bin' <$<
GREP -qFx 'install -m 0755 prog1 /usr/local/lib/custom/bin/prog1' <$<
GREP -qFx 'install -m 0755 subdir/prog7 /usr/local/lib/custom/bin/prog7' <$<
t:: install-program-prefix
install-program-prefix.log: ZMK.makeOverrides += Configure.ProgramPrefix=prefix-
install-program-prefix: install-program-prefix.log
# Configured program prefix is used during the install phase.
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF prog1-main.d) -c -o prog1-main.o $(ZMK.test.OutOfTreeSourcePath)main.c' <$<
GREP -qFx 'cc -o prog1 prog1-main.o' <$<
GREP -qFx 'install -m 0755 prog1 /usr/local/bin/prefix-prog1' <$<
GREP -qFx 'install -m 0755 subdir/prog7 /usr/local/bin/prefix-prog7' <$<
t:: install-program-suffix
install-program-suffix.log: ZMK.makeOverrides += Configure.ProgramSuffix=-suffix
install-program-suffix: install-program-suffix.log
# Configured program suffix is used during the install phase.
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF prog1-main.d) -c -o prog1-main.o $(ZMK.test.OutOfTreeSourcePath)main.c' <$<
GREP -qFx 'cc -o prog1 prog1-main.o' <$<
GREP -qFx 'install -m 0755 prog1 /usr/local/bin/prog1-suffix' <$<
GREP -qFx 'install -m 0755 subdir/prog7 /usr/local/bin/prog7-suffix' <$<
t:: install-program-transform-name
install-program-transform-name.log: ZMK.makeOverrides += Configure.ProgramTransformName='s/prog\([1-9]\)/potato\1/g'
install-program-transform-name: install-program-transform-name.log
# Configured program transform expression is applied during the install phase.
GREP -qFx 'cc -MMD$(if $(ZMK.test.IsOutOfTreeBuild), -MF prog1-main.d) -c -o prog1-main.o $(ZMK.test.OutOfTreeSourcePath)main.c' <$<
GREP -qFx 'cc -o prog1 prog1-main.o' <$<
GREP -qFx 'install -m 0755 prog1 /usr/local/bin/potato1' <$<
GREP -qFx 'install -m 0755 subdir/prog7 /usr/local/bin/potato7' <$<
t:: install-exe
install-exe.log: ZMK.makeOverrides += exe=.exe
install-exe: install-exe.log
# C/C++ programs respect the .exe suffix (during installation)
GREP -qFx 'install -m 0755 prog1.exe /usr/local/bin/prog1.exe' <$<
zmk-0.5.1/tests/Program/main.c 0000664 0001750 0001750 00000000140 13773062345 014674 0 ustar zyga zyga #include
#include
int main(void) {
printf("Hello World\n");
return 0;
}
zmk-0.5.1/tests/Program/main.cc 0000664 0001750 0001750 00000000135 13773062345 015043 0 ustar zyga zyga #include
int main(void) {
std::cout << "Hello World" << std::endl;
return 0;
}
zmk-0.5.1/tests/Program/main.cpp 0000664 0001750 0001750 00000000135 13773062345 015240 0 ustar zyga zyga #include
int main(void) {
std::cout << "Hello World" << std::endl;
return 0;
}
zmk-0.5.1/tests/Program/main.cxx 0000664 0001750 0001750 00000000135 13773062345 015260 0 ustar zyga zyga #include
int main(void) {
std::cout << "Hello World" << std::endl;
return 0;
}
zmk-0.5.1/tests/Program/main.m 0000664 0001750 0001750 00000000140 13773062345 014706 0 ustar zyga zyga #include
#include
int main(void) {
printf("Hello World\n");
return 0;
}
zmk-0.5.1/tests/Program/src/main.c 0000664 0001750 0001750 00000000145 13773062345 015470 0 ustar zyga zyga #include
#include
int main(void) {
printf("Hello Underworld\n");
return 0;
}
zmk-0.5.1/tests/Symlink/Makefile 0000664 0001750 0001750 00000001046 14064705643 015270 0 ustar zyga zyga include z.mk
name1.InstallDir = /some/path
name1.SymlinkTarget=target
$(eval $(call ZMK.Expand,Symlink,name1))
name2.InstallDir = /other/path
name2.InstallName = custom-install-name2
name2.SymlinkTarget=target
$(eval $(call ZMK.Expand,Symlink,name2))
subdir/name3.InstallDir = /other/path
subdir/name3.SymlinkTarget=../target
$(eval $(call ZMK.Expand,Symlink,subdir/name3))
subdir/name4.InstallDir = /other/path
subdir/name4.InstallName = custom-install-name4
subdir/name4.SymlinkTarget=../target
$(eval $(call ZMK.Expand,Symlink,subdir/name4))
zmk-0.5.1/tests/Symlink/Test.mk 0000664 0001750 0001750 00000005515 14064705643 015105 0 ustar zyga zyga #!/usr/bin/make -f
include zmk/internalTest.mk
t:: all clean install uninstall \
all-destdir clean-destdir install-destdir uninstall-destdir
# Test logs will contain debugging messages
%.log: ZMK.makeOverrides += DEBUG=symlink
# Some logs have DESTDIR set to /destdir
%-destdir.log: ZMK.makeOverrides += DESTDIR=/destdir
all: all.log
# Building a symlink just creates it.
GREP -qFx 'ln -sf target name1' <$<
GREP -qFx 'ln -sf target name2' <$<
GREP -qFx 'install -d subdir' <$<
GREP -qFx 'ln -sf ../target subdir/name3' <$<
GREP -qFx 'ln -sf ../target subdir/name4' <$<
clean: clean.log
# Cleaning a symlink removes it.
GREP -qFx 'rm -f name1' <$<
GREP -qFx 'rm -f name2' <$<
GREP -qFx 'rm -f subdir/name3' <$<
GREP -qFx 'rm -f subdir/name4' <$<
install: install.log
# Installing a symlink creates the install directory
# and then places the symlink there.
GREP -qFx 'install -d /some' <$<
GREP -qFx 'install -d /some/path' <$<
GREP -qFx 'ln -sf target /some/path/name1' <$<
GREP -qFx 'ln -sf target /other/path/custom-install-name2' <$<
GREP -qFx 'install -d /other' <$<
GREP -qFx 'install -d /other/path' <$<
GREP -qFx 'ln -sf ../target /other/path/name3' <$<
GREP -qFx 'ln -sf ../target /other/path/custom-install-name4' <$<
uninstall: uninstall.log
# Uninstalling a symlink removes it.
GREP -qFx 'rm -f /some/path/name1' <$<
GREP -qFx 'rm -f /other/path/custom-install-name2' <$<
GREP -qFx 'rm -f /other/path/name3' <$<
GREP -qFx 'rm -f /other/path/custom-install-name4' <$<
all-destdir: all-destdir.log
# Building a symlink just creates it.
GREP -qFx 'ln -sf target name1' <$<
GREP -qFx 'ln -sf target name2' <$<
GREP -qFx 'install -d subdir' <$<
GREP -qFx 'ln -sf ../target subdir/name3' <$<
GREP -qFx 'ln -sf ../target subdir/name4' <$<
clean-destdir: clean-destdir.log
# Cleaning a symlink removes it.
GREP -qFx 'rm -f name1' <$<
GREP -qFx 'rm -f name2' <$<
GREP -qFx 'rm -f subdir/name3' <$<
GREP -qFx 'rm -f subdir/name4' <$<
install-destdir: install-destdir.log
# Installing a symlink creates the install directory
# and then places the symlink there.
GREP -qFx 'mkdir -p /destdir' <$<
GREP -qFx 'install -d /destdir/some' <$<
GREP -qFx 'install -d /destdir/some/path' <$<
GREP -qFx 'ln -sf target /destdir/some/path/name1' <$<
GREP -qFx 'ln -sf target /destdir/other/path/custom-install-name2' <$<
GREP -qFx 'install -d /destdir/other' <$<
GREP -qFx 'install -d /destdir/other/path' <$<
GREP -qFx 'ln -sf ../target /destdir/other/path/name3' <$<
GREP -qFx 'ln -sf ../target /destdir/other/path/custom-install-name4' <$<
uninstall-destdir: uninstall-destdir.log
# Uninstalling a symlink removes it.
GREP -qFx 'rm -f /destdir/some/path/name1' <$<
GREP -qFx 'rm -f /destdir/other/path/custom-install-name2' <$<
GREP -qFx 'rm -f /destdir/other/path/name3' <$<
GREP -qFx 'rm -f /destdir/other/path/custom-install-name4' <$<
zmk-0.5.1/tests/Tarball.Src/Makefile 0000664 0001750 0001750 00000000233 13773062345 015747 0 ustar zyga zyga include z.mk
NAME = test
VERSION = 1
$(NAME)_$(VERSION).tar.gz.Files += foo.txt Makefile
$(eval $(call ZMK.Expand,Tarball.Src,$(NAME)_$(VERSION).tar.gz))
zmk-0.5.1/tests/Tarball.Src/Test.mk 0000664 0001750 0001750 00000006503 13773062345 015565 0 ustar zyga zyga #!/usr/bin/make -f
include zmk/internalTest.mk
t:: dist-gnu dist-non-gnu dist-darwin dist-CI dist-as-bob dist-as-alice dist-as-eve
# Test logs will contain debugging messages
%.log: ZMK.makeOverrides += DEBUG=tarball
# Test logs will specialize for either GNU tar or BSD tar
%-gnu.log: ZMK.makeOverrides += Tarball.tar=/usr/bin/tar Tarball.isGNU=yes
%-bsd.log: ZMK.makeOverrides += Tarball.tar=/usr/bin/tar Tarball.isGNU=
# Unset CI if we happen to see one from the likes of GitHub Actions or Travis
%.log: ZMK.makeOverrides += CI=
dist-gnu.log: ZMK.makeOverrides += Tarball.isGNU=yes OS.Kernel=test
dist-gnu: dist-gnu.log
# Archiving source release tarball archives the files given by the user
GREP -qF "/usr/bin/tar -zcf test_1.tar.gz$(if $(ZMK.test.IsOutOfTreeBuild), -C $(ZMK.test.SrcDir)) --absolute-names " <$<
GREP -qF ' foo.txt' <$<
# It also archives zmk (only parts are tested)
GREP -qF '$(ZMK.test.Path)/z.mk' <$<
GREP -qF '$(ZMK.test.Path)/zmk/Configure.mk' <$<
GREP -qF '$(ZMK.test.Path)/zmk/pvs-filter.awk' <$<
# GNU-specific transformation syntax is supported.
GREP -qF -- " --xform='s@$(CURDIR)/@@g' " <$<
GREP -qF -- " --xform='s@$(ZMK.test.Path)/@@g' " <$<
GREP -qF -- " --xform='s@.version-from-git@.version@' " <$<
GREP -qF -- " --xform='s@^@test_1/@' " <$<
dist-non-gnu.log: ZMK.makeOverrides += Tarball.isGNU= OS.Kernel=test
dist-non-gnu: dist-non-gnu.log
# Archiving source release tarball archives the files given by the user
GREP -qF "/usr/bin/tar -zcf test_1.tar.gz$(if $(ZMK.test.IsOutOfTreeBuild), -C $(ZMK.test.SrcDir)) " <$<
GREP -qF ' foo.txt' <$<
# It also archives zmk (only parts are tested)
GREP -qF '$(ZMK.test.Path)/z.mk' <$<
GREP -qF '$(ZMK.test.Path)/zmk/Configure.mk' <$<
GREP -qF '$(ZMK.test.Path)/zmk/pvs-filter.awk' <$<
# BSD-specific transformation syntax is supported.
GREP -qF -- " -s '@$(CURDIR)/@@g' " <$<
GREP -qF -- " -s '@$(ZMK.test.Path)/@@g' " <$<
GREP -qF -- " -s '@^.version-from-git@test_1/.version@' " <$<
GREP -qF -- " -s '@^.@test_1/~@' " <$<
dist-darwin.log: ZMK.makeOverrides += OS.Kernel=Darwin
dist-darwin.log: ZMK.makeOverrides += Tarball.isGNU=
dist-darwin: dist-darwin.log
# Darwin meta-data is excluded.
GREP -qF 'tar -zcf test_1.tar.gz$(if $(ZMK.test.IsOutOfTreeBuild), -C $(ZMK.test.SrcDir)) --no-mac-metadata ' <$<
# XXX: we reuse Alice's HOME directory for this test.
dist-CI.log: ZMK.makeOverrides += CI=fake
dist-CI.log: ZMK.makeOverrides += HOME=$(ZMK.test.SrcDir)/home/alice
dist-CI: dist-CI.log
# When CI is set release archives are not signed, even if we have keys
! GREP -qFx 'gpg --detach-sign --armor test_1.tar.gz' <$<
dist-as-bob.log: ZMK.makeOverrides += HOME=$(ZMK.test.SrcDir)/home/bob zmk.haveGPG=yes
dist-as-bob: dist-as-bob.log
# Bob does not have a gpg key, so his releases are not signed
! GREP -qFx 'gpg --detach-sign --armor test_1.tar.gz' <$<
dist-as-alice.log: ZMK.makeOverrides += HOME=$(ZMK.test.SrcDir)/home/alice zmk.haveGPG=yes zmk.haveGPGKeys=yes
dist-as-alice: dist-as-alice.log
# Alice has a gpg key, so her releases are signed
GREP -qFx 'gpg --detach-sign --armor test_1.tar.gz' <$<
dist-as-eve.log: ZMK.makeOverrides += HOME=$(ZMK.test.SrcDir)/home/eve zmk.haveGPG= zmk.haveGPGKeys=yes
dist-as-eve: dist-as-eve.log
# Eve has a gpg key but lacks gpg itself, so her releases are not signed
! GREP -qFx 'gpg --detach-sign --armor test_1.tar.gz' <$<
zmk-0.5.1/tests/Tarball.Src/foo.txt 0000664 0001750 0001750 00000000045 13736672702 015637 0 ustar zyga zyga Text file for archiving in a release
zmk-0.5.1/tests/Tarball.Src/home/alice/.gnupg/fake-gpg-data 0000664 0001750 0001750 00000000065 13773062345 022030 0 ustar zyga zyga This file keeps the home-dir/.gnupg directory around
zmk-0.5.1/tests/Tarball.Src/home/bob/.gitkeep 0000664 0001750 0001750 00000000000 13773062345 017422 0 ustar zyga zyga zmk-0.5.1/tests/Tarball.Src/home/eve/.gnupg/fake-gpg-data 0000664 0001750 0001750 00000000065 13773062345 021532 0 ustar zyga zyga This file keeps the home-dir/.gnupg directory around
zmk-0.5.1/tests/Target.check/Makefile 0000664 0001750 0001750 00000000240 14027615611 016131 0 ustar zyga zyga include z.mk
# the :foo: syntax used below is to avoid ambiguity with default grep matching
check::
@echo "target :$@:"
static-check::
@echo "target :$@:"
zmk-0.5.1/tests/Target.check/Test.mk 0000664 0001750 0001750 00000001120 14027615611 015737 0 ustar zyga zyga #!/usr/bin/make -f
include zmk/internalTest.mk
t:: check static-check
check: check.log
# The check target depends on static-check
GREP -qFx 'echo "target :check:"' <$<
GREP -qFx 'echo "target :static-check:"' <$<
# internalTest.mk uses dashes to separate targets and
# cannot deduce a target that uses dashes itself.
# Provide the target explicitly with override.
static-check.log: ZMK.makeTarget=static-check
static-check: static-check.log
# The static check target runs just the static checks.
GREP -qFx 'echo "target :static-check:"' <$<
GREP -v -qFx 'echo "target :check:"' <$<
zmk-0.5.1/tests/Target.distclean/Makefile 0000664 0001750 0001750 00000000247 14027615611 017031 0 ustar zyga zyga include z.mk
# the :foo: syntax used below is to avoid ambiguity with default grep matching
clean::
@echo "target :clean:"
distclean::
@echo "target :distclean:"
zmk-0.5.1/tests/Target.distclean/Test.mk 0000664 0001750 0001750 00000000636 14027615611 016643 0 ustar zyga zyga #!/usr/bin/make -f
include zmk/internalTest.mk
t:: clean distclean
clean: clean.log
# The clean target run the clean but not the distclean command.
GREP -qFx 'echo "target :clean:"' <$<
GREP -v -qFx 'echo "target :distclean:"' <$<
distclean: distclean.log
# The distclean target run both the clean and the distclean command.
GREP -qFx 'echo "target :clean:"' <$<
GREP -qFx 'echo "target :distclean:"' <$<
zmk-0.5.1/tests/Toolchain/Makefile 0000664 0001750 0001750 00000000113 13736672702 015560 0 ustar zyga zyga include z.mk
$(eval $(call ZMK.Import,Toolchain))
.PHONY: debug
debug: ;
zmk-0.5.1/tests/Toolchain/Test.mk 0000664 0001750 0001750 00000025646 14027615611 015400 0 ustar zyga zyga #!/usr/bin/make -f
include zmk/internalTest.mk
t:: debug-defaults debug-sysroot debug-dependency-tracking \
debug-mingw-cc-detection debug-mingw-cxx-detection \
debug-watcom-dos-cc-detection debug-watcom-dos-cxx-detection \
debug-watcom-win16-cc-detection debug-watcom-win16-cxx-detection \
debug-watcom-win32-cc-detection debug-watcom-win32-cxx-detection \
debug-gcc-configured-cross debug-g++-configured-cross \
# Test logs will contain debugging messages
%.log: ZMK.makeOverrides += DEBUG=toolchain
# Isolate from any tools installed on the host.
# This is useful to verify with forkstat(1).
%.log: ZMK.makeOverrides += Toolchain.CC.IsAvailable=yes
%.log: ZMK.makeOverrides += Toolchain.CXX.IsAvailable=yes
%.log: ZMK.makeOverrides += Toolchain.cc=/usr/bin/host-linux-gnu-gcc
%.log: ZMK.makeOverrides += Toolchain.cc.dumpmachine=host-linux-gnu
%.log: ZMK.makeOverrides += Toolchain.gcc.dumpmachine=build-linux-gnu
%.log: ZMK.makeOverrides += Toolchain.cxx=/usr/bin/host-linux-gnu-g++
%.log: ZMK.makeOverrides += Toolchain.cxx.dumpmachine=host-linux-gnu
%.log: ZMK.makeOverrides += Toolchain.g++.dumpmachine=build-linux-gnu
%.log: ZMK.makeOverrides += Toolchain.cc.version=
%.log: ZMK.makeOverrides += Toolchain.cxx.version=
debug-defaults: debug-defaults.log
# By default CC=cc and CXX is either c++ or g++.
GREP -qFx 'DEBUG: CC=cc' <$<
GREP -qx 'DEBUG: CXX=[cg][+][+]' <$<
debug-sysroot.log: ZMK.makeOverrides += Configure.SysRoot=/path
debug-sysroot: debug-sysroot.log
# SysRoot setting is inherited from the configuration system.
GREP -qFx 'DEBUG: Toolchain.SysRoot=/path' <$<
debug-dependency-tracking.log: ZMK.makeOverrides += Configure.DependencyTracking=yes
debug-dependency-tracking: debug-dependency-tracking.log
# DependencyTracking setting is inherited from the configuration system.
GREP -qFx 'DEBUG: Toolchain.DependencyTracking=yes' <$<
debug-mingw-cc-detection.log: ZMK.makeOverrides += CC=fake-fake-mingw32-gcc
debug-mingw-cc-detection.log: ZMK.makeOverrides += Toolchain.cc.dumpmachine=fake-fake-mingw32
debug-mingw-cc-detection: debug-mingw-cc-detection.log
# When CC is set to a mingw C compiler, then the image format is PE
# and the toolchain is assumed to be a cross toolchain.
# TODO: add a variant of this test that does not toggle cross
# compilation condition from Windows.
GREP -qFx 'DEBUG: .exe suffix enabled because fake-fake-mingw32-gcc -dumpmachine mentions mingw' <$<
GREP -qFx 'DEBUG: cross-compiling because gcc -dumpmachine and fake-fake-mingw32-gcc -dumpmachine differ' <$<
GREP -qFx 'DEBUG: Toolchain.CC.ImageFormat=PE' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsCross=yes' <$<
GREP -qFx 'DEBUG: Toolchain.ImageFormat=Mixed' <$<
GREP -qFx 'DEBUG: Toolchain.IsCross=yes' <$<
debug-mingw-cxx-detection.log: ZMK.makeOverrides += CXX=fake-fake-mingw32-g++
debug-mingw-cxx-detection.log: ZMK.makeOverrides += Toolchain.cxx.dumpmachine=fake-fake-mingw32
debug-mingw-cxx-detection: debug-mingw-cxx-detection.log
# When CXX is set to a mingw C++ compiler, then the image format is PE
# and the toolchain is assumed to be a cross toolchain.
# TODO: add a variant of this test that does not toggle cross
# compilation condition from Windows.
GREP -qFx 'DEBUG: .exe suffix enabled because fake-fake-mingw32-g++ -dumpmachine mentions mingw' <$<
GREP -qFx 'DEBUG: cross-compiling because g++ -dumpmachine and fake-fake-mingw32-g++ -dumpmachine differ' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.ImageFormat=PE' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.IsCross=yes' <$<
GREP -qFx 'DEBUG: Toolchain.ImageFormat=Mixed' <$<
GREP -qFx 'DEBUG: Toolchain.IsCross=yes' <$<
debug-watcom-dos-cc-detection.log: ZMK.makeOverrides += CC=open-watcom.owcc-dos
debug-watcom-dos-cc-detection.log: ZMK.makeOverrides += Toolchain.cc=/snap/open-watcom.owcc-dos
debug-watcom-dos-cc-detection: debug-watcom-dos-cc-detection.log
# When CC is set to a OpenWatcom C compiler targeting DOS,
# then the image format is MZ and the toolchain is assumed to be a
# cross toolchain.
GREP -qFx 'DEBUG: .exe suffix enabled because open-watcom.owcc-dos name' <$<
GREP -qFx 'DEBUG: cross-compiling because Watcom targets DOS' <$<
GREP -qFx 'DEBUG: Toolchain.CC.ImageFormat=MZ' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsCross=yes' <$<
GREP -qFx 'DEBUG: Toolchain.ImageFormat=Mixed' <$<
GREP -qFx 'DEBUG: Toolchain.IsCross=yes' <$<
debug-watcom-dos-cxx-detection.log: ZMK.makeOverrides += CXX=open-watcom.owcc-dos
debug-watcom-dos-cxx-detection.log: ZMK.makeOverrides += Toolchain.cxx=/snap/open-watcom.owcc-dos
debug-watcom-dos-cxx-detection: debug-watcom-dos-cxx-detection.log
# When CXX is set to a OpenWatcom C++ compiler targeting DOS,
# then the image format is MZ and the toolchain is assumed to be a
# cross toolchain.
GREP -qFx 'DEBUG: .exe suffix enabled because open-watcom.owcc-dos name' <$<
GREP -qFx 'DEBUG: cross-compiling because Watcom targets DOS' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.ImageFormat=MZ' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.IsCross=yes' <$<
GREP -qFx 'DEBUG: Toolchain.ImageFormat=Mixed' <$<
GREP -qFx 'DEBUG: Toolchain.IsCross=yes' <$<
debug-watcom-win16-cc-detection.log: ZMK.makeOverrides += CC=open-watcom.owcc-win16
debug-watcom-win16-cc-detection.log: ZMK.makeOverrides += Toolchain.cc=/snap/open-watcom.owcc-win16
debug-watcom-win16-cc-detection: debug-watcom-win16-cc-detection.log
# When CC is set to a OpenWatcom C compiler targeting Windows 3.x,
# then the image format is MZ and the toolchain is assumed to be a
# cross toolchain.
GREP -qFx 'DEBUG: .exe suffix enabled because open-watcom.owcc-win16 name' <$<
GREP -qFx 'DEBUG: cross-compiling because Watcom targets DOS' <$<
GREP -qFx 'DEBUG: Toolchain.CC.ImageFormat=MZ' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsCross=yes' <$<
GREP -qFx 'DEBUG: Toolchain.ImageFormat=Mixed' <$<
GREP -qFx 'DEBUG: Toolchain.IsCross=yes' <$<
debug-watcom-win16-cxx-detection.log: ZMK.makeOverrides += CXX=open-watcom.owcc-win16
debug-watcom-win16-cxx-detection.log: ZMK.makeOverrides += Toolchain.cxx=/snap/open-watcom.owcc-win16
debug-watcom-win16-cxx-detection: debug-watcom-win16-cxx-detection.log
# When CXX is set to a OpenWatcom C++ compiler targeting Windows 3.x,
# then the image format is MZ and the toolchain is assumed to be a
# cross toolchain.
GREP -qFx 'DEBUG: .exe suffix enabled because open-watcom.owcc-win16 name' <$<
GREP -qFx 'DEBUG: cross-compiling because Watcom targets DOS' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.ImageFormat=MZ' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.IsCross=yes' <$<
GREP -qFx 'DEBUG: Toolchain.ImageFormat=Mixed' <$<
GREP -qFx 'DEBUG: Toolchain.IsCross=yes' <$<
debug-watcom-win32-cc-detection.log: ZMK.makeOverrides += CC=open-watcom.owcc-win32
debug-watcom-win32-cc-detection.log: ZMK.makeOverrides += Toolchain.cc=/snap/open-watcom.owcc-win32
debug-watcom-win32-cc-detection: debug-watcom-win32-cc-detection.log
# When CC is set to a OpenWatcom C compiler targeting Windows NT,
# then the image format is PE and the toolchain is assumed to be a
# cross toolchain.
GREP -qFx 'DEBUG: .exe suffix enabled because open-watcom.owcc-win32 name' <$<
GREP -qFx 'DEBUG: cross-compiling because Watcom targets Windows' <$<
GREP -qFx 'DEBUG: Toolchain.CC.ImageFormat=PE' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsCross=yes' <$<
GREP -qFx 'DEBUG: Toolchain.ImageFormat=Mixed' <$<
GREP -qFx 'DEBUG: Toolchain.IsCross=yes' <$<
debug-watcom-win32-cxx-detection.log: ZMK.makeOverrides += CXX=open-watcom.owcc-win32
debug-watcom-win32-cxx-detection.log: ZMK.makeOverrides += Toolchain.cxx=/snap/open-watcom.owcc-win32
debug-watcom-win32-cxx-detection: debug-watcom-win32-cxx-detection.log
# When CXX is set to a OpenWatcom C++ compiler targeting Windows NT,
# then the image format is PE and the toolchain is assumed to be a
# cross toolchain.
GREP -qFx 'DEBUG: .exe suffix enabled because open-watcom.owcc-win32 name' <$<
GREP -qFx 'DEBUG: cross-compiling because Watcom targets Windows' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.ImageFormat=PE' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.IsCross=yes' <$<
GREP -qFx 'DEBUG: Toolchain.ImageFormat=Mixed' <$<
GREP -qFx 'DEBUG: Toolchain.IsCross=yes' <$<
debug-gcc-configured-cross.log: ZMK.makeOverrides += Configure.Configured=yes
debug-gcc-configured-cross.log: ZMK.makeOverrides += Configure.HostArchTriplet=host-linux-gnu
debug-gcc-configured-cross.log: ZMK.makeOverrides += Configure.BuildArchTriplet=build-linux-gnu
debug-gcc-configured-cross.log: ZMK.makeOverrides += Toolchain.cc=/usr/bin/host-linux-gnu-gcc
debug-gcc-configured-cross.log: ZMK.makeOverrides += Toolchain.cc.dumpmachine=host-linux-gnu
debug-gcc-configured-cross.log: ZMK.makeOverrides += Toolchain.gcc.dumpmachine=build-linux-gnu
debug-gcc-configured-cross.log: ZMK.makeOverrides += Toolchain.cxx=/usr/bin/host-linux-gnu-g++
debug-gcc-configured-cross.log: ZMK.makeOverrides += Toolchain.cxx.dumpmachine=host-linux-gnu
debug-gcc-configured-cross.log: ZMK.makeOverrides += Toolchain.g++.dumpmachine=build-linux-gnu
debug-gcc-configured-cross: debug-gcc-configured-cross.log
# When the configure script selects different linux build and host
# machines, then both the C and C++ compilers are set to the
# appropriate GCC binary, then image format is ELF and the toolchain is
# assumed to be a cross toolchain.
GREP -qFx 'DEBUG: gcc cross-compiler selected CC=host-linux-gnu-gcc' <$<
GREP -qFx 'DEBUG: cross-compiling because gcc -dumpmachine and host-linux-gnu-gcc -dumpmachine differ' <$<
GREP -qFx 'DEBUG: Toolchain.CC.ImageFormat=ELF' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsCross=yes' <$<
GREP -qFx 'DEBUG: Toolchain.ImageFormat=ELF' <$<
GREP -qFx 'DEBUG: Toolchain.IsCross=yes' <$<
debug-g++-configured-cross.log: ZMK.makeOverrides += Configure.Configured=yes
debug-g++-configured-cross.log: ZMK.makeOverrides += Configure.HostArchTriplet=host-linux-gnu
debug-g++-configured-cross.log: ZMK.makeOverrides += Configure.BuildArchTriplet=build-linux-gnu
debug-g++-configured-cross.log: ZMK.makeOverrides += Toolchain.cc=/usr/bin/host-linux-gnu-gcc
debug-g++-configured-cross.log: ZMK.makeOverrides += Toolchain.cc.dumpmachine=host-linux-gnu
debug-g++-configured-cross.log: ZMK.makeOverrides += Toolchain.cxx=/usr/bin/host-linux-gnu-g++
debug-g++-configured-cross.log: ZMK.makeOverrides += Toolchain.cxx.dumpmachine=host-linux-gnu
debug-g++-configured-cross.log: ZMK.makeOverrides += Toolchain.gcc.dumpmachine=build-linux-gnu
debug-g++-configured-cross.log: ZMK.makeOverrides += Toolchain.g++.dumpmachine=build-linux-gnu
debug-g++-configured-cross: debug-g++-configured-cross.log
# When the configure script selects different linux build and host
# machines, then both the C and C++ compilers are set to the
# appropriate GCC binary, the image format is ELF and the toolchain is
# assumed to be a cross toolchain.
GREP -qFx 'DEBUG: g++ cross-compiler selected CXX=host-linux-gnu-g++' <$<
GREP -qFx 'DEBUG: cross-compiling because g++ -dumpmachine and host-linux-gnu-g++ -dumpmachine differ' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.ImageFormat=ELF' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.IsCross=yes' <$<
GREP -qFx 'DEBUG: Toolchain.ImageFormat=ELF' <$<
GREP -qFx 'DEBUG: Toolchain.IsCross=yes' <$<
zmk-0.5.1/tests/Toolchain/integration/Makefile 0000664 0001750 0001750 00000000113 14012052114 020054 0 ustar zyga zyga include z.mk
$(eval $(call ZMK.Import,Toolchain))
.PHONY: debug
debug: ;
zmk-0.5.1/tests/Toolchain/integration/Test.mk 0000664 0001750 0001750 00000004663 14027615611 017717 0 ustar zyga zyga #!/usr/bin/make -f
include zmk/internalTest.mk
t:: integration
# Test logs will contain debugging messages
%.log: ZMK.makeOverrides += DEBUG=toolchain
integration: integration.log
ifeq ($(ZMK.test.OSRelease.ID),freebsd)
GREP -qFx 'DEBUG: Toolchain.CC.ImageFormat=ELF' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsAvailable=yes' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsClang=yes' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsCross=' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsGcc=' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsTcc=' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsWatcom=' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.ImageFormat=ELF' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.IsAvailable=yes' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.IsClang=yes' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.IsCross=' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.IsGcc=' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.IsWatcom=' <$<
GREP -qFx 'DEBUG: Toolchain.DependencyTracking=yes' <$<
GREP -qFx 'DEBUG: Toolchain.ImageFormat=ELF' <$<
GREP -qFx 'DEBUG: Toolchain.IsClang=yes' <$<
GREP -qFx 'DEBUG: Toolchain.IsCross=' <$<
GREP -qFx 'DEBUG: Toolchain.IsGcc=' <$<
GREP -qFx 'DEBUG: Toolchain.IsWatcom=' <$<
GREP -qFx 'DEBUG: Toolchain.cc=/usr/bin/cc' <$<
GREP -qFx 'DEBUG: Toolchain.cxx=/usr/bin/c++' <$<
else ifeq ($(ZMK.test.OSRelease.ID),macos)
GREP -qFx 'DEBUG: Toolchain.CC.ImageFormat=Mach-O' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsAvailable=yes' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsClang=yes' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsCross=' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsGcc=' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsTcc=' <$<
GREP -qFx 'DEBUG: Toolchain.CC.IsWatcom=' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.ImageFormat=Mach-O' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.IsAvailable=yes' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.IsClang=yes' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.IsCross=' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.IsGcc=' <$<
GREP -qFx 'DEBUG: Toolchain.CXX.IsWatcom=' <$<
GREP -qFx 'DEBUG: Toolchain.DependencyTracking=yes' <$<
GREP -qFx 'DEBUG: Toolchain.ImageFormat=Mach-O' <$<
GREP -qFx 'DEBUG: Toolchain.IsClang=yes' <$<
GREP -qFx 'DEBUG: Toolchain.IsCross=' <$<
GREP -qFx 'DEBUG: Toolchain.IsGcc=' <$<
GREP -qFx 'DEBUG: Toolchain.IsWatcom=' <$<
# Note, do not test Toolchain.cc and Toolchain.cxx - those may vary. It
# seems that vanilla Xcode.app provides /usr/bin/cc{,++} respectively but,
# for example, GitHub actions MacOS runner has an environment with a
# specific Xcode_12.2.app and /usr/bin/clang{,++}.
endif
zmk-0.5.1/tests/bin/GREP 0000775 0001750 0001750 00000002651 14064711144 013431 0 ustar zyga zyga #!/bin/sh
# Find the system grep, taking precautions not to pick this script again.
IFS=:
for dir in $PATH; do
# shellcheck disable=3013
if [ -x "$dir/grep" ] && [ ! "$0" -ef "$dir/grep" ]; then
grep="$dir/grep"
break
fi
done
unset IFS
test -n "$grep" || ( echo "GREP: cannot find system grep"; exit 1 )
# If a case-insensitive filesystem picked this script over the system grep
# implementation, execute the system grep.
if [ "$(basename "$0")" = grep ]; then
exec "$grep" "$@"
fi
# Make sure we have the pattern or any other arguments given.
if [ $# -eq 0 ]; then
echo "Usage: GREP [options] [pattern] [file ...]"
exit
fi
# Make sure that we are not accidentally reading from a tty.
if [ -t 0 ]; then
echo "GREP: refusing to match terminal input"
exit 1
fi
# Read the input to a temporary buffer.
input_temp="$(mktemp)"
trap 'rm -f $input_temp' EXIT
cat >"$input_temp"
# If the input matches the given pattern, we're all set.
if "$grep" -q "$@" "$input_temp"; then
exit
fi
# Display information about failed match, along with the input and the pattern.
printf 'GREP: failed to match: grep'
for arg in "$@"; do
printf ' "%s"' "$(echo "$arg" | sed -e 's@\(["$]\)@\\\1@g')"
done
printf '\n'
if [ "$(wc -l < "$input_temp")" -gt 1 ]; then
printf 'GREP: input starts below:\n\n'
cat "$input_temp"
printf '\nGREP: input ends above.\n'
else
printf 'GREP: for input "%s"\n' "$(sed -e 's@\(["$]\)@\\\1@g' "$input_temp")"
fi
exit 1