aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-03-25 21:17:53 -0600
committerMelody Horn <melody@boringcactus.com>2021-03-25 21:17:53 -0600
commit7fab365ffe9761c68d7c4c4ddefec860c5703c35 (patch)
tree631f35ef2384f525f893a3d326fc376d01c88187
parent509874e40b8e9cb692b73ce3de5ebae23c378dfd (diff)
downloadyapymake-7fab365ffe9761c68d7c4c4ddefec860c5703c35.tar.gz
yapymake-7fab365ffe9761c68d7c4c4ddefec860c5703c35.zip
lift builtin macros from GNU make, not POSIX make
-rw-r--r--yapymake/makefile/__init__.py37
1 files changed, 32 insertions, 5 deletions
diff --git a/yapymake/makefile/__init__.py b/yapymake/makefile/__init__.py
index 3407b3c..1f4687c 100644
--- a/yapymake/makefile/__init__.py
+++ b/yapymake/makefile/__init__.py
@@ -33,7 +33,11 @@ class Makefile:
if args.builtin_rules:
self._inference_rules += BUILTIN_INFERENCE_RULES
for k, v in BUILTIN_MACROS.items():
- self._macros[k] = (MacroSource.Builtin, TokenString.text(v))
+ if isinstance(v, TokenString):
+ v_tokens = v
+ else:
+ v_tokens = TokenString.text(v)
+ self._macros[k] = (MacroSource.Builtin, v_tokens)
for target in BUILTIN_TARGETS:
self._targets[target.name] = target
@@ -480,19 +484,42 @@ BUILTIN_INFERENCE_RULES = [
CommandLine(tokenize('rm -f $*.o')),
]),
]
-BUILTIN_MACROS = {
+BUILTIN_MACROS: Dict[str, Union[str, TokenString]] = {
'MAKE': 'make',
'AR': 'ar',
- 'ARFLAGS': '-rv',
+ #'ARFLAGS': '-rv',
'YACC': 'yacc',
'YFLAGS': '',
'LEX': 'lex',
'LFLAGS': '',
'LDFLAGS': '',
- 'CC': 'c99',
+ #'CC': 'c99',
'CFLAGS': '-O 1',
- 'FC': 'fort77',
+ #'FC': 'fort77',
'FFLAGS': '-O 1',
+
+ # TODO bitch about the non-POSIXness of these GNUisms
+ # from https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html#Implicit-Variables
+ 'AS': 'as',
+ 'CC': 'cc',
+ 'CXX': 'g++',
+ 'CPP': tokenize('$(CC) -E'),
+ 'FC': 'f77',
+ 'M2C': 'm2c',
+ 'PC': 'pc',
+ 'CO': 'co',
+ 'GET': 'get',
+ 'LINT': 'lint',
+ 'MAKEINFO': 'makeinfo',
+ 'TEX': 'tex',
+ 'TEXI2DVI': 'texi2dvi',
+ 'WEAVE': 'weave',
+ 'CWEAVE': 'cweave',
+ 'TANGLE': 'tangle',
+ 'CTANGLE': 'ctangle',
+ 'RM': 'rm -f',
+
+ 'ARFLAGS': 'rv',
}
BUILTIN_TARGETS = [
Target('.SUFFIXES', ['.o', '.c', '.y', '.l', '.a', '.sh', '.f'], []),