chiark / gitweb /
syntax: Support &: literal (for make `grouped' multiple targets)
[subdirmk.git] / subdirmk.ac
1 dnl -*-autoconf-*-
2 dnl subdirmk - autoconf macros
3 dnl  Copyright 2019 Mark Wooding
4 dnl  Copyright 2019 Ian Jackson
5 dnl SPDX-License-Identifier: LGPL-2.0-or-later
6 dnl There is NO WARRANTY.
7
8 _SUBDIRMK_MAKEFILES=""
9 AC_SUBST([_SUBDIRMK_MAKEFILES])
10
11 AC_DEFUN([SUBDIRMK_SUBDIRS],
12 [_SUBDIRMK_INIT
13 m4_map_args_w([$1],[_SUBDIRMK_SUBDIR(],[/)])])dnl
14
15 AC_DEFUN_ONCE([_SUBDIRMK_INIT],[
16   AC_CONFIG_FILES([
17         main.mk:main.mk.tmp
18         Dir.mk:Dir.mk.tmp
19         Final.mk:Final.mk.tmp
20         ],[],[
21      '$srcdir'/subdirmk/generate --srcdir='$srcdir' $subdirmk_subdirs
22   ])
23   SUBDIRMK_MAKEFILES([subdirmk/regen.mk subdirmk/usual.mk])
24 ])
25
26 AC_DEFUN([_SUBDIRMK_SUBDIR],[
27   subdirmk_subdirs="$subdirmk_subdirs '$1'"
28   AC_CONFIG_FILES([$1Dir.mk:$1Dir.mk.tmp])
29 ])
30
31 AC_DEFUN([SUBDIRMK_MAKEFILES],
32 [_SUBDIRMK_INIT
33 m4_map_args_w([$1],[_SUBDIRMK_MAKEFILE(],[)])])dnl
34
35 AC_DEFUN([_SUBDIRMK_MAKEFILE],[
36   _SUBDIRMK_MAKEFILES="$_SUBDIRMK_MAKEFILES $1"
37   AC_CONFIG_FILES([$1:$1.in])
38 ])