Makefile: First try at rewriting the ccan Makefile. This change contains a simpler Makefile replacement with only 62 lines of directives, 10 rules, and a 13 line support script for dependencies. The build dependencies have been minimised and in some cases, corrected. FEATURES: * All targets can be built from a clean tree in one invocation. * Parallel builds (tested with -j32 on 8 cores). * Auto discovery of modules via _info files. * Hopefully complete dependencies via a simplified generator. * CFLAGS are respected and appended to compile flags. * LINTFLAGS can be set to add check options (e.g. LINTFLAGS=-v). * 'make clean' doesn't build anything before cleaning now. * 'make quiet=1' builds quietly. 'make check quiet=1 -j N' produces summary output like the former summary target. * Non-phony test targets; tests are rebuilt only when dirty. Targets are: check, fastcheck and fullcheck, the latter runs in non-summary mode. * 'make <module>.[check|fastcheck|fullcheck]' runs tests for single modules. TODO: * Support Makefile-web and any other scattered targets NOTES: * The changes to dependency generation expose a circular dependency between asort and order which is not fixed here. * Tests always run their dependent tests. With -j support and minimised rebuilds via tighter dependencies, its not worth avoiding. * Some targets have been dropped as uneeded (e.g. distclean, tools). Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
Add a SHA512 implementation This largely follows the SHA256 style. I've named Rusty as the maintainer. Currently the functions to add data of various sizes/endianness have not been implemented: There are no public test vectors for these cases and I believe most use cases are working on byte buffers. They can be added later if desired. The openssl implementation has been tested on x86-64, while the inbuilt version has been tested on 32/64 bit, little/big endian boxes. Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
tlist2: a alternate to tlist that encodes the member offset into the container type Signed-off-by: Cody P Schafer <dev@codyps.com>
crypto/siphash: new module. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Automatically determine which modules have source Currently, build of ccan is controlled by two Make variables: MODS_WITH_SRC and MODS_NO_SRC which list modules containing .c files, and modules with only .h files respectively. When adding new modules this is fiddly to get right, and there are a number of modules already listed in the wrong variable. There's also some redundant logic in the DIRS variable to again filter out modules without source. This simplifies things by having a single manually updated MODS variable listing every module, and determining MODS_WITH_SOURCE programmatically. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
a_star: new module added to hacky Makefile-ccan list. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Correctly include dependencies for nested modules Currently we pull auto-generated dependencies into the Makefile with include ccan/*/*.d. That will omit any .d files from nested modules, meaning things might not be correctly rebuilt there. Correct this by using the list of modules instead of a 1-level wildcard. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Exclude system headers from .d files We currently generated .d dependency files with the -MD option to cc. That includes system header files in the dependencies, which isn't often useful and makes the .d more complicated than necessary. This changes to -MMD which excludes system headers. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Makefile-ccan: add cppmagic. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
generator: Generators for C Generators are a limited form of co-routine, which people may be familiar with from Python. This module adds an implementation of generators for C. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
altstack: New module altstack - run a function with a dedicated stack, and then release the memory Signed-off-by: Dan Good <dan@dancancode.com>
rszshm: New module rszshm - resizable pointer-safe shared memory Signed-off-by: Dan Good <dan@dancancode.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
deque: New module deque - type-preserving resizing circular deque Signed-off-by: Dan Good <dan@dancancode.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Add xstring module - bounded string builder with three valued comparator
Makefile-ccan: add pipecmd Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
lpq: New module Simple, slow priority queue implementation. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
lstack, lqueue: Move from MODS_WITH_SRC to MODS_NO_SRC The lstack and lqueue modules are entirely implemented in a single header. However, in Makefile-ccan they're listed in MODS_WITH_SRC, instead of MODS_NO_SRC. This appears to be harmless, but this patch moves them to the correct category anyway. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
permutation: Generate permutations of arrays New module. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
strgrp: new module
pr_log: a new module that provides a simple run-time controlled logging interface A simple printf logging infra where levels are determined by the value of the "DEBUG" environment variable. This is loosely based on the interfaces & functionality of Linux's printk() and pr_*() wrapper macros. Note that the current implementation uses "<N>" prefixes (where N is a syslog level in ascii), allowing other programs that parse log output (like systemd's journald) to know what the priority level is. Signed-off-by: Cody P Schafer <dev@codyps.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>