From c5e708c83d94cc795b2a3f0671d163a175e4bc35 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Sat, 23 Jul 2022 20:24:39 +0200 Subject: [PATCH] Custom autoconf based buildsystem This is plagued with corner cases such as config.guess not being available in all cases (make dist, make distcheck, etc.). The corner cases could maybe fixed by just making this a proper Automake project, with Makefile.am including a top- level Makefile.am so that automake+autoreconf pull in the proper stuff like config.guess. HOWEVER, the top-level GNUmakefile.in could include the same Makefile-files, and therefore also include the same source code definitions, but build/install them in a better way. --- .github/workflows/beep-build.yml | 15 +- .gitignore | 13 + Doxyfile.in | 1 + GNUmakefile | 744 ------------------------------- GNUmakefile.in | 682 ++++++++++++++++++++++++++++ Makefile.am | 7 + auto-m4/.gitignore | 1 + beep-config.h.in | 2 + beep.1.in | 2 + compile-check.c | 4 + configure.ac | 107 +++++ m4/sb-prog.m4 | 14 + m4/sb-summary.m4 | 36 ++ package.mk | 146 ++++++ stamp-h.in | 1 + testbuild-all | 28 +- 16 files changed, 1036 insertions(+), 767 deletions(-) delete mode 100644 GNUmakefile create mode 100644 GNUmakefile.in create mode 100644 Makefile.am create mode 100644 auto-m4/.gitignore create mode 100644 compile-check.c create mode 100644 configure.ac create mode 100644 m4/sb-prog.m4 create mode 100644 m4/sb-summary.m4 create mode 100644 package.mk create mode 100644 stamp-h.in diff --git a/.github/workflows/beep-build.yml b/.github/workflows/beep-build.yml index 8827418..b40ba96 100644 --- a/.github/workflows/beep-build.yml +++ b/.github/workflows/beep-build.yml @@ -15,9 +15,14 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: create local.mk + - name: apt-get run: | - echo "prefix = ${PWD}/_root" > local.mk + sudo apt-get update + sudo apt-get install -y automake autoconf + - name: autoreconf + run: autoreconf -vif && nl -ba configure | grep -A100 -B100 'fcntl\.h' + - name: configure + run: ./configure --prefix="${PWD}/_root" - name: make run: make - name: 'beep --help' @@ -26,7 +31,9 @@ jobs: diff -u beep-usage.txt beep-usage.from--help - name: 'make check' run: make check - - name: 'make install-nobuild' - run: make install-nobuild + - name: 'make install' + run: make install - name: 'list installed files' run: (cd "$PWD/_root" && ls -l $(find . -type f | env LC_ALL=C sort) | nl) + - name: 'make distcheck' + run: make distcheck diff --git a/.gitignore b/.gitignore index ace2672..679bc67 100644 --- a/.gitignore +++ b/.gitignore @@ -24,15 +24,28 @@ *.lst *.gcc-lst /beep.1 +/compile-check # The compressed man page /beep.1.gz +# autoconf related stuff +/aclocal.m4 +/auto-aux/ +/auto-config.h.in +/autom4te.cache/ +/config.log +/config.status +/configure +/Makefile.in +/GNUmakefile + # Built stuff /dox/ /html/ /*.html /__tmp/ +/stamp-h /tarball-dist/ /tarball-git-dist/ /beep-*.tar.gz diff --git a/Doxyfile.in b/Doxyfile.in index 7218778..734707b 100644 --- a/Doxyfile.in +++ b/Doxyfile.in @@ -1,4 +1,5 @@ # Doxyfile 1.9.1 +# @configure_input@ # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. diff --git a/GNUmakefile b/GNUmakefile deleted file mode 100644 index c27b21b..0000000 --- a/GNUmakefile +++ /dev/null @@ -1,744 +0,0 @@ -######################################################################## -# GNUmakefile for beep -# -# This GNUmakefile has been written to mostly follow the GNU Makefile -# conventions[1], even if there is no "configure" script to accompany -# the GNUmakefile. If you want to keep some definitions across "make" -# invocations instead of providing them on each "make" command line, -# write the definitions into a file "local.mk" make include file, e.g. -# -# CC = clang -# prefix = $(HOME)/foo-prefix -# -# The GNUmakefile also internally follows some conventions known from -# Automake (e.g. bin_PROGRAMS variables), but uses features specific -# to GNU make to implement those Automake like features. -# -# This GNUmakefile makes extensive use of GNU make features and some -# tricks for using GNU make, such as -# * Advanced Auto Dependency Generation[2] -# * Deferred Simple Variable Expansion[3] -# -# [1]: https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html -# [2]: http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ -# [3]: http://make.mad-scientist.net/deferred-simple-variable-expansion/ -# -######################################################################## - - -######################################################################## -# Package metadata -######################################################################## - -PACKAGE_TARNAME = beep -PACKAGE_VERSION = 1.4.13 - - -######################################################################## -# Installation directories -######################################################################## - -# We use GNU makefile conventions for directory names. - -prefix = /usr/local -exec_prefix = $(prefix) -bindir = $(exec_prefix)/bin -sbindir = $(exec_prefix)/sbin -datarootdir = $(prefix)/share -mandir = $(datarootdir)/man -man1dir = $(mandir)/man1 -docdir = $(datarootdir)/doc/$(PACKAGE_TARNAME) -contribdir = $(docdir)/contrib -htmldir = $(docdir) - - -# TODO: We might want to autodetect which kind of $(docdir) is used on -# this system. Until then, people will just need to set -# docdir='$(datarootdir)/doc/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)' -# if they want to use that. Note that what the GNU makefile -# conventions call $(docdir) is called other names by other -# software components, e.g. %{_pkgdocdir} in RPM spec files. - - -######################################################################## -# Tools -######################################################################## - -# This makes it easy to replace any of those tools with specific -# versions, or to disable specific parts of the build. For example, to -# test the portability of the SED commands, you can run with -# SED="busybox sed", or to disable building HTML files from the -# markdown files you can run with PANDOC="false". - -CMP = cmp -DIFF = diff -DOT = dot -DOXYGEN = doxygen -EGREP = $(GREP) -E -FIND = find -GIT = git -GREP = grep -INSTALL = install -MKDIR_P = mkdir -p -PANDOC = pandoc -PYTHON3 = python3 -SED = sed -TAR = tar -TPUT = tput -WC = wc - -DIFF_U = $(DIFF) -u - -# The _DATA and _PROGRAM variants are GNU makefile convention. -# The _DIR variant is our idea. -INSTALL_DIR = $(INSTALL) -m 0755 -d -INSTALL_DATA = $(INSTALL) -m 0644 -p -INSTALL_PROGRAM = $(INSTALL) -m 0755 -p - - -######################################################################## -# This needs to be the first rule -######################################################################## - -.PHONY: all -all: all-local - - -######################################################################## -# Initialize some things for the build system -######################################################################## - - -# Prevent make from using its built-in rules -.SUFFIXES: -COMPILE.c = false COMPILE.c -LINK.c = false LINK.c - - -######################################################################## -# Variables to add to later -######################################################################## - -dist-files = -dist-files += GNUmakefile - -# targets to build for the "all" target -all_TARGETS = - -# targets to build for the "check" target -check_TARGETS = - -bin_PROGRAMS = -check_PROGRAMS = -contrib_DATA = -contrib_SCRIPTS = -sbin_PROGRAMS = -CLEANFILES = -html_DATA = -noinst_html_DATA = -man1_DATA = -doc_DATA = - - -######################################################################## -# Define compiler and linker flags -######################################################################## - -comma := , - -# If supported by $(CC), add given flags to CFLAGS type variable. -# Example usage: -# $(eval $(call check-cflags,common-CFLAGS,-fasynchronous-unwind-tables)) -define check-cflags -$(1) += $$(if $$(shell if $$(CC) $$(patsubst -Wno-%,-W%,$(2)) -x c -o compile-check.o -c - < /dev/null > /dev/null 2>&1; then echo yes; else :; fi; rm -f compile-check.o > /dev/null 2>&1),$(2)) -endef - -# This might be useful or not. -CFLAGS = -CPPFLAGS = -LDFLAGS = -LDADD = - -# Flags common to all executable targets -common_CFLAGS = -common_CPPFLAGS = -common_LDFLAGS = -common_LDADD = - -common_CPPFLAGS += -DPACKAGE_TARNAME='"$(PACKAGE_TARNAME)"' -common_CPPFLAGS += -DPACKAGE_VERSION='"$(PACKAGE_VERSION)"' -common_CFLAGS += -std=gnu99 -common_CFLAGS += $(if $(filter %.o,$@),-Wa$(comma)-adhlns=$(@:.o=.lst)) -common_CFLAGS += -pedantic -$(eval $(call check-cflags,common_CFLAGS,-Werror=unknown-warning-option)) -$(eval $(call check-cflags,common_CFLAGS,-Wall)) -$(eval $(call check-cflags,common_CFLAGS,-Wextra)) -$(eval $(call check-cflags,common_CFLAGS,-Weverything)) -$(eval $(call check-cflags,common_CFLAGS,-Werror)) -$(eval $(call check-cflags,common_CFLAGS,-Wno-padded)) -$(eval $(call check-cflags,common_CFLAGS,-Werror=format-security)) -$(eval $(call check-cflags,common_CFLAGS,-Wno-disabled-macro-expansion)) -$(eval $(call check-cflags,common_CFLAGS,-Wno-format-nonliteral)) -$(eval $(call check-cflags,CPPFLAGS,-D_FORTIFY_SOURCE=2)) -$(eval $(call check-cflags,CPPFLAGS,-D_GLIBCXX_ASSERTIONS)) -# $(eval $(call check-cflags,CFLAGS,-Wp$$(comma)-D_FORTIFY_SOURCE=2)) -# $(eval $(call check-cflags,CFLAGS,-Wp$$(comma)-D_GLIBCXX_ASSERTIONS)) -$(eval $(call check-cflags,CFLAGS,-fasynchronous-unwind-tables)) -$(eval $(call check-cflags,CFLAGS,-fanalyzer)) -$(eval $(call check-cflags,CFLAGS,-fstack-protector-strong)) -$(eval $(call check-cflags,CFLAGS,-fstack-clash-protection)) -$(eval $(call check-cflags,CFLAGS,-fcf-protection)) -$(eval $(call check-cflags,CFLAGS,-fsanitize=undefined)) - - -CFLAGS += -O2 -g -CFLAGS += -save-temps=obj - - -# Create this file to override any of the make variables defined -# above. --include local.mk - - -ifneq (,$(V)) -$(info #=======================================================================) -else -$(info In case of build problems, try running `make' with V=1 to help find the cause.) -endif - - -ifneq (,$(V)) -$(info # common_CFLAGS=$(common_CFLAGS)) -$(info # common_CPPFLAGS=$(common_CPPFLAGS)) -$(info # common_LDADD=$(common_LDADD)) -$(info # common_LDFLAGS=$(common_LDFLAGS)) -$(info # CFLAGS=$(CFLAGS)) -$(info # CPPFLAGS=$(CPPFLAGS)) -$(info # LDADD=$(LDADD)) -$(info # LDFLAGS=$(LDFLAGS)) -endif - - -######################################################################## -# Detect libraries -######################################################################## - - -######################################################################## -# Define executables and their flags -######################################################################## - -check_PROGRAMS += issue-6-benchmark -issue_6_benchmark_SOURCES = issue-6-benchmark.c -issue_6_benchmark_LDADD = -lm - -bin_PROGRAMS += beep -beep_SOURCES = -beep_SOURCES += beep-compiler.h -beep_SOURCES += beep-types.h -beep_SOURCES += beep-log.c -beep_SOURCES += beep-log.h -beep_SOURCES += beep-main.c -beep_SOURCES += beep-library.c -beep_SOURCES += beep-library.h -beep_SOURCES += beep-usage.c -beep_SOURCES += beep-usage.h -beep_SOURCES += beep-drivers.c -beep_SOURCES += beep-drivers.h - -# The drivers here use `__attribute__((constructor))` functions to -# register themselves with `beep_drivers_register()`, so the last one -# listed here will be linked last and have its constructor called at -# the latest time, and thus will have its `driver_detect()` function -# called first. - -beep_SOURCES += beep-driver.h -beep_SOURCES += beep-driver-console.c -beep_SOURCES += beep-driver-evdev.c - -EXTRA_DIST += beep-driver-noop.c -ifneq ($(BEEP_DEBUG_BUILD),) -beep_SOURCES += beep-driver-noop.c -endif - -beep_LDADD = - -beep-log.o : override common_CPPFLAGS += -D_GNU_SOURCE -# beep-log.clang-o : override CFLAGS_clang += -Wno-format-nonliteral - -# sbin_PROGRAMS += beep-foo -# beep_foo_SOURCES = -# beep_foo_SOURCES += beep-log.c -# beep_foo_SOURCES += beep.c -# beep_foo_LDADD = -# beep_foo_LDADD += -lm - - -######################################################################## -# Built sources -######################################################################## - -EXTRA_DIST += beep-usage.txt.in -CLEANFILES += beep-usage.txt - -BUILT_SOURCES += beep-usage.c -CLEANFILES += beep-usage.c -beep-usage.c: beep-usage.txt - $(inhibit-build-command) - @$(call print-rule-description,CONVERT,$@,$<) - printf '%s\n' '/* Auto-generated from `$<`. Modify that file instead. */' > $@ - printf '%s\n' '#include "beep-usage.h"' >> $@ - printf '%s\n' 'char beep_usage[] =' >> $@ - set -e; IFS=""; while read line; do \ - printf ' "%s\\n"\n' "$${line}" >> $@; \ - done < $< - printf '%s\n' ' ;' >> $@ - - -######################################################################## -# Compile and Link rules including automatic dependency generation -# -# For details on the automatic dependency generation, see -# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ -######################################################################## - - -# CALL: define-link-rule -# Defines the per-executable rules. -define define-link-rule -CLEANFILES += $(1).map -dist-files += $$($(2)_SOURCES) -$(2)_OBJS := $$(foreach src,$$($(2)_SOURCES),$$(if $$(filter %.c,$$(src)),$$(src:%.c=%.o),$$(if $$(filter %.h,$$(src)),,$$(error Unhandled source type in $(2)_SOURCES: $$(src))))) - -$(1): $$($(2)_OBJS) - $$(inhibit-build-command) - @$$(call print-rule-description,LINK,$$@) - $$(CC) -Wl,-Map=$(1).map,--cref $$(common_CFLAGS) $$(CFLAGS) $$(common_LDFLAGS) $$($(2)_LDFLAGS) $$(LDFLAGS) -o $$@ $$^ $$(common_LDADD) $$($(2)_LDADD) $$(LDADD) - -$$(patsubst %.o,.deps/%.o.dep,$$($(2)_OBJS))): - --include $$(wildcard $$(patsubst %.o,.deps/%.o.dep,$$($(2)_OBJS))) -endef - - -$(foreach exec,$(bin_PROGRAMS), $(eval $(call define-link-rule,$(exec),$(subst -,_,$(exec)),bin))) -$(foreach exec,$(check_PROGRAMS),$(eval $(call define-link-rule,$(exec),$(subst -,_,$(exec)),check))) -$(foreach exec,$(sbin_PROGRAMS), $(eval $(call define-link-rule,$(exec),$(subst -,_,$(exec)),sbin))) - -%.o: %.c | .deps - $(inhibit-build-command) - @$(call print-rule-description,COMPILE,$@,$<) - $(CC) -MT $@ -MMD -MP -MF .deps/$*.o.dep $(common_CPPFLAGS) $(CPPFLAGS) $(common_CFLAGS) $(CFLAGS) -o $@ -c $< - -.deps: - $(inhibit-build-command) - @$(MKDIR_P) $@ - - -######################################################################## -# Generate doc and similar files -######################################################################## - -EXTRA_DIST += gen-freq-table - -EXTRA_DIST += beep.1.in -man1_DATA += beep.1 -CLEANFILES += beep.1 - -CLEANFILES += CREDITS.html -CLEANFILES += NEWS.html -CLEANFILES += PERMISSIONS.html -CLEANFILES += README.html - -CLEANFILES += DEVELOPMENT.html -CLEANFILES += INSTALL.html -CLEANFILES += PACKAGING.html - -EXTRA_DIST += pandoc.css - -ifeq (yes,$(shell if $(PANDOC) --version > /dev/null 2>&1; then echo yes; else echo no; fi)) - -html_DATA += pandoc.css - -html_DATA += CREDITS.html -html_DATA += NEWS.html -html_DATA += PERMISSIONS.html -html_DATA += README.html - -noinst_html_DATA += DEVELOPMENT.html -noinst_html_DATA += INSTALL.html -noinst_html_DATA += PACKAGING.html - -%.html: %.md - $(inhibit-build-command) - @$(call print-rule-description,PANDOC,$@,$<) - $(PANDOC) --from gfm --to html --standalone -M pagetitle="$$($(SED) -n 1p $<)" -M title="" -c pandoc.css $< -o $@ -endif - -.PHONY: html -html: $(html_DATA) $(noinst_html_DATA) -all-local: $(html_DATA) $(noinst_html_DATA) - -DEFAULT_FREQ = 440 -DEFAULT_LENGTH = 200 -DEFAULT_DELAY = 100 - -REPLACEMENTS = -REPLACEMENTS += -e 's|@PACKAGE_TARNAME@|$(PACKAGE_TARNAME)|g' -REPLACEMENTS += -e 's|@PACKAGE_VERSION@|$(PACKAGE_VERSION)|g' - -REPLACEMENTS += -e 's|@DEFAULT_FREQ@|$(DEFAULT_FREQ)|g' -REPLACEMENTS += -e 's|@DEFAULT_LENGTH@|$(DEFAULT_LENGTH)|g' -REPLACEMENTS += -e 's|@DEFAULT_DELAY@|$(DEFAULT_DELAY)|g' - -REPLACEMENTS += -e 's|[@]docdir@|$(docdir)|g' - -EXTRA_DIST += beep-config.h.in -CLEANFILES += beep-config.h -BUILT_SOURCES += beep-config.h -beep-main.o : beep-config.h - -EXTRA_DIST += Doxyfile.in -CLEANFILES += Doxyfile -CLEANFILES += Doxyfile.new - -%: %.in GNUmakefile - $(inhibit-build-command) - @$(call print-rule-description,SUBSTITUTE,$@,$<) - $(SED) $(REPLACEMENTS) < $< > $@.new - @if $(EGREP) '@([A-Za-z][A-Za-z0-9_]*)@' $@.new; then \ - echo "Error: GNUmakefile fails to substitute some of the variables in \`$<'."; \ - exit 1; \ - fi - mv -f $@.new $@ - -CLEANFILES += doxygen.stamp -.PHONY: doxygen.stamp -doxygen.stamp: Doxyfile $(wildcard *.c) $(wildcard *.h) - $(inhibit-build-command) - @$(call print-rule-description,DOXYGEN,html dox) - cat $< $(if $(V),,| $(SED) -e 's!^QUIET *=.*!QUIET = YES!') | $(DOXYGEN) - - echo > $@ - -dox: doxygen.stamp - -.PHONY: serve-dox -serve-dox: dox - @$(call print-rule-description,SERVING,doxygen html files,dox/html) - $(PYTHON3) -m http.server --directory dox/html - -EXTRA_DIST += COPYING -doc_DATA += COPYING - -EXTRA_DIST += CREDITS.md -doc_DATA += CREDITS.md - -EXTRA_DIST += NEWS.md -doc_DATA += NEWS.md - -EXTRA_DIST += README.md -doc_DATA += README.md - -EXTRA_DIST += PERMISSIONS.md -doc_DATA += PERMISSIONS.md - -EXTRA_DIST += DEVELOPMENT.md -EXTRA_DIST += INSTALL.md -EXTRA_DIST += PACKAGING.md - -EXTRA_DIST += contrib/failure-beeps -contrib_SCRIPTS += contrib/failure-beeps -EXTRA_DIST += contrib/success-beeps -contrib_SCRIPTS += contrib/success-beeps -EXTRA_DIST += contrib/morse/morse2beep.pl -contrib_SCRIPTS += contrib/morse/morse2beep.pl -EXTRA_DIST += contrib/morse/morse2beep.sed -contrib_SCRIPTS += contrib/morse/morse2beep.sed - - -######################################################################## -# Generic targets -######################################################################## - -all_TARGETS += $(bin_PROGRAMS) -all_TARGETS += $(sbin_PROGRAMS) -all_TARGETS += $(man1_DATA) - -.PHONY: all-local -all-local: $(all_TARGETS) - -check_TARGETS += $(all_TARGETS) -check_TARGETS += $(check_PROGRAMS) - -.PHONY: check-targets -check-targets: $(check_TARGETS) - -.PHONY: check -check: tests/run-tests beep $(check_TARGETS) - $(inhibit-build-command) - @$(call print-rule-description,CHECK,$(PWD)/beep) - env PACKAGE_VERSION="${PACKAGE_VERSION}" \ - /bin/bash $< $( __tmp/$(distdir)/local.mk - (cd __tmp/$(distdir) && $(FIND) . -type f) | env LC_ALL=C sort > __tmp/before-build.filelist - $(MAKE) -C __tmp/$(distdir) - $(MAKE) -C __tmp/$(distdir) check - $(MAKE) -C __tmp/$(distdir) install-nobuild - (cd __tmp/_prefix && $(FIND) . -type f) | env LC_ALL=C sort > __tmp/after-install.filelist - @n="$$($(WC) -l < __tmp/after-install.filelist)"; \ - if test "$$n" -eq 0; then \ - echo "Error: Found no installed files"; \ - exit 1; \ - elif test "$$n" -gt 10; then \ - echo "Found $${n} installed files: good."; \ - else \ - echo "Error: Found only $${n} installed files"; \ - exit 1; \ - fi - $(MAKE) -C __tmp/$(distdir) uninstall - (cd __tmp/_prefix && $(FIND) . -type f) | env LC_ALL=C sort > __tmp/after-uninstall.filelist - @n="$$($(WC) -l < __tmp/after-uninstall.filelist)"; \ - if test "$$n" -gt 0; then \ - echo "Error: Found $${n} left over installed files after uninstall"; \ - exit 1; \ - else \ - echo "Found no installed files after uninstall"; \ - fi - $(MAKE) -C __tmp/$(distdir) clean - (cd __tmp/$(distdir) && $(FIND) . -type f) | env LC_ALL=C sort > __tmp/after-clean.filelist - cd __tmp && $(DIFF_U) before-build.filelist after-clean.filelist - - -######################################################################## -# Development helpers -######################################################################## - -# Only have make deal with those variables and rules if this is a git -# repo, and if the git executable has been found. -GIT_INFO_EXCLUDE = $(firstword $(wildcard .git/info/exclude)) -ifneq ($(strip $(GIT_INFO_EXCLUDE)),) -ifdef GIT - -# List all references to documentation in the git repo -.PHONY: refs -refs: - $(GIT) grep -n -E '((http|https)://[a-zA-Z0-9\._/-]+|([A-Z]+\.md)|([a-zA-Z][a-zA-Z0-9_-]+\([0-9]+\)))' - -# List all TODOs and FIXMEs in the git repo -.PHONY: todo fixme -todo fixme: - $(GIT) grep -n -E '(TODO:|FIXME:|\\todo\s|@todo\s)' - -# Generate a kind of dist tarball to help with preparing for release -PACKAGE_TARBASE = $(eval PACKAGE_TARBASE := $$(PACKAGE_TARNAME)-$$(shell $$(GIT) describe --tags | $$(SED) 's/^v\([0-9]\)/\1/'))$(PACKAGE_TARBASE) -.PHONY: git-dist -git-dist: - @$(call print-rule-description,GIT ARCHIVE,$(PACKAGE_TARBASE).tar.gz) - $(GIT) archive --format=tar.gz --prefix=$(PACKAGE_TARBASE)/ --output=$(PACKAGE_TARBASE).tar.gz HEAD - -# Check that the lists of files inside the "git archive" and the "tar" -# dist tarballs are the same. -.PHONY: compare-tarballs -distcheck: compare-tarballs -compare-tarballs: dist git-dist - @$(call print-rule-description,COMPARE,contents of git archive and dist tarball) - rm -rf tarball-dist tarball-git-dist - mkdir tarball-dist && cd tarball-dist && $(TAR) xf ../$(distdir).tar.gz - mkdir tarball-git-dist && cd tarball-git-dist && $(TAR) xf ../$(PACKAGE_TARBASE).tar.gz - diff -ruN tarball-git-dist/$(PACKAGE_TARBASE) tarball-dist/$(distdir) - rm -rf tarball-dist tarball-git-dist - -endif -endif - - -######################################################################## -# Print rule descriptions and silent rules -# -# This is a bit more complex than mad scientist's simple silent -# rules[1]: -# -# * In silent mode, we print aligned descriptions for each target -# being built. -# -# * In non-silent mode, we print a description of the recipe before -# each recipe is actually run, but highlighted a bit to stand out -# from the endless sequence of recipe command text: The description -# line always starts with a "#", and on a TTY, it will be printed -# in bold. -# -# [1]: http://make.mad-scientist.net/managing-recipe-echoing/ -######################################################################## - -# Set V to empty to disable silent rules, non-empty to enable them. -V=1 -V= - -# Note that we cannot use "test -t 1" inside a $(shell ) command, as -# the $(shell) will capture stdout into a variable, so the "test -t 1" -# will always test negative. - -ifeq (,$(V)) -.SILENT: -print-rule-description = $(or\ -$(if $(3),printf "%12s %-22s FROM %s\n" "$(1)" "$(2)" "$(3)"),\ -$(if $(2),printf "%12s %s\n" "$(1)" "$(2)"),\ -$(error $(0) requires at least two parameters)) -else -set-color-vars = if test -t 1; then cb="$$($(TPUT) bold)"; cn="$$($(TPUT) sgr0)"; fi -print-rule-description = $(set-color-vars); $(or\ -$(if $(3),printf "%s# %s %s FROM %s%s\n" "$$cb" "$(1)" "$(2)" "$(3)" "$$cn"),\ -$(if $(2),printf "%s# %s %s%s\n" "$$cb" "$(1)" "$(2)" "$$cn"),\ -$(error $(0) requires at least two parameters)) -endif - - -######################################################################## -# End of GNUmakefile -######################################################################## - -ifneq (,$(V)) -$(info #=======================================================================) -endif diff --git a/GNUmakefile.in b/GNUmakefile.in new file mode 100644 index 0000000..b303313 --- /dev/null +++ b/GNUmakefile.in @@ -0,0 +1,682 @@ +######################################################################## +# @configure_input@ +######################################################################## + +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ + +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ +ACLOCAL = @ACLOCAL@ + +AWK = @AWK@ +GREP = @GREP@ +EGREP = @EGREP@ +SED = @SED@ + +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_DIR = @INSTALL_DIR@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ + +DIFF = @DIFF@ +DIFFSTAT = @DIFFSTAT@ +DOXYGEN = @DOXYGEN@ +GIT = @GIT@ +INSTALL = @INSTALL@ +MKDIR_P = @MKDIR_P@ +PANDOC = @PANDOC@ +PYTHON3 = @PYTHON3@ +TAR = @TAR@ +TPUT = @TPUT@ + +@SET_MAKE@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datarootdir = @datarootdir@ +datadir = @datadir@ +bindir = @bindir@ +docdir = @docdir@ +mandir = @mandir@ +htmldir = @htmldir@ + +man0dir = ${mandir}/man0 +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 + +srcdir = @srcdir@ +VPATH = @srcdir@ + + +######################################################################## +# The default target is "all" +######################################################################## + +.PHONY: all +all: all-targets + + +######################################################################## +# Disable things built into make +######################################################################## + +.SUFFIXES: + +COMPILE.c = false COMPILE.c +COMPILE.cc = false COMPILE.cc +COMPILE.cxx = false COMPILE.cxx +LINK.c = false LINK.c +LINK.cc = false LINK.cc +LINK.cxx = false LINK.cxx + + +######################################################################## +# Some vars +######################################################################## + +all-dist-files ?= +dist-files ?= + + +######################################################################## +# Compiler and linker flags +######################################################################## + +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LDADD = + +common_CFLAGS = +common_CPPFLAGS = +common_LDFLAGS = +common_LDADD = + +comma = , + + +ifneq (,$(srcdir)) +common_CPPFLAGS += -I. +common_CPPFLAGS += -I$(srcdir) +endif + +common_CPPFLAGS += -DPACKAGE_TARNAME='"$(PACKAGE_TARNAME)"' +common_CPPFLAGS += -DPACKAGE_VERSION='"$(PACKAGE_VERSION)"' + + +######################################################################## +# Local settings, verbosity infrastructure, and include package makefile +######################################################################## + +# Usage: $(eval $(call define-sed-substitution,docdir)) +# Must be defined for use in package.mk and local.mk. +define define-sed-substitution +SUBSTITUTIONS += -e 's|[@]$(1)@|$$($(1))|g' +endef + +-include local.mk + +V ?= + +ifeq (0,$(V)) +V = +endif + +ifneq (,$(srcdir)) +include $(srcdir)/package.mk +all-dist-files += $(srcdir)/package.mk +else +include package.mk +all-dist-files += package.mk +endif + + +######################################################################## +# Rebuilding autoconf related files +######################################################################## + +configure_deps += configure.ac +configure_deps += aclocal.m4 + +$(srcdir)/configure: $(configure_deps) + cd '$(srcdir)' && $(AUTOCONF) + +$(srcdir)/aclocal.m4: $(aclocal_m4_deps) + cd '$(srcdir)' && $(ACLOCAL) $$(if test -d auto-m4; then printf "%s\n" "-I auto-m4"; fi) $$(if test -d m4; then printf "%s\n" "-I m4"; fi) +$(aclocal_m4_deps): + +# autoheader might not change auto-config.h.in, so touch a stamp file. +$(srcdir)/auto-config.h.in: stamp-h.in ; +$(srcdir)/stamp-h.in: configure.ac aclocal.m4 + cd '$(srcdir)' && $(AUTOHEADER) + echo timestamp > '$(srcdir)/stamp-h.in' + +auto-config.h: stamp-h ; +stamp-h: auto-config.h.in config.status + ./config.status + +GNUmakefile: GNUmakefile.in config.status + ./config.status + +config.status: configure + ./config.status --recheck + + +######################################################################## +# Developer documentation generated by doxygen +######################################################################## + +EXTRA_DIST += Doxyfile.in +CLEANFILES += Doxyfile + +CLEANFILES += doxygen.stamp +.PHONY: doxygen.stamp +doxygen.stamp: Doxyfile $(wildcard *.c) $(wildcard *.h) + $(inhibit-build-command) + @$(call print-rule-description,DOXYGEN,html dox) + cat $< $(if $(V),,| $(SED) -e 's!^QUIET *=.*!QUIET = YES!') | $(DOXYGEN) - + echo > $@ + +dox: doxygen.stamp + +.PHONY: serve-dox +serve-dox: dox + @$(call print-rule-description,SERVING,doxygen html files,dox/html) + $(PYTHON3) -m http.server --directory dox/html + + +######################################################################## +# All the magical variables and functions +######################################################################## + +ifeq (,$(V)) +$(info In case of build problems, try running `make' with V=1 to help find the cause.) +else +$(info /-----------------------------------------------------------------------) +$(info | common_CFLAGS=$(common_CFLAGS)) +$(info | common_CPPFLAGS=$(common_CPPFLAGS)) +$(info | common_LDADD=$(common_LDADD)) +$(info | common_LDFLAGS=$(common_LDFLAGS)) +$(info | CFLAGS=$(CFLAGS)) +$(info | CPPFLAGS=$(CPPFLAGS)) +$(info | LDADD=$(LDADD)) +$(info | LDFLAGS=$(LDFLAGS)) +$(info \-----------------------------------------------------------------------) +endif + +DESTDIR ?= + +install-dirs = +all-targets = +install-targets = + +dir-vars = $(sort $(filter %dir,$(.VARIABLES))) +# $(info dir-vars = $(dir-vars)) + +am-dir-prefixes += $(patsubst %dir,%,$(dir-vars)) +am-var-suffixes += DATA +am-var-suffixes += MANS +am-var-suffixes += PROGRAMS +am-var-suffixes += SCRIPTS + + +# Usage: $(eval $(call define-program-build-rule,src/beep-foo,src_beep_foo)) +define define-program-build-rule +ifeq (2,$(V)) +$$(info $(0): $(1) $(2)) +endif + +$(2)_CFLAGS ?= +$(2)_CPPFLAGS ?= +$(2)_LDFLAGS ?= +$(2)_LDADD ?= + +all-dist-files += $$($(2)_SOURCES) + +$(2)_OBJS = $$(strip $$(foreach src,$$($(2)_SOURCES),\ +$$(if $$(filter %.c,$$(src)),$$(patsubst %.c,.objs/$(2)/%.o,$$(src)),\ +$$(if $$(filter %.h,$$(src)),,\ +$$(error Unhandled source type in $(2)_SOURCES: $$(src)))))) +# $$(info $(2)_OBJS = $$($(2)_OBJS)) + +CLEANFILES += $(1) +CLEANFILES += $(1).map +CLEANFILES += $$($(2)_OBJS) + +$(1): $$($(2)_OBJS) + $$(inhibit-build-command) + @$$(call print-rule-description,LINK,$$@) + $$(CC) -Wl,-Map=$(1).map,--cref $$(common_CFLAGS) $$(CFLAGS) $$(common_LDFLAGS) $$($(2)_LDFLAGS) $$(LDFLAGS) -o $$@ $$^ $$(common_LDADD) $$(LDADD) $$($(2)_LDADD) + +$$(patsubst .objs/$(2)/%.o,.deps/$(2)/%.o.dep,$$($(2)_OBJS)): + +-include $$(patsubst .objs/$(2)/%.o,.deps/$(2)/%.o.dep,$$($(2)_OBJS)) + +.objs/$(2)/%.o: %.c | .deps/$(2) .objs/$(2) + $$(inhibit-build-command) + @$$(call print-rule-description,COMPILE,$$( %s\n" "$(SED)" "$(SUBSTITUTIONS)" "$<" "$@",:); \ + $(SED) $(SUBSTITUTIONS) < $< > $@.$$$$.new; \ + if $(EGREP) '[@]([A-Za-z][A-Za-z0-9_]*)@' $@.$$$$.new; then \ + echo "Error: GNUmakefile fails to substitute some of the variables in \`$<'."; \ + rm -f $@.$$$$.new; \ + exit 1; \ + fi; \ + mv -f $@.$$$$.new $@ + + +######################################################################## +# git related development helpers +######################################################################## + +# Only have make deal with those variables and rules if this is a git +# repo, and if the git executable has been found. +ifneq (,$(srcdir)) +GIT_INFO_EXCLUDE = $(firstword $(wildcard $(srcdir)/.git/info/exclude)) +else +GIT_INFO_EXCLUDE = $(firstword $(wildcard .git/info/exclude)) +endif +# $(info GIT_INFO_EXCLUDE = $(GIT_INFO_EXCLUDE)) +ifneq ($(strip $(GIT_INFO_EXCLUDE)),) +# $(info origin GIT = $(origin GIT)) +# $(info GIT = $(GIT)) + +ifdef GIT + +# List all references to documentation in the git repo +.PHONY: refs +refs: + $(GIT) grep -n -E '((http|https)://[a-zA-Z0-9\._/-]+|([A-Z]+\.md)|([a-zA-Z][a-zA-Z0-9_-]+\([0-9]+\)))' + +# List all TODOs and FIXMEs in the git repo +.PHONY: todo fixme +todo fixme: + $(GIT) grep -n -E '(TODO:|FIXME:|\\todo\s|@todo\s)' + +# Generate a kind of dist tarball to help with preparing for release +PACKAGE_TARBASE = $(eval PACKAGE_TARBASE := $$(PACKAGE_TARNAME)-$$(shell $$(GIT) describe --tags | $$(SED) 's/^v\([0-9]\)/\1/'))$(PACKAGE_TARBASE) +.PHONY: git-dist +git-dist: + @$(call print-rule-description,GIT ARCHIVE,$(PACKAGE_TARBASE).tar.gz) + set -e; outdir="$$PWD"; if test "x$(srcdir)" != "x"; then cd "$(srcdir)"; fi; \ + $(GIT) archive --format=tar.gz --prefix=$(PACKAGE_TARBASE)/ --output="$${outdir}/$(PACKAGE_TARBASE).tar.gz" HEAD + +# Check that the lists of files inside the "git archive" and the "tar" +# dist tarballs are the same. +.PHONY: compare-tarballs +distcheck: compare-tarballs +compare-tarballs: dist git-dist + @$(call print-rule-description,COMPARE,contents of git archive and dist tarball) + rm -rf tarball-dist tarball-git-dist + mkdir tarball-dist && cd tarball-dist && $(TAR) xf ../$(distdir).tar.gz + mkdir tarball-git-dist && cd tarball-git-dist && $(TAR) xf ../$(PACKAGE_TARBASE).tar.gz + if diff -ruN $(foreach fn,$(dist-files),-x $(fn)) tarball-git-dist/$(PACKAGE_TARBASE) tarball-dist/$(distdir) > compare-tarballs.patch; then \ + rm -f compare-tarballs.patch; \ + else \ + cat compare-tarballs.patch; \ + $(DIFFSTAT) $$(if test -t 1; then printf "-C\n"; fi) < compare-tarballs.patch; \ + exit 1; \ + fi + rm -rf tarball-dist tarball-git-dist + +endif +endif + + +######################################################################## +# Print rule descriptions and silent rules +# +# This is a bit more complex than mad scientist's simple silent +# rules[1]: +# +# * In silent mode, we print aligned descriptions for each target +# being built. +# +# * In non-silent mode, we print a description of the recipe before +# each recipe is actually run, but highlighted a bit to stand out +# from the endless sequence of recipe command text: The description +# line always starts with a "#", and on a TTY, it will be printed +# in bold. +# +# [1]: http://make.mad-scientist.net/managing-recipe-echoing/ +######################################################################## + +# Set V to empty to disable silent rules, non-empty to enable them. +V=1 +V= + +# Note that we cannot use "test -t 1" inside a $(shell ) command, as +# the $(shell) will capture stdout into a variable, so the "test -t 1" +# will always test negative. + +ifeq (,$(V)) +.SILENT: +print-rule-description = $(or\ +$(if $(4),printf "%13s %-22s %-5s %s\n" "$(1)" "$(2)" "$(3)" "$(4)"),\ +$(if $(3),printf "%13s %-22s %s\n" "$(1)" "$(2)" "$(3)"),\ +$(if $(2),printf "%13s %s\n" "$(1)" "$(2)"),\ +$(error $(0) requires at least two parameters)) +else +set-color-vars = if test -t 1; then cb="$$($(TPUT) bold)"; cn="$$($(TPUT) sgr0)"; fi +print-rule-description = $(set-color-vars); $(or\ +$(if $(4),printf "%s# %s %s %s %s%s\n" "$$cb" "$(1)" "$(2)" "$(3)" "$(4)" "$$cn"),\ +$(if $(3),printf "%s# %s %s %s%s\n" "$$cb" "$(1)" "$(2)" "$(3)" "$$cn"),\ +$(if $(2),printf "%s# %s %s%s\n" "$$cb" "$(1)" "$(2)" "$$cn"),\ +$(error $(0) requires at least two parameters)) +endif + + +######################################################################## +# End of GNUmakefile. +######################################################################## diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..620a88c --- /dev/null +++ b/Makefile.am @@ -0,0 +1,7 @@ +# Dummy Makefile.am to trick autoreconf into installing +# config.{guess,sub} and install.sh. +# +# Our actual build definitions are in GNUmakefile.in and do +# use Autoconf, but not Automake. +# +ACLOCAL_AMFLAGS = -I auto-m4 -I m4 diff --git a/auto-m4/.gitignore b/auto-m4/.gitignore new file mode 100644 index 0000000..fe9c2dc --- /dev/null +++ b/auto-m4/.gitignore @@ -0,0 +1 @@ +# dummy file diff --git a/beep-config.h.in b/beep-config.h.in index 760d036..71765df 100644 --- a/beep-config.h.in +++ b/beep-config.h.in @@ -5,6 +5,8 @@ * \author Copyright (C) 2010-2013 Gerfried Fuchs * \author Copyright (C) 2013-2018 Hans Ulrich Niedermann * + * @configure_input@ + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or diff --git a/beep.1.in b/beep.1.in index 49577c5..e754703 100644 --- a/beep.1.in +++ b/beep.1.in @@ -1,3 +1,5 @@ +.\" @configure_input@ +.\" .\" The beep(1) man page .\" .\" This man page has been rewritten adhering to the following diff --git a/compile-check.c b/compile-check.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/compile-check.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..b6a96cd --- /dev/null +++ b/configure.ac @@ -0,0 +1,107 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.69]) +AC_INIT([beep], + [1.4.13], + [https://github.com/spkr-beep/beep/issues], + [beep], + [https://github.com/spkr-beep/beep]) +AC_CONFIG_AUX_DIR([auto-aux]) +AC_CONFIG_MACRO_DIR([auto-m4]) + +dnl We are not actually using Automake for the build system. This is +dnl only to have "autoreconf" make sure that aclocal.m4 is updated and +dnl config.{guess,sub} install-sh are added to auto-aux/. +AM_INIT_AUTOMAKE([ + 1.16 + -Wall + -Werror + foreign +]) + +AC_CONFIG_SRCDIR([beep-main.c]) +AC_CONFIG_HEADERS([auto-config.h]) + +# Checks for programs. +AC_PROG_AWK +AC_PROG_CC +AC_PROG_GREP +AC_PROG_EGREP +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_PROG_MKDIR_P +AC_PROG_SED + +dnl Catch our custom macros +m4_pattern_forbid([^SB_])dnl + +SB_PROG([DIFF], [diff]) +SB_PROG([DIFFSTAT], [diffstat]) +SB_PROG([DOXYGEN], [doxygen]) +SB_PROG([GIT], [git]) +SB_PROG([INSTALL], [install]) +SB_PROG([PANDOC], [pandoc]) +SB_PROG([PYTHON3], [python3]) +SB_PROG([TAR], [tar]) +SB_PROG([TPUT], [tput]) + +AC_SUBST([MKDIR_P], ["mkdir -p"]) + +AC_SUBST([INSTALL_DATA], ["\${INSTALL} -m 0644 -p"]) +AC_SUBST([INSTALL_DIR], ["\${INSTALL} -m 0755 -d"]) +AC_SUBST([INSTALL_PROGRAM], ["\${INSTALL} -m 0755 -p"]) +AC_SUBST([INSTALL_SCRIPT], ["\${INSTALL} -m 0755 -p"]) + +# Checks for libraries. + +# Checks for header files. +AC_CHECK_HEADERS(m4_flatten([ + fcntl.h + limits.h + stddef.h + stdint.h + stdlib.h + string.h + sys/ioctl.h + sys/time.h + unistd.h +])) + +# Checks for typedefs, structures, and compiler characteristics. +AC_CHECK_HEADER_STDBOOL +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_UINT16_T + +# Checks for library functions. +AC_FUNC_FORK +AC_FUNC_MALLOC +AC_FUNC_STRERROR_R +AC_CHECK_FUNCS(m4_flatten([ + clock_gettime + memset + strdup + strerror + strrchr + strtol + strtoul +])) + +SB_SUMMARY_ITEM([abs top builddir], ["$(pwd)"]) +SB_SUMMARY_ITEM([abs top srcdir], ["$(cd "$(dirname "$0")" && pwd)"]) +SB_SUMMARY_VAR([PWD]) + +AC_CONFIG_FILES([ + GNUmakefile + Makefile +]) +AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) +AC_OUTPUT +dnl +SB_SUMMARY +dnl +dnl +dnl Local Variables: +dnl indent-tabs-mode: nil +dnl End: diff --git a/m4/sb-prog.m4 b/m4/sb-prog.m4 new file mode 100644 index 0000000..2cf9f63 --- /dev/null +++ b/m4/sb-prog.m4 @@ -0,0 +1,14 @@ +# sb-prog.m4 - check for program, but let user override it -*- Autoconf -*- +# serial 2 +dnl +dnl +dnl +AC_DEFUN([SB_PROG], [dnl +AC_ARG_VAR([$1], [$2 program]) +AS_IF([test x = "x$][$1]["], [dnl +AC_PATH_PROG([$1], [$2], [false]) +]) +])dnl +dnl +dnl +dnl diff --git a/m4/sb-summary.m4 b/m4/sb-summary.m4 new file mode 100644 index 0000000..62d2840 --- /dev/null +++ b/m4/sb-summary.m4 @@ -0,0 +1,36 @@ +# sb-summary.m4 - print summary at the end of configure -*- Autoconf -*- +# serial 3 +dnl +dnl +m4_pattern_forbid([SB_SUMMARY_ITEM_WIDTH])dnl +AC_DEFUN([SB_SUMMARY_ITEM_WIDTH], [17])dnl +dnl +dnl +m4_pattern_forbid([SB_SUMMARY_FILE])dnl +AC_DEFUN([SB_SUMMARY_FILE], [sb_summary.txt])dnl +dnl +dnl +AC_DEFUN_ONCE([SB_SUMMARY_INIT], [dnl +printf '%s for %s-%s:\n' 'Build Summary' "$PACKAGE_TARNAME" "$PACKAGE_VERSION" > SB_SUMMARY_FILE +])dnl +dnl +dnl +AC_DEFUN([SB_SUMMARY_ITEM], [dnl +AC_REQUIRE([SB_SUMMARY_INIT])dnl +printf ' %-]SB_SUMMARY_ITEM_WIDTH[s %s\n' m4_default(["AS_ESCAPE($1)"],[""]) m4_default($2,[""]) >> SB_SUMMARY_FILE +])dnl +dnl +dnl +AC_DEFUN([SB_SUMMARY_VAR], [dnl +AC_REQUIRE([SB_SUMMARY_INIT])dnl +SB_SUMMARY_ITEM([$1], ["$][$1]["])dnl +])dnl +dnl +dnl +AC_DEFUN([SB_SUMMARY], [dnl +AC_REQUIRE([SB_SUMMARY_INIT])dnl +cat "SB_SUMMARY_FILE" +rm -f "SB_SUMMARY_FILE" +])dnl +dnl +dnl diff --git a/package.mk b/package.mk new file mode 100644 index 0000000..2b6347b --- /dev/null +++ b/package.mk @@ -0,0 +1,146 @@ +contribdir = $(docdir)/contrib + +ACLOCAL_FLAGS += -I m4 + +EXTRA_DIST += m4/sb-prog.m4 +aclocal_m4_deps += m4/sb-prog.m4 +EXTRA_DIST += m4/sb-summary.m4 +aclocal_m4_deps += m4/sb-summary.m4 + +EXTRA_DIST += COPYING +doc_DATA += COPYING + +EXTRA_DIST += CREDITS.md +doc_DATA += CREDITS.md + +EXTRA_DIST += NEWS.md +doc_DATA += NEWS.md + +EXTRA_DIST += README.md +doc_DATA += README.md + +EXTRA_DIST += PERMISSIONS.md +doc_DATA += PERMISSIONS.md + +EXTRA_DIST += DEVELOPMENT.md +noinst_DATA += DEVELOPMENT.md + +EXTRA_DIST += INSTALL.md +noinst_DATA += INSTALL.md + +EXTRA_DIST += PACKAGING.md +noinst_DATA += PACKAGING.md + +EXTRA_DIST += pandoc.css + +ifeq (yes,$(shell if $(PANDOC) --version > /dev/null 2>&1; then echo yes; else echo no; fi)) + +html_DATA += pandoc.css + +CLEANFILES += CREDITS.html +html_DATA += CREDITS.html + +CLEANFILES += NEWS.html +html_DATA += NEWS.html + +CLEANFILES += PERMISSIONS.html +html_DATA += PERMISSIONS.html + +CLEANFILES += README.html +html_DATA += README.html + +CLEANFILES += DEVELOPMENT.html +noinst_DATA += DEVELOPMENT.html + +CLEANFILES += INSTALL.html +noinst_DATA += INSTALL.html + +CLEANFILES += PACKAGING.html +noinst_DATA += PACKAGING.html + +%.html: %.md + $(inhibit-build-command) + @$(call print-rule-description,PANDOC,$( $@ + +DEFAULT_FREQ = 440 +DEFAULT_LENGTH = 200 +DEFAULT_DELAY = 100 + +$(foreach var,FREQ LENGTH DELAY,$(eval $(call define-sed-substitution,DEFAULT_$(var)))) + +EXTRA_DIST += beep-config.h.in +CLEANFILES += beep-config.h +BUILT_SOURCES += beep-config.h +.objs/beep/beep-main.o : beep-config.h + +EXTRA_DIST += beep.1.in +CLEANFILES += beep.1 +man1_MANS += beep.1 + +EXTRA_DIST += gen-freq-table diff --git a/stamp-h.in b/stamp-h.in new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/stamp-h.in @@ -0,0 +1 @@ +timestamp diff --git a/testbuild-all b/testbuild-all index 70bc12b..7b86ed9 100755 --- a/testbuild-all +++ b/testbuild-all @@ -6,9 +6,10 @@ export LC_ALL=C set -ex -# We need to remove the built files from the $(srcdir) in order to -# make the VPATH search work properly for the test builds. -make clean +if test -f Makefile +then + make distclean +fi while read id cc cflags do @@ -19,24 +20,16 @@ do ( mkdir "$builddir" cd "$builddir" - srcdir="${abs_top_srcdir}" - cat>local.mk< after-installation.txt nl after-installation.txt if test -s after-installation.txt; then @@ -55,9 +48,6 @@ EOF fi ) done <