chiark / gitweb /
Syntax: Refine &TARGETS_things, mostly to avoid # wrinkle
[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
7 _SUBDIRMK_MAKEFILES=""
8 AC_SUBST([_SUBDIRMK_MAKEFILES])
9
10 AC_DEFUN([SUBDIRMK_SUBDIRS],
11 [_SUBDIRMK_INIT
12 m4_map_args_w([$1],[_SUBDIRMK_SUBDIR(],[/)])])dnl
13
14 AC_DEFUN_ONCE([_SUBDIRMK_INIT],[
15   AC_CONFIG_FILES([
16         main.mk:main.mk.tmp
17         Subdir.mk:Subdir.mk.tmp
18         ],[],[
19      '$srcdir'/subdirmk/generate --srcdir='$srcdir' $subdirmk_subdirs
20   ])
21   SUBDIRMK_MAKEFILES([subdirmk/regen.mk subdirmk/usual.mk])
22 ])
23
24 AC_DEFUN([_SUBDIRMK_SUBDIR],[
25   subdirmk_subdirs="$subdirmk_subdirs '$1'"
26   AC_CONFIG_FILES([$1Subdir.mk:$1Subdir.mk.tmp])
27 ])
28
29 AC_DEFUN([SUBDIRMK_MAKEFILES],
30 [_SUBDIRMK_INIT
31 m4_map_args_w([$1],[_SUBDIRMK_MAKEFILE(],[)])])dnl
32
33 AC_DEFUN([_SUBDIRMK_MAKEFILE],[
34   _SUBDIRMK_MAKEFILES="$_SUBDIRMK_MAKEFILES $1"
35   AC_CONFIG_FILES([$1:$1.in])
36 ])